Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3797)

Unified Diff: extensions/browser/app_window/app_window.cc

Issue 696063008: Refactor ShellDesktopController and ShellNativeAppWindow to allow for non-aura implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: + Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/app_window/app_window.cc
diff --git a/extensions/browser/app_window/app_window.cc b/extensions/browser/app_window/app_window.cc
index 8ce9cf646ce194f31e2d0e2a0dd59674ed3499a3..b60b71f86477f662f85f9ec7d54d0d563632fd2d 100644
--- a/extensions/browser/app_window/app_window.cc
+++ b/extensions/browser/app_window/app_window.cc
@@ -254,19 +254,18 @@ void AppWindow::Init(const GURL& url,
// Initialize the render interface and web contents
app_window_contents_.reset(app_window_contents);
app_window_contents_->Initialize(browser_context(), url);
- WebContents* web_contents = app_window_contents_->GetWebContents();
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableAppsShowOnFirstPaint)) {
- content::WebContentsObserver::Observe(web_contents);
+ content::WebContentsObserver::Observe(web_contents());
}
- app_delegate_->InitWebContents(web_contents);
+ app_delegate_->InitWebContents(web_contents());
- WebContentsModalDialogManager::CreateForWebContents(web_contents);
+ WebContentsModalDialogManager::CreateForWebContents(web_contents());
- web_contents->SetDelegate(this);
- WebContentsModalDialogManager::FromWebContents(web_contents)
+ web_contents()->SetDelegate(this);
+ WebContentsModalDialogManager::FromWebContents(web_contents())
->SetDelegate(this);
- SetViewType(web_contents, VIEW_TYPE_APP_WINDOW);
+ SetViewType(web_contents(), VIEW_TYPE_APP_WINDOW);
// Initialize the window
CreateParams new_params = LoadDefaults(params);
@@ -285,11 +284,11 @@ void AppWindow::Init(const GURL& url,
app_window_client->CreateNativeAppWindow(this, &new_params));
helper_.reset(new AppWebContentsHelper(
- browser_context_, extension_id_, web_contents, app_delegate_.get()));
+ browser_context_, extension_id_, web_contents(), app_delegate_.get()));
popup_manager_.reset(
new web_modal::PopupManager(GetWebContentsModalDialogHost()));
- popup_manager_->RegisterWith(web_contents);
+ popup_manager_->RegisterWith(web_contents());
UpdateExtensionAppIcon();
AppWindowRegistry::Get(browser_context_)->AddAppWindow(this);
@@ -343,7 +342,7 @@ void AppWindow::Init(const GURL& url,
gfx::Insets frame_insets = native_app_window_->GetFrameInsets();
gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets);
initial_bounds.Inset(frame_insets);
- app_delegate_->ResizeWebContents(web_contents, initial_bounds.size());
+ app_delegate_->ResizeWebContents(web_contents(), initial_bounds.size());
}
}
@@ -452,9 +451,10 @@ void AppWindow::DidFirstVisuallyNonEmptyPaint() {
void AppWindow::OnNativeClose() {
AppWindowRegistry::Get(browser_context_)->RemoveAppWindow(this);
if (app_window_contents_) {
- WebContents* web_contents = app_window_contents_->GetWebContents();
- WebContentsModalDialogManager::FromWebContents(web_contents)
- ->SetDelegate(NULL);
+ WebContentsModalDialogManager* modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents());
+ if (modal_dialog_manager) // May be null in unit tests.
+ modal_dialog_manager->SetDelegate(nullptr);
app_window_contents_->NativeWindowClosed();
}
delete this;
« no previous file with comments | « chrome/browser/power/process_power_collector_unittest.cc ('k') | extensions/browser/app_window/test_app_window_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698