diff --git a/shell/browser/api/electron_api_base_window.h b/shell/browser/api/electron_api_base_window.h index 1ee4443f9cdb..68619364a8fb 100644 --- a/shell/browser/api/electron_api_base_window.h +++ b/shell/browser/api/electron_api_base_window.h @@ -42,7 +42,8 @@ class BaseWindow : public gin_helper::TrackableObject, static void BuildPrototype(v8::Isolate* isolate, v8::Local prototype); - NativeWindow* window() const { return window_.get(); } + const NativeWindow* window() const { return window_.get(); } + NativeWindow* window() { return window_.get(); } protected: // Common constructor. @@ -262,6 +263,7 @@ class BaseWindow : public gin_helper::TrackableObject, #endif int32_t GetID() const; + private: // Helpers. // Remove this window from parent window's |child_windows_|. @@ -290,7 +292,6 @@ class BaseWindow : public gin_helper::TrackableObject, // Reference to JS wrapper to prevent garbage collection. v8::Global self_ref_; - private: base::WeakPtrFactory weak_factory_{this}; }; diff --git a/shell/browser/api/electron_api_browser_window.cc b/shell/browser/api/electron_api_browser_window.cc index 742ca07976da..b27c7f0f32c9 100644 --- a/shell/browser/api/electron_api_browser_window.cc +++ b/shell/browser/api/electron_api_browser_window.cc @@ -36,7 +36,7 @@ BrowserWindow::BrowserWindow(gin::Arguments* args, std::string color; if (options.Get(options::kBackgroundColor, &color)) { web_preferences.SetHidden(options::kBackgroundColor, color); - } else if (window_->IsTranslucent()) { + } else if (window()->IsTranslucent()) { // If the BrowserWindow is transparent or a vibrancy type has been set, // also propagate transparency to the WebContents unless a separate // backgroundColor has been set. @@ -67,7 +67,7 @@ BrowserWindow::BrowserWindow(gin::Arguments* args, gin::Handle web_contents_view = WebContentsView::Create(isolate, web_preferences); DCHECK(web_contents_view.get()); - window_->AddDraggableRegionProvider(web_contents_view.get()); + window()->AddDraggableRegionProvider(web_contents_view.get()); web_contents_view_.Reset(isolate, web_contents_view.ToV8()); // Save a reference of the WebContents. @@ -209,7 +209,7 @@ void BrowserWindow::UpdateWindowControlsOverlay( void BrowserWindow::CloseImmediately() { // Close all child windows before closing current window. v8::HandleScope handle_scope(isolate()); - for (v8::Local value : child_windows_.Values(isolate())) { + for (v8::Local value : GetChildWindows()) { gin::Handle child; if (gin::ConvertFromV8(isolate(), value, &child) && !child.IsEmpty()) child->window()->CloseImmediately();