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 "extensions/browser/app_window/app_window.h" | 5 #include "extensions/browser/app_window/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 "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 15 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
16 #include "content/public/browser/browser_context.h" | 16 #include "content/public/browser/browser_context.h" |
17 #include "content/public/browser/invalidate_type.h" | 17 #include "content/public/browser/invalidate_type.h" |
18 #include "content/public/browser/navigation_entry.h" | 18 #include "content/public/browser/navigation_entry.h" |
19 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
20 #include "content/public/browser/resource_dispatcher_host.h" | 20 #include "content/public/browser/resource_dispatcher_host.h" |
21 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
22 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
23 #include "content/public/common/media_stream_request.h" | 23 #include "content/public/common/media_stream_request.h" |
24 #include "extensions/browser/app_window/app_delegate.h" | 24 #include "extensions/browser/app_window/app_delegate.h" |
25 #include "extensions/browser/app_window/app_web_contents_helper.h" | 25 #include "extensions/browser/app_window/app_web_contents_helper.h" |
| 26 #include "extensions/browser/app_window/app_window_client.h" |
26 #include "extensions/browser/app_window/app_window_geometry_cache.h" | 27 #include "extensions/browser/app_window/app_window_geometry_cache.h" |
27 #include "extensions/browser/app_window/app_window_registry.h" | 28 #include "extensions/browser/app_window/app_window_registry.h" |
28 #include "extensions/browser/app_window/apps_client.h" | |
29 #include "extensions/browser/app_window/native_app_window.h" | 29 #include "extensions/browser/app_window/native_app_window.h" |
30 #include "extensions/browser/app_window/size_constraints.h" | 30 #include "extensions/browser/app_window/size_constraints.h" |
31 #include "extensions/browser/extension_registry.h" | 31 #include "extensions/browser/extension_registry.h" |
32 #include "extensions/browser/extension_system.h" | 32 #include "extensions/browser/extension_system.h" |
33 #include "extensions/browser/extensions_browser_client.h" | 33 #include "extensions/browser/extensions_browser_client.h" |
34 #include "extensions/browser/process_manager.h" | 34 #include "extensions/browser/process_manager.h" |
35 #include "extensions/browser/suggest_permission_util.h" | 35 #include "extensions/browser/suggest_permission_util.h" |
36 #include "extensions/browser/view_type_utils.h" | 36 #include "extensions/browser/view_type_utils.h" |
37 #include "extensions/common/draggable_region.h" | 37 #include "extensions/common/draggable_region.h" |
38 #include "extensions/common/extension.h" | 38 #include "extensions/common/extension.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 window_type_ = new_params.window_type; | 265 window_type_ = new_params.window_type; |
266 window_key_ = new_params.window_key; | 266 window_key_ = new_params.window_key; |
267 | 267 |
268 // Windows cannot be always-on-top in fullscreen mode for security reasons. | 268 // Windows cannot be always-on-top in fullscreen mode for security reasons. |
269 cached_always_on_top_ = new_params.always_on_top; | 269 cached_always_on_top_ = new_params.always_on_top; |
270 if (new_params.state == ui::SHOW_STATE_FULLSCREEN) | 270 if (new_params.state == ui::SHOW_STATE_FULLSCREEN) |
271 new_params.always_on_top = false; | 271 new_params.always_on_top = false; |
272 | 272 |
273 requested_alpha_enabled_ = new_params.alpha_enabled; | 273 requested_alpha_enabled_ = new_params.alpha_enabled; |
274 | 274 |
275 AppsClient* apps_client = AppsClient::Get(); | 275 AppWindowClient* apps_client = AppWindowClient::Get(); |
276 native_app_window_.reset( | 276 native_app_window_.reset( |
277 apps_client->CreateNativeAppWindow(this, new_params)); | 277 apps_client->CreateNativeAppWindow(this, new_params)); |
278 | 278 |
279 helper_.reset(new AppWebContentsHelper( | 279 helper_.reset(new AppWebContentsHelper( |
280 browser_context_, extension_id_, web_contents, app_delegate_.get())); | 280 browser_context_, extension_id_, web_contents, app_delegate_.get())); |
281 | 281 |
282 popup_manager_.reset( | 282 popup_manager_.reset( |
283 new web_modal::PopupManager(GetWebContentsModalDialogHost())); | 283 new web_modal::PopupManager(GetWebContentsModalDialogHost())); |
284 popup_manager_->RegisterWith(web_contents); | 284 popup_manager_->RegisterWith(web_contents); |
285 | 285 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 328 } |
329 } | 329 } |
330 | 330 |
331 AppWindow::~AppWindow() { | 331 AppWindow::~AppWindow() { |
332 // Unregister now to prevent getting notified if we're the last window open. | 332 // Unregister now to prevent getting notified if we're the last window open. |
333 app_delegate_->SetTerminatingCallback(base::Closure()); | 333 app_delegate_->SetTerminatingCallback(base::Closure()); |
334 | 334 |
335 ExtensionRegistry::Get(browser_context_)->RemoveObserver(this); | 335 ExtensionRegistry::Get(browser_context_)->RemoveObserver(this); |
336 | 336 |
337 // Remove shutdown prevention. | 337 // Remove shutdown prevention. |
338 AppsClient::Get()->DecrementKeepAliveCount(); | 338 AppWindowClient::Get()->DecrementKeepAliveCount(); |
339 } | 339 } |
340 | 340 |
341 void AppWindow::RequestMediaAccessPermission( | 341 void AppWindow::RequestMediaAccessPermission( |
342 content::WebContents* web_contents, | 342 content::WebContents* web_contents, |
343 const content::MediaStreamRequest& request, | 343 const content::MediaStreamRequest& request, |
344 const content::MediaResponseCallback& callback) { | 344 const content::MediaResponseCallback& callback) { |
345 DCHECK_EQ(AppWindow::web_contents(), web_contents); | 345 DCHECK_EQ(AppWindow::web_contents(), web_contents); |
346 helper_->RequestMediaAccessPermission(request, callback); | 346 helper_->RequestMediaAccessPermission(request, callback); |
347 } | 347 } |
348 | 348 |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 region.bounds.x(), | 1066 region.bounds.x(), |
1067 region.bounds.y(), | 1067 region.bounds.y(), |
1068 region.bounds.right(), | 1068 region.bounds.right(), |
1069 region.bounds.bottom(), | 1069 region.bounds.bottom(), |
1070 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1070 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
1071 } | 1071 } |
1072 return sk_region; | 1072 return sk_region; |
1073 } | 1073 } |
1074 | 1074 |
1075 } // namespace extensions | 1075 } // namespace extensions |
OLD | NEW |