Index: apps/app_window.cc |
diff --git a/apps/app_window.cc b/apps/app_window.cc |
index 6412b1041ba6fabfa67aacdc51131a653731a2e6..ece3bcbbf53ae5ef7041929ed00a5c7540e061ec 100644 |
--- a/apps/app_window.cc |
+++ b/apps/app_window.cc |
@@ -238,6 +238,7 @@ AppWindow::AppWindow(BrowserContext* context, |
fullscreen_types_(FULLSCREEN_TYPE_NONE), |
show_on_first_paint_(false), |
first_paint_complete_(false), |
+ has_been_shown_(false), |
is_hidden_(false), |
cached_always_on_top_(false) { |
extensions::ExtensionsBrowserClient* client = |
@@ -253,8 +254,8 @@ void AppWindow::Init(const GURL& url, |
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)) { |
+ if (!CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kDisableAppsShowOnFirstPaint)) { |
content::WebContentsObserver::Observe(web_contents); |
} |
delegate_->InitWebContents(web_contents); |
@@ -326,8 +327,8 @@ void AppWindow::Init(const GURL& url, |
app_window_contents_->LoadContents(new_params.creator_process_id); |
- if (CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kEnableAppsShowOnFirstPaint)) { |
+ if (!CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kDisableAppsShowOnFirstPaint)) { |
// We want to show the window only when the content has been painted. For |
// that to happen, we need to define a size for the content, otherwise the |
// layout will happen in a 0x0 area. |
@@ -679,8 +680,8 @@ void AppWindow::SetContentSizeConstraints(const gfx::Size& min_size, |
void AppWindow::Show(ShowType show_type) { |
is_hidden_ = false; |
- if (CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kEnableAppsShowOnFirstPaint)) { |
+ if (!CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kDisableAppsShowOnFirstPaint)) { |
show_on_first_paint_ = true; |
if (!first_paint_complete_) { |
@@ -698,6 +699,11 @@ void AppWindow::Show(ShowType show_type) { |
break; |
} |
AppWindowRegistry::Get(browser_context_)->AppWindowShown(this); |
+ |
+ if (!has_been_shown_) { |
+ has_been_shown_ = true; |
+ app_window_contents_->NativeWindowFirstShown(); |
+ } |
} |
void AppWindow::Hide() { |