| 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/apps_client.h" |
| 10 #include "apps/ui/native_app_window.h" | 10 #include "apps/ui/native_app_window.h" |
| (...skipping 214 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 AppsClient::Get()->StartKeepAlive(); | 235 AppsClient::Get()->IncrementKeepAliveCount(); |
| 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 AppsClient::Get()->EndKeepAlive(); | 248 AppsClient::Get()->DecrementKeepAliveCount(); |
| 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 |