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

Side by Side Diff: apps/app_window.cc

Issue 436503002: Moved CreateNativeAppWindow from AppWindow::Delegate to AppsClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "apps/app_delegate.h" 11 #include "apps/app_delegate.h"
12 #include "apps/app_window_geometry_cache.h" 12 #include "apps/app_window_geometry_cache.h"
13 #include "apps/app_window_registry.h" 13 #include "apps/app_window_registry.h"
14 #include "apps/apps_client.h"
15 #include "apps/size_constraints.h" 14 #include "apps/size_constraints.h"
15 #include "apps/ui/apps_client.h"
16 #include "apps/ui/native_app_window.h" 16 #include "apps/ui/native_app_window.h"
17 #include "apps/ui/web_contents_sizer.h" 17 #include "apps/ui/web_contents_sizer.h"
18 #include "base/command_line.h" 18 #include "base/command_line.h"
19 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/values.h" 21 #include "base/values.h"
22 #include "chrome/browser/chrome_notification_types.h" 22 #include "chrome/browser/chrome_notification_types.h"
23 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 23 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
24 #include "chrome/browser/extensions/suggest_permission_util.h" 24 #include "chrome/browser/extensions/suggest_permission_util.h"
25 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 frame_insets); 217 frame_insets);
218 } 218 }
219 219
220 gfx::Size AppWindow::CreateParams::GetWindowMaximumSize( 220 gfx::Size AppWindow::CreateParams::GetWindowMaximumSize(
221 const gfx::Insets& frame_insets) const { 221 const gfx::Insets& frame_insets) const {
222 return GetCombinedWindowConstraints(window_spec.maximum_size, 222 return GetCombinedWindowConstraints(window_spec.maximum_size,
223 content_spec.maximum_size, 223 content_spec.maximum_size,
224 frame_insets); 224 frame_insets);
225 } 225 }
226 226
227 // AppWindow::Delegate
228
229 AppWindow::Delegate::~Delegate() {}
230
231 // AppWindow 227 // AppWindow
232 228
233 AppWindow::AppWindow(BrowserContext* context, 229 AppWindow::AppWindow(BrowserContext* context,
234 AppDelegate* app_delegate, 230 AppDelegate* app_delegate,
235 Delegate* delegate,
236 const extensions::Extension* extension) 231 const extensions::Extension* extension)
237 : browser_context_(context), 232 : browser_context_(context),
238 extension_id_(extension->id()), 233 extension_id_(extension->id()),
239 window_type_(WINDOW_TYPE_DEFAULT), 234 window_type_(WINDOW_TYPE_DEFAULT),
240 app_delegate_(app_delegate), 235 app_delegate_(app_delegate),
241 delegate_(delegate),
242 image_loader_ptr_factory_(this), 236 image_loader_ptr_factory_(this),
243 fullscreen_types_(FULLSCREEN_TYPE_NONE), 237 fullscreen_types_(FULLSCREEN_TYPE_NONE),
244 show_on_first_paint_(false), 238 show_on_first_paint_(false),
245 first_paint_complete_(false), 239 first_paint_complete_(false),
246 has_been_shown_(false), 240 has_been_shown_(false),
247 can_send_events_(false), 241 can_send_events_(false),
248 is_hidden_(false), 242 is_hidden_(false),
249 cached_always_on_top_(false), 243 cached_always_on_top_(false),
250 requested_transparent_background_(false) { 244 requested_transparent_background_(false) {
251 extensions::ExtensionsBrowserClient* client = 245 extensions::ExtensionsBrowserClient* client =
(...skipping 30 matching lines...) Expand all
282 window_type_ = new_params.window_type; 276 window_type_ = new_params.window_type;
283 window_key_ = new_params.window_key; 277 window_key_ = new_params.window_key;
284 278
285 // Windows cannot be always-on-top in fullscreen mode for security reasons. 279 // Windows cannot be always-on-top in fullscreen mode for security reasons.
286 cached_always_on_top_ = new_params.always_on_top; 280 cached_always_on_top_ = new_params.always_on_top;
287 if (new_params.state == ui::SHOW_STATE_FULLSCREEN) 281 if (new_params.state == ui::SHOW_STATE_FULLSCREEN)
288 new_params.always_on_top = false; 282 new_params.always_on_top = false;
289 283
290 requested_transparent_background_ = new_params.transparent_background; 284 requested_transparent_background_ = new_params.transparent_background;
291 285
292 native_app_window_.reset(delegate_->CreateNativeAppWindow(this, new_params)); 286 AppsClient* apps_client = AppsClient::Get();
287 native_app_window_.reset(
288 apps_client->CreateNativeAppWindow(this, new_params));
293 289
294 popup_manager_.reset( 290 popup_manager_.reset(
295 new web_modal::PopupManager(GetWebContentsModalDialogHost())); 291 new web_modal::PopupManager(GetWebContentsModalDialogHost()));
296 popup_manager_->RegisterWith(web_contents); 292 popup_manager_->RegisterWith(web_contents);
297 293
298 // Prevent the browser process from shutting down while this window exists. 294 // Prevent the browser process from shutting down while this window exists.
299 AppsClient::Get()->IncrementKeepAliveCount(); 295 apps_client->IncrementKeepAliveCount();
300 UpdateExtensionAppIcon(); 296 UpdateExtensionAppIcon();
301 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this); 297 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this);
302 298
303 if (new_params.hidden) { 299 if (new_params.hidden) {
304 // Although the window starts hidden by default, calling Hide() here 300 // Although the window starts hidden by default, calling Hide() here
305 // notifies observers of the window being hidden. 301 // notifies observers of the window being hidden.
306 Hide(); 302 Hide();
307 } else { 303 } else {
308 // Panels are not activated by default. 304 // Panels are not activated by default.
309 Show(window_type_is_panel() || !new_params.focused ? SHOW_INACTIVE 305 Show(window_type_is_panel() || !new_params.focused ? SHOW_INACTIVE
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 region.bounds.x(), 1148 region.bounds.x(),
1153 region.bounds.y(), 1149 region.bounds.y(),
1154 region.bounds.right(), 1150 region.bounds.right(),
1155 region.bounds.bottom(), 1151 region.bounds.bottom(),
1156 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); 1152 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
1157 } 1153 }
1158 return sk_region; 1154 return sk_region;
1159 } 1155 }
1160 1156
1161 } // namespace apps 1157 } // namespace apps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698