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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 if (CommandLine::ForCurrentProcess()->HasSwitch( | 225 if (CommandLine::ForCurrentProcess()->HasSwitch( |
226 switches::kEnableAppsShowOnFirstPaint)) { | 226 switches::kEnableAppsShowOnFirstPaint)) { |
227 // We want to show the window only when the content has been painted. For | 227 // We want to show the window only when the content has been painted. For |
228 // that to happen, we need to define a size for the content, otherwise the | 228 // that to happen, we need to define a size for the content, otherwise the |
229 // layout will happen in a 0x0 area. | 229 // layout will happen in a 0x0 area. |
230 // Note: WebContents::GetView() is guaranteed to be non-null. | 230 // Note: WebContents::GetView() is guaranteed to be non-null. |
231 web_contents->GetView()->SizeContents(new_params.bounds.size()); | 231 web_contents->GetView()->SizeContents(new_params.bounds.size()); |
232 } | 232 } |
233 | 233 |
234 // Prevent the browser process from shutting down while this window is open. | 234 // Prevent the browser process from shutting down while this window is open. |
235 chrome::StartKeepAlive(); | 235 AppsClient::Get()->StartKeepAlive(); |
236 | 236 |
237 UpdateExtensionAppIcon(); | 237 UpdateExtensionAppIcon(); |
238 | 238 |
239 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this); | 239 AppWindowRegistry::Get(browser_context_)->AddAppWindow(this); |
240 } | 240 } |
241 | 241 |
242 AppWindow::~AppWindow() { | 242 AppWindow::~AppWindow() { |
243 // Unregister now to prevent getting NOTIFICATION_APP_TERMINATING if we're the | 243 // Unregister now to prevent getting NOTIFICATION_APP_TERMINATING if we're the |
244 // last window open. | 244 // last window open. |
245 registrar_.RemoveAll(); | 245 registrar_.RemoveAll(); |
246 | 246 |
247 // Remove shutdown prevention. | 247 // Remove shutdown prevention. |
248 chrome::EndKeepAlive(); | 248 AppsClient::Get()->EndKeepAlive(); |
249 } | 249 } |
250 | 250 |
251 void AppWindow::RequestMediaAccessPermission( | 251 void AppWindow::RequestMediaAccessPermission( |
252 content::WebContents* web_contents, | 252 content::WebContents* web_contents, |
253 const content::MediaStreamRequest& request, | 253 const content::MediaStreamRequest& request, |
254 const content::MediaResponseCallback& callback) { | 254 const content::MediaResponseCallback& callback) { |
255 delegate_->RequestMediaAccessPermission( | 255 delegate_->RequestMediaAccessPermission( |
256 web_contents, request, callback, extension()); | 256 web_contents, request, callback, extension()); |
257 } | 257 } |
258 | 258 |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 region.bounds.x(), | 968 region.bounds.x(), |
969 region.bounds.y(), | 969 region.bounds.y(), |
970 region.bounds.right(), | 970 region.bounds.right(), |
971 region.bounds.bottom(), | 971 region.bounds.bottom(), |
972 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 972 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
973 } | 973 } |
974 return sk_region; | 974 return sk_region; |
975 } | 975 } |
976 | 976 |
977 } // namespace apps | 977 } // namespace apps |
OLD | NEW |