| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shell_window.h" | 5 #include "apps/shell_window.h" |
| 6 | 6 |
| 7 #include "apps/apps_client.h" |
| 7 #include "apps/shell_window_geometry_cache.h" | 8 #include "apps/shell_window_geometry_cache.h" |
| 8 #include "apps/shell_window_registry.h" | 9 #include "apps/shell_window_registry.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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 if (CommandLine::ForCurrentProcess()->HasSwitch( | 226 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 227 switches::kEnableAppsShowOnFirstPaint)) { | 227 switches::kEnableAppsShowOnFirstPaint)) { |
| 228 // We want to show the window only when the content has been painted. For | 228 // We want to show the window only when the content has been painted. For |
| 229 // that to happen, we need to define a size for the content, otherwise the | 229 // that to happen, we need to define a size for the content, otherwise the |
| 230 // layout will happen in a 0x0 area. | 230 // layout will happen in a 0x0 area. |
| 231 // Note: WebContents::GetView() is guaranteed to be non-null. | 231 // Note: WebContents::GetView() is guaranteed to be non-null. |
| 232 web_contents->GetView()->SizeContents(new_params.bounds.size()); | 232 web_contents->GetView()->SizeContents(new_params.bounds.size()); |
| 233 } | 233 } |
| 234 | 234 |
| 235 // Prevent the browser process from shutting down while this window is open. | 235 // Prevent the browser process from shutting down while this window is open. |
| 236 chrome::StartKeepAlive(); | 236 AppsClient::Get()->StartKeepAlive(); |
| 237 | 237 |
| 238 UpdateExtensionAppIcon(); | 238 UpdateExtensionAppIcon(); |
| 239 | 239 |
| 240 ShellWindowRegistry::Get(browser_context_)->AddShellWindow(this); | 240 ShellWindowRegistry::Get(browser_context_)->AddShellWindow(this); |
| 241 } | 241 } |
| 242 | 242 |
| 243 ShellWindow::~ShellWindow() { | 243 ShellWindow::~ShellWindow() { |
| 244 // Unregister now to prevent getting NOTIFICATION_APP_TERMINATING if we're the | 244 // Unregister now to prevent getting NOTIFICATION_APP_TERMINATING if we're the |
| 245 // last window open. | 245 // last window open. |
| 246 registrar_.RemoveAll(); | 246 registrar_.RemoveAll(); |
| 247 | 247 |
| 248 // Remove shutdown prevention. | 248 // Remove shutdown prevention. |
| 249 chrome::EndKeepAlive(); | 249 AppsClient::Get()->EndKeepAlive(); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void ShellWindow::RequestMediaAccessPermission( | 252 void ShellWindow::RequestMediaAccessPermission( |
| 253 content::WebContents* web_contents, | 253 content::WebContents* web_contents, |
| 254 const content::MediaStreamRequest& request, | 254 const content::MediaStreamRequest& request, |
| 255 const content::MediaResponseCallback& callback) { | 255 const content::MediaResponseCallback& callback) { |
| 256 delegate_->RequestMediaAccessPermission(web_contents, request, callback, | 256 delegate_->RequestMediaAccessPermission(web_contents, request, callback, |
| 257 extension()); | 257 extension()); |
| 258 } | 258 } |
| 259 | 259 |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 region.bounds.x(), | 982 region.bounds.x(), |
| 983 region.bounds.y(), | 983 region.bounds.y(), |
| 984 region.bounds.right(), | 984 region.bounds.right(), |
| 985 region.bounds.bottom(), | 985 region.bounds.bottom(), |
| 986 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 986 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
| 987 } | 987 } |
| 988 return sk_region; | 988 return sk_region; |
| 989 } | 989 } |
| 990 | 990 |
| 991 } // namespace apps | 991 } // namespace apps |
| OLD | NEW |