OLD | NEW |
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 "apps/app_window_geometry_cache.h" | 7 #include "apps/app_window_geometry_cache.h" |
8 #include "apps/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
| 9 #include "apps/apps_client.h" |
9 #include "apps/ui/native_app_window.h" | 10 #include "apps/ui/native_app_window.h" |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/extensions/extension_web_contents_observer.h" | 16 #include "chrome/browser/extensions/extension_web_contents_observer.h" |
16 #include "chrome/browser/extensions/suggest_permission_util.h" | 17 #include "chrome/browser/extensions/suggest_permission_util.h" |
17 #include "chrome/browser/lifetime/application_lifetime.h" | |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/extensions/extension_messages.h" | 19 #include "chrome/common/extensions/extension_messages.h" |
20 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 20 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
21 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 21 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
22 #include "content/public/browser/browser_context.h" | 22 #include "content/public/browser/browser_context.h" |
23 #include "content/public/browser/invalidate_type.h" | 23 #include "content/public/browser/invalidate_type.h" |
24 #include "content/public/browser/navigation_entry.h" | 24 #include "content/public/browser/navigation_entry.h" |
25 #include "content/public/browser/notification_details.h" | 25 #include "content/public/browser/notification_details.h" |
26 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
27 #include "content/public/browser/notification_source.h" | 27 #include "content/public/browser/notification_source.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 if (CommandLine::ForCurrentProcess()->HasSwitch( | 224 if (CommandLine::ForCurrentProcess()->HasSwitch( |
225 switches::kEnableAppsShowOnFirstPaint)) { | 225 switches::kEnableAppsShowOnFirstPaint)) { |
226 // We want to show the window only when the content has been painted. For | 226 // We want to show the window only when the content has been painted. For |
227 // that to happen, we need to define a size for the content, otherwise the | 227 // that to happen, we need to define a size for the content, otherwise the |
228 // layout will happen in a 0x0 area. | 228 // layout will happen in a 0x0 area. |
229 // Note: WebContents::GetView() is guaranteed to be non-null. | 229 // Note: WebContents::GetView() is guaranteed to be non-null. |
230 web_contents->GetView()->SizeContents(new_params.bounds.size()); | 230 web_contents->GetView()->SizeContents(new_params.bounds.size()); |
231 } | 231 } |
232 | 232 |
233 // Prevent the browser process from shutting down while this window is open. | 233 // Prevent the browser process from shutting down while this window is open. |
234 chrome::StartKeepAlive(); | 234 AppsClient::Get()->StartKeepAlive(); |
235 | 235 |
236 UpdateExtensionAppIcon(); | 236 UpdateExtensionAppIcon(); |
237 | 237 |
238 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this); | 238 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this); |
239 } | 239 } |
240 | 240 |
241 AppWindow::~AppWindow() { | 241 AppWindow::~AppWindow() { |
242 // Unregister now to prevent getting NOTIFICATION_APP_TERMINATING if we're the | 242 // Unregister now to prevent getting NOTIFICATION_APP_TERMINATING if we're the |
243 // last window open. | 243 // last window open. |
244 registrar_.RemoveAll(); | 244 registrar_.RemoveAll(); |
245 | 245 |
246 // Remove shutdown prevention. | 246 // Remove shutdown prevention. |
247 chrome::EndKeepAlive(); | 247 AppsClient::Get()->EndKeepAlive(); |
248 } | 248 } |
249 | 249 |
250 void AppWindow::RequestMediaAccessPermission( | 250 void AppWindow::RequestMediaAccessPermission( |
251 content::WebContents* web_contents, | 251 content::WebContents* web_contents, |
252 const content::MediaStreamRequest& request, | 252 const content::MediaStreamRequest& request, |
253 const content::MediaResponseCallback& callback) { | 253 const content::MediaResponseCallback& callback) { |
254 delegate_->RequestMediaAccessPermission( | 254 delegate_->RequestMediaAccessPermission( |
255 web_contents, request, callback, extension()); | 255 web_contents, request, callback, extension()); |
256 } | 256 } |
257 | 257 |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 region.bounds.x(), | 965 region.bounds.x(), |
966 region.bounds.y(), | 966 region.bounds.y(), |
967 region.bounds.right(), | 967 region.bounds.right(), |
968 region.bounds.bottom(), | 968 region.bounds.bottom(), |
969 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 969 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
970 } | 970 } |
971 return sk_region; | 971 return sk_region; |
972 } | 972 } |
973 | 973 |
974 } // namespace apps | 974 } // namespace apps |
OLD | NEW |