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

Side by Side Diff: apps/app_window.cc

Issue 287123002: [WebModals] New API for browser-scoped popup management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "apps/app_window.h" 5 #include "apps/app_window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "apps/app_window_geometry_cache.h" 9 #include "apps/app_window_geometry_cache.h"
10 #include "apps/app_window_registry.h" 10 #include "apps/app_window_registry.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 const CreateParams& params) { 257 const CreateParams& params) {
258 // Initialize the render interface and web contents 258 // Initialize the render interface and web contents
259 app_window_contents_.reset(app_window_contents); 259 app_window_contents_.reset(app_window_contents);
260 app_window_contents_->Initialize(browser_context(), url); 260 app_window_contents_->Initialize(browser_context(), url);
261 WebContents* web_contents = app_window_contents_->GetWebContents(); 261 WebContents* web_contents = app_window_contents_->GetWebContents();
262 if (CommandLine::ForCurrentProcess()->HasSwitch( 262 if (CommandLine::ForCurrentProcess()->HasSwitch(
263 switches::kEnableAppsShowOnFirstPaint)) { 263 switches::kEnableAppsShowOnFirstPaint)) {
264 content::WebContentsObserver::Observe(web_contents); 264 content::WebContentsObserver::Observe(web_contents);
265 } 265 }
266 delegate_->InitWebContents(web_contents); 266 delegate_->InitWebContents(web_contents);
267
267 WebContentsModalDialogManager::CreateForWebContents(web_contents); 268 WebContentsModalDialogManager::CreateForWebContents(web_contents);
268 // TODO(jamescook): Delegate out this creation. 269 // TODO(jamescook): Delegate out this creation.
269 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( 270 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents(
270 web_contents); 271 web_contents);
271 272
272 web_contents->SetDelegate(this); 273 web_contents->SetDelegate(this);
273 WebContentsModalDialogManager::FromWebContents(web_contents) 274 WebContentsModalDialogManager::FromWebContents(web_contents)
274 ->SetDelegate(this); 275 ->SetDelegate(this);
275 extensions::SetViewType(web_contents, extensions::VIEW_TYPE_APP_WINDOW); 276 extensions::SetViewType(web_contents, extensions::VIEW_TYPE_APP_WINDOW);
276 277
277 // Initialize the window 278 // Initialize the window
278 CreateParams new_params = LoadDefaults(params); 279 CreateParams new_params = LoadDefaults(params);
279 window_type_ = new_params.window_type; 280 window_type_ = new_params.window_type;
280 window_key_ = new_params.window_key; 281 window_key_ = new_params.window_key;
281 282
282 // Windows cannot be always-on-top in fullscreen mode for security reasons. 283 // Windows cannot be always-on-top in fullscreen mode for security reasons.
283 cached_always_on_top_ = new_params.always_on_top; 284 cached_always_on_top_ = new_params.always_on_top;
284 if (new_params.state == ui::SHOW_STATE_FULLSCREEN) 285 if (new_params.state == ui::SHOW_STATE_FULLSCREEN)
285 new_params.always_on_top = false; 286 new_params.always_on_top = false;
286 287
287 native_app_window_.reset(delegate_->CreateNativeAppWindow(this, new_params)); 288 native_app_window_.reset(delegate_->CreateNativeAppWindow(this, new_params));
288 289
290 DCHECK(GetWebContentsModalDialogHost());
benwells 2014/06/30 01:16:52 Nit: can you do DCHECK(popup_manager_.get()) a lit
Greg Billock 2014/06/30 04:37:36 Removed this, at least for now. It turns out Cocoa
291 popup_manager_.reset(
292 new web_modal::PopupManager(GetWebContentsModalDialogHost()));
293 popup_manager_->RegisterWith(web_contents);
benwells 2014/06/30 01:16:52 Does there need to be unregistering somewhere?
294
289 // Prevent the browser process from shutting down while this window exists. 295 // Prevent the browser process from shutting down while this window exists.
290 AppsClient::Get()->IncrementKeepAliveCount(); 296 AppsClient::Get()->IncrementKeepAliveCount();
291 UpdateExtensionAppIcon(); 297 UpdateExtensionAppIcon();
292 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this); 298 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this);
293 299
294 if (new_params.hidden) { 300 if (new_params.hidden) {
295 // Although the window starts hidden by default, calling Hide() here 301 // Although the window starts hidden by default, calling Hide() here
296 // notifies observers of the window being hidden. 302 // notifies observers of the window being hidden.
297 Hide(); 303 Hide();
298 } else { 304 } else {
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 region.bounds.x(), 1148 region.bounds.x(),
1143 region.bounds.y(), 1149 region.bounds.y(),
1144 region.bounds.right(), 1150 region.bounds.right(),
1145 region.bounds.bottom(), 1151 region.bounds.bottom(),
1146 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); 1152 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
1147 } 1153 }
1148 return sk_region; 1154 return sk_region;
1149 } 1155 }
1150 1156
1151 } // namespace apps 1157 } // namespace apps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698