OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/extensions/shell_window.h" | 5 #include "chrome/browser/ui/extensions/shell_window.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/app_window_contents.h" | 9 #include "chrome/browser/extensions/app_window_contents.h" |
10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
11 #include "chrome/browser/extensions/extension_system.h" | 11 #include "chrome/browser/extensions/extension_system.h" |
12 #include "chrome/browser/extensions/image_loader.h" | 12 #include "chrome/browser/extensions/image_loader.h" |
13 #include "chrome/browser/extensions/shell_window_geometry_cache.h" | 13 #include "chrome/browser/extensions/shell_window_geometry_cache.h" |
14 #include "chrome/browser/extensions/shell_window_registry.h" | 14 #include "chrome/browser/extensions/shell_window_registry.h" |
15 #include "chrome/browser/extensions/suggest_permission_util.h" | 15 #include "chrome/browser/extensions/suggest_permission_util.h" |
16 #include "chrome/browser/favicon/favicon_tab_helper.h" | 16 #include "chrome/browser/favicon/favicon_tab_helper.h" |
17 #include "chrome/browser/file_select_helper.h" | 17 #include "chrome/browser/file_select_helper.h" |
18 #include "chrome/browser/lifetime/application_lifetime.h" | 18 #include "chrome/browser/lifetime/application_lifetime.h" |
19 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 19 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/sessions/session_id.h" | 21 #include "chrome/browser/sessions/session_id.h" |
22 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
23 #include "chrome/browser/ui/browser_finder.h" | 23 #include "chrome/browser/ui/browser_finder.h" |
24 #include "chrome/browser/ui/browser_tabstrip.h" | 24 #include "chrome/browser/ui/browser_tabstrip.h" |
25 #include "chrome/browser/ui/browser_window.h" | 25 #include "chrome/browser/ui/browser_window.h" |
26 #include "chrome/browser/ui/extensions/native_app_window.h" | 26 #include "chrome/browser/ui/extensions/native_app_window.h" |
27 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" | |
28 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
29 #include "chrome/common/extensions/extension.h" | 28 #include "chrome/common/extensions/extension.h" |
30 #include "chrome/common/extensions/extension_constants.h" | 29 #include "chrome/common/extensions/extension_constants.h" |
31 #include "chrome/common/extensions/extension_messages.h" | 30 #include "chrome/common/extensions/extension_messages.h" |
32 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 31 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
| 32 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
33 #include "content/public/browser/invalidate_type.h" | 33 #include "content/public/browser/invalidate_type.h" |
34 #include "content/public/browser/navigation_entry.h" | 34 #include "content/public/browser/navigation_entry.h" |
35 #include "content/public/browser/notification_details.h" | 35 #include "content/public/browser/notification_details.h" |
36 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
37 #include "content/public/browser/notification_source.h" | 37 #include "content/public/browser/notification_source.h" |
38 #include "content/public/browser/notification_types.h" | 38 #include "content/public/browser/notification_types.h" |
39 #include "content/public/browser/render_view_host.h" | 39 #include "content/public/browser/render_view_host.h" |
40 #include "content/public/browser/resource_dispatcher_host.h" | 40 #include "content/public/browser/resource_dispatcher_host.h" |
41 #include "content/public/browser/web_contents.h" | 41 #include "content/public/browser/web_contents.h" |
42 #include "content/public/common/media_stream_request.h" | 42 #include "content/public/common/media_stream_request.h" |
43 #include "extensions/browser/view_type_utils.h" | 43 #include "extensions/browser/view_type_utils.h" |
44 #include "skia/ext/image_operations.h" | 44 #include "skia/ext/image_operations.h" |
45 #include "third_party/skia/include/core/SkRegion.h" | 45 #include "third_party/skia/include/core/SkRegion.h" |
46 #include "ui/gfx/image/image_skia.h" | 46 #include "ui/gfx/image/image_skia.h" |
47 | 47 |
48 #if defined(USE_ASH) | 48 #if defined(USE_ASH) |
49 #include "ash/launcher/launcher_types.h" | 49 #include "ash/launcher/launcher_types.h" |
50 #endif | 50 #endif |
51 | 51 |
52 using content::ConsoleMessageLevel; | 52 using content::ConsoleMessageLevel; |
53 using content::WebContents; | 53 using content::WebContents; |
54 using extensions::APIPermission; | 54 using extensions::APIPermission; |
| 55 using web_modal::WebContentsModalDialogHost; |
| 56 using web_modal::WebContentsModalDialogManager; |
55 | 57 |
56 namespace { | 58 namespace { |
57 const int kDefaultWidth = 512; | 59 const int kDefaultWidth = 512; |
58 const int kDefaultHeight = 384; | 60 const int kDefaultHeight = 384; |
59 | 61 |
60 // The preferred icon size for displaying the app icon. | 62 // The preferred icon size for displaying the app icon. |
61 #if defined(USE_ASH) | 63 #if defined(USE_ASH) |
62 const int kPreferredIconSize = ash::kLauncherPreferredSize; | 64 const int kPreferredIconSize = ash::kLauncherPreferredSize; |
63 #else | 65 #else |
64 const int kPreferredIconSize = extension_misc::EXTENSION_ICON_SMALL; | 66 const int kPreferredIconSize = extension_misc::EXTENSION_ICON_SMALL; |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 NOTREACHED() << "Received unexpected notification"; | 544 NOTREACHED() << "Received unexpected notification"; |
543 } | 545 } |
544 } | 546 } |
545 | 547 |
546 extensions::ActiveTabPermissionGranter* | 548 extensions::ActiveTabPermissionGranter* |
547 ShellWindow::GetActiveTabPermissionGranter() { | 549 ShellWindow::GetActiveTabPermissionGranter() { |
548 // Shell windows don't support the activeTab permission. | 550 // Shell windows don't support the activeTab permission. |
549 return NULL; | 551 return NULL; |
550 } | 552 } |
551 | 553 |
552 void ShellWindow::SetWebContentsBlocked(content::WebContents* web_contents, | |
553 bool blocked) { | |
554 } | |
555 | |
556 WebContentsModalDialogHost* ShellWindow::GetWebContentsModalDialogHost() { | 554 WebContentsModalDialogHost* ShellWindow::GetWebContentsModalDialogHost() { |
557 return native_app_window_.get(); | 555 return native_app_window_.get(); |
558 } | 556 } |
559 | 557 |
560 void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level, | 558 void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level, |
561 const std::string& message) { | 559 const std::string& message) { |
562 content::RenderViewHost* rvh = web_contents()->GetRenderViewHost(); | 560 content::RenderViewHost* rvh = web_contents()->GetRenderViewHost(); |
563 rvh->Send(new ExtensionMsg_AddMessageToConsole( | 561 rvh->Send(new ExtensionMsg_AddMessageToConsole( |
564 rvh->GetRoutingID(), level, message)); | 562 rvh->GetRoutingID(), level, message)); |
565 } | 563 } |
(...skipping 24 matching lines...) Expand all Loading... |
590 const extensions::DraggableRegion& region = *iter; | 588 const extensions::DraggableRegion& region = *iter; |
591 sk_region->op( | 589 sk_region->op( |
592 region.bounds.x(), | 590 region.bounds.x(), |
593 region.bounds.y(), | 591 region.bounds.y(), |
594 region.bounds.right(), | 592 region.bounds.right(), |
595 region.bounds.bottom(), | 593 region.bounds.bottom(), |
596 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 594 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
597 } | 595 } |
598 return sk_region; | 596 return sk_region; |
599 } | 597 } |
OLD | NEW |