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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, | 381 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, |
381 content::Source<ExtensionAction>(browser_action), | 382 content::Source<ExtensionAction>(browser_action), |
382 content::NotificationService::NoDetails()); | 383 content::NotificationService::NoDetails()); |
383 } | 384 } |
384 } | 385 } |
385 } | 386 } |
386 | 387 |
387 bool TabHelper::OnMessageReceived(const IPC::Message& message) { | 388 bool TabHelper::OnMessageReceived(const IPC::Message& message) { |
388 bool handled = true; | 389 bool handled = true; |
389 IPC_BEGIN_MESSAGE_MAP(TabHelper, message) | 390 IPC_BEGIN_MESSAGE_MAP(TabHelper, message) |
390 IPC_MESSAGE_HANDLER(ExtensionHostMsg_DidGetApplicationInfo, | 391 IPC_MESSAGE_HANDLER(ChromeExtensionHostMsg_DidGetApplicationInfo, |
391 OnDidGetApplicationInfo) | 392 OnDidGetApplicationInfo) |
392 IPC_MESSAGE_HANDLER(ExtensionHostMsg_InlineWebstoreInstall, | 393 IPC_MESSAGE_HANDLER(ExtensionHostMsg_InlineWebstoreInstall, |
393 OnInlineWebstoreInstall) | 394 OnInlineWebstoreInstall) |
394 IPC_MESSAGE_HANDLER(ExtensionHostMsg_GetAppInstallState, | 395 IPC_MESSAGE_HANDLER(ExtensionHostMsg_GetAppInstallState, |
395 OnGetAppInstallState); | 396 OnGetAppInstallState); |
396 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) | 397 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) |
397 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ContentScriptsExecuting, | 398 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ContentScriptsExecuting, |
398 OnContentScriptsExecuting) | 399 OnContentScriptsExecuting) |
399 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OnWatchedPageChange, | 400 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OnWatchedPageChange, |
400 OnWatchedPageChange) | 401 OnWatchedPageChange) |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 const std::string& error) { | 714 const std::string& error) { |
714 Send(new ExtensionMsg_InlineWebstoreInstallResponse( | 715 Send(new ExtensionMsg_InlineWebstoreInstallResponse( |
715 return_route_id, install_id, success, success ? std::string() : error)); | 716 return_route_id, install_id, success, success ? std::string() : error)); |
716 } | 717 } |
717 | 718 |
718 WebContents* TabHelper::GetAssociatedWebContents() const { | 719 WebContents* TabHelper::GetAssociatedWebContents() const { |
719 return web_contents(); | 720 return web_contents(); |
720 } | 721 } |
721 | 722 |
722 void TabHelper::GetApplicationInfo(int32 page_id) { | 723 void TabHelper::GetApplicationInfo(int32 page_id) { |
723 Send(new ExtensionMsg_GetApplicationInfo(routing_id(), page_id)); | 724 Send(new ChromeExtensionMsg_GetApplicationInfo(routing_id(), page_id)); |
724 } | 725 } |
725 | 726 |
726 void TabHelper::Observe(int type, | 727 void TabHelper::Observe(int type, |
727 const content::NotificationSource& source, | 728 const content::NotificationSource& source, |
728 const content::NotificationDetails& details) { | 729 const content::NotificationDetails& details) { |
729 switch (type) { | 730 switch (type) { |
730 case content::NOTIFICATION_LOAD_STOP: { | 731 case content::NOTIFICATION_LOAD_STOP: { |
731 const NavigationController& controller = | 732 const NavigationController& controller = |
732 *content::Source<NavigationController>(source).ptr(); | 733 *content::Source<NavigationController>(source).ptr(); |
733 DCHECK_EQ(controller.GetWebContents(), web_contents()); | 734 DCHECK_EQ(controller.GetWebContents(), web_contents()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 } | 780 } |
780 } | 781 } |
781 | 782 |
782 void TabHelper::SetTabId(RenderViewHost* render_view_host) { | 783 void TabHelper::SetTabId(RenderViewHost* render_view_host) { |
783 render_view_host->Send( | 784 render_view_host->Send( |
784 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), | 785 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), |
785 SessionID::IdForTab(web_contents()))); | 786 SessionID::IdForTab(web_contents()))); |
786 } | 787 } |
787 | 788 |
788 } // namespace extensions | 789 } // namespace extensions |
OLD | NEW |