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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 NOTREACHED() << "Received unexpected notification"; | 543 NOTREACHED() << "Received unexpected notification"; |
542 } | 544 } |
543 } | 545 } |
544 | 546 |
545 extensions::ActiveTabPermissionGranter* | 547 extensions::ActiveTabPermissionGranter* |
546 ShellWindow::GetActiveTabPermissionGranter() { | 548 ShellWindow::GetActiveTabPermissionGranter() { |
547 // Shell windows don't support the activeTab permission. | 549 // Shell windows don't support the activeTab permission. |
548 return NULL; | 550 return NULL; |
549 } | 551 } |
550 | 552 |
551 void ShellWindow::SetWebContentsBlocked(content::WebContents* web_contents, | |
552 bool blocked) { | |
553 } | |
554 | |
555 WebContentsModalDialogHost* ShellWindow::GetWebContentsModalDialogHost() { | 553 WebContentsModalDialogHost* ShellWindow::GetWebContentsModalDialogHost() { |
556 return native_app_window_.get(); | 554 return native_app_window_.get(); |
557 } | 555 } |
558 | 556 |
559 void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level, | 557 void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level, |
560 const std::string& message) { | 558 const std::string& message) { |
561 content::RenderViewHost* rvh = web_contents()->GetRenderViewHost(); | 559 content::RenderViewHost* rvh = web_contents()->GetRenderViewHost(); |
562 rvh->Send(new ExtensionMsg_AddMessageToConsole( | 560 rvh->Send(new ExtensionMsg_AddMessageToConsole( |
563 rvh->GetRoutingID(), level, message)); | 561 rvh->GetRoutingID(), level, message)); |
564 } | 562 } |
(...skipping 24 matching lines...) Expand all Loading... |
589 const extensions::DraggableRegion& region = *iter; | 587 const extensions::DraggableRegion& region = *iter; |
590 sk_region->op( | 588 sk_region->op( |
591 region.bounds.x(), | 589 region.bounds.x(), |
592 region.bounds.y(), | 590 region.bounds.y(), |
593 region.bounds.right(), | 591 region.bounds.right(), |
594 region.bounds.bottom(), | 592 region.bounds.bottom(), |
595 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 593 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
596 } | 594 } |
597 return sk_region; | 595 return sk_region; |
598 } | 596 } |
OLD | NEW |