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/extensions/tab_helper.h" | 5 #include "chrome/browser/extensions/tab_helper.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/sessions/session_tab_helper.h" | 29 #include "chrome/browser/sessions/session_tab_helper.h" |
30 #include "chrome/browser/shell_integration.h" | 30 #include "chrome/browser/shell_integration.h" |
31 #include "chrome/browser/ui/browser_commands.h" | 31 #include "chrome/browser/ui/browser_commands.h" |
32 #include "chrome/browser/ui/browser_dialogs.h" | 32 #include "chrome/browser/ui/browser_dialogs.h" |
33 #include "chrome/browser/ui/browser_finder.h" | 33 #include "chrome/browser/ui/browser_finder.h" |
34 #include "chrome/browser/ui/browser_window.h" | 34 #include "chrome/browser/ui/browser_window.h" |
35 #include "chrome/browser/ui/host_desktop.h" | 35 #include "chrome/browser/ui/host_desktop.h" |
36 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 36 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
37 #include "chrome/browser/web_applications/web_app.h" | 37 #include "chrome/browser/web_applications/web_app.h" |
38 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
| 39 #include "chrome/common/extensions/chrome_extension_messages.h" |
39 #include "chrome/common/extensions/extension_constants.h" | 40 #include "chrome/common/extensions/extension_constants.h" |
40 #include "chrome/common/extensions/extension_icon_set.h" | 41 #include "chrome/common/extensions/extension_icon_set.h" |
41 #include "chrome/common/extensions/extension_messages.h" | |
42 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 42 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
43 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 43 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
44 #include "chrome/common/render_messages.h" | 44 #include "chrome/common/render_messages.h" |
45 #include "chrome/common/url_constants.h" | 45 #include "chrome/common/url_constants.h" |
46 #include "content/public/browser/invalidate_type.h" | 46 #include "content/public/browser/invalidate_type.h" |
47 #include "content/public/browser/navigation_controller.h" | 47 #include "content/public/browser/navigation_controller.h" |
48 #include "content/public/browser/navigation_details.h" | 48 #include "content/public/browser/navigation_details.h" |
49 #include "content/public/browser/navigation_entry.h" | 49 #include "content/public/browser/navigation_entry.h" |
50 #include "content/public/browser/notification_service.h" | 50 #include "content/public/browser/notification_service.h" |
51 #include "content/public/browser/notification_source.h" | 51 #include "content/public/browser/notification_source.h" |
52 #include "content/public/browser/notification_types.h" | 52 #include "content/public/browser/notification_types.h" |
53 #include "content/public/browser/render_process_host.h" | 53 #include "content/public/browser/render_process_host.h" |
54 #include "content/public/browser/render_view_host.h" | 54 #include "content/public/browser/render_view_host.h" |
55 #include "content/public/browser/render_widget_host_view.h" | 55 #include "content/public/browser/render_widget_host_view.h" |
56 #include "content/public/browser/web_contents.h" | 56 #include "content/public/browser/web_contents.h" |
57 #include "content/public/browser/web_contents_view.h" | 57 #include "content/public/browser/web_contents_view.h" |
58 #include "content/public/common/frame_navigate_params.h" | 58 #include "content/public/common/frame_navigate_params.h" |
59 #include "extensions/browser/extension_error.h" | 59 #include "extensions/browser/extension_error.h" |
60 #include "extensions/browser/extension_registry.h" | 60 #include "extensions/browser/extension_registry.h" |
61 #include "extensions/browser/extension_system.h" | 61 #include "extensions/browser/extension_system.h" |
62 #include "extensions/common/extension.h" | 62 #include "extensions/common/extension.h" |
| 63 #include "extensions/common/extension_messages.h" |
63 #include "extensions/common/extension_resource.h" | 64 #include "extensions/common/extension_resource.h" |
64 #include "extensions/common/extension_urls.h" | 65 #include "extensions/common/extension_urls.h" |
65 #include "extensions/common/feature_switch.h" | 66 #include "extensions/common/feature_switch.h" |
66 #include "skia/ext/image_operations.h" | 67 #include "skia/ext/image_operations.h" |
67 #include "skia/ext/platform_canvas.h" | 68 #include "skia/ext/platform_canvas.h" |
68 #include "ui/gfx/color_analysis.h" | 69 #include "ui/gfx/color_analysis.h" |
69 #include "ui/gfx/image/image.h" | 70 #include "ui/gfx/image/image.h" |
70 | 71 |
71 #if defined(OS_CHROMEOS) | 72 #if defined(OS_CHROMEOS) |
72 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 73 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, | 380 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, |
380 content::Source<ExtensionAction>(browser_action), | 381 content::Source<ExtensionAction>(browser_action), |
381 content::NotificationService::NoDetails()); | 382 content::NotificationService::NoDetails()); |
382 } | 383 } |
383 } | 384 } |
384 } | 385 } |
385 | 386 |
386 bool TabHelper::OnMessageReceived(const IPC::Message& message) { | 387 bool TabHelper::OnMessageReceived(const IPC::Message& message) { |
387 bool handled = true; | 388 bool handled = true; |
388 IPC_BEGIN_MESSAGE_MAP(TabHelper, message) | 389 IPC_BEGIN_MESSAGE_MAP(TabHelper, message) |
389 IPC_MESSAGE_HANDLER(ExtensionHostMsg_DidGetApplicationInfo, | 390 IPC_MESSAGE_HANDLER(ChromeExtensionHostMsg_DidGetApplicationInfo, |
390 OnDidGetApplicationInfo) | 391 OnDidGetApplicationInfo) |
391 IPC_MESSAGE_HANDLER(ExtensionHostMsg_InlineWebstoreInstall, | 392 IPC_MESSAGE_HANDLER(ExtensionHostMsg_InlineWebstoreInstall, |
392 OnInlineWebstoreInstall) | 393 OnInlineWebstoreInstall) |
393 IPC_MESSAGE_HANDLER(ExtensionHostMsg_GetAppInstallState, | 394 IPC_MESSAGE_HANDLER(ExtensionHostMsg_GetAppInstallState, |
394 OnGetAppInstallState); | 395 OnGetAppInstallState); |
395 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) | 396 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) |
396 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ContentScriptsExecuting, | 397 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ContentScriptsExecuting, |
397 OnContentScriptsExecuting) | 398 OnContentScriptsExecuting) |
398 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OnWatchedPageChange, | 399 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OnWatchedPageChange, |
399 OnWatchedPageChange) | 400 OnWatchedPageChange) |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 const std::string& error) { | 713 const std::string& error) { |
713 Send(new ExtensionMsg_InlineWebstoreInstallResponse( | 714 Send(new ExtensionMsg_InlineWebstoreInstallResponse( |
714 return_route_id, install_id, success, success ? std::string() : error)); | 715 return_route_id, install_id, success, success ? std::string() : error)); |
715 } | 716 } |
716 | 717 |
717 WebContents* TabHelper::GetAssociatedWebContents() const { | 718 WebContents* TabHelper::GetAssociatedWebContents() const { |
718 return web_contents(); | 719 return web_contents(); |
719 } | 720 } |
720 | 721 |
721 void TabHelper::GetApplicationInfo(int32 page_id) { | 722 void TabHelper::GetApplicationInfo(int32 page_id) { |
722 Send(new ExtensionMsg_GetApplicationInfo(routing_id(), page_id)); | 723 Send(new ChromeExtensionMsg_GetApplicationInfo(routing_id(), page_id)); |
723 } | 724 } |
724 | 725 |
725 void TabHelper::Observe(int type, | 726 void TabHelper::Observe(int type, |
726 const content::NotificationSource& source, | 727 const content::NotificationSource& source, |
727 const content::NotificationDetails& details) { | 728 const content::NotificationDetails& details) { |
728 switch (type) { | 729 switch (type) { |
729 case content::NOTIFICATION_LOAD_STOP: { | 730 case content::NOTIFICATION_LOAD_STOP: { |
730 const NavigationController& controller = | 731 const NavigationController& controller = |
731 *content::Source<NavigationController>(source).ptr(); | 732 *content::Source<NavigationController>(source).ptr(); |
732 DCHECK_EQ(controller.GetWebContents(), web_contents()); | 733 DCHECK_EQ(controller.GetWebContents(), web_contents()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 } | 779 } |
779 } | 780 } |
780 | 781 |
781 void TabHelper::SetTabId(RenderViewHost* render_view_host) { | 782 void TabHelper::SetTabId(RenderViewHost* render_view_host) { |
782 render_view_host->Send( | 783 render_view_host->Send( |
783 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), | 784 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), |
784 SessionID::IdForTab(web_contents()))); | 785 SessionID::IdForTab(web_contents()))); |
785 } | 786 } |
786 | 787 |
787 } // namespace extensions | 788 } // namespace extensions |
OLD | NEW |