Browse Source

No need to get BrowserContext from NativeWindow

Cheng Zhao 7 years ago
parent
commit
8bbe28e998
2 changed files with 2 additions and 7 deletions
  1. 0 1
      atom/browser/native_window_mac.mm
  2. 2 6
      atom/browser/web_dialog_helper.cc

+ 0 - 1
atom/browser/native_window_mac.mm

@@ -990,7 +990,6 @@ NativeWindowMac::NativeWindowMac(
 
 NativeWindowMac::~NativeWindowMac() {
   [NSEvent removeMonitor:wheel_event_monitor_];
-  Observe(nullptr);
 }
 
 void NativeWindowMac::Close() {

+ 2 - 6
atom/browser/web_dialog_helper.cc

@@ -235,12 +235,8 @@ void WebDialogHelper::RunFileChooser(
         NOTREACHED();
     }
 
-    AtomBrowserContext* browser_context = static_cast<AtomBrowserContext*>(
-        window_->web_contents()->GetBrowserContext());
-    if (!browser_context) {
-      browser_context = static_cast<atom::AtomBrowserContext*>(
-          render_frame_host->GetProcess()->GetBrowserContext());
-    }
+    auto* browser_context = static_cast<atom::AtomBrowserContext*>(
+        render_frame_host->GetProcess()->GetBrowserContext());
     settings.default_path = browser_context->prefs()->GetFilePath(
         prefs::kSelectFileLastDirectory).Append(params.default_file_name);
     settings.properties = flags;