| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/common/extensions/api/webstore/webstore_api_constants.h" | 33 #include "chrome/common/extensions/api/webstore/webstore_api_constants.h" |
| 34 #include "chrome/common/extensions/chrome_extension_messages.h" | 34 #include "chrome/common/extensions/chrome_extension_messages.h" |
| 35 #include "chrome/common/extensions/extension_constants.h" | 35 #include "chrome/common/extensions/extension_constants.h" |
| 36 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 36 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| 37 #include "chrome/common/render_messages.h" | 37 #include "chrome/common/render_messages.h" |
| 38 #include "chrome/common/url_constants.h" | 38 #include "chrome/common/url_constants.h" |
| 39 #include "content/public/browser/invalidate_type.h" | 39 #include "content/public/browser/invalidate_type.h" |
| 40 #include "content/public/browser/navigation_controller.h" | 40 #include "content/public/browser/navigation_controller.h" |
| 41 #include "content/public/browser/navigation_details.h" | 41 #include "content/public/browser/navigation_details.h" |
| 42 #include "content/public/browser/navigation_entry.h" | 42 #include "content/public/browser/navigation_entry.h" |
| 43 #include "content/public/browser/navigation_handle.h" |
| 43 #include "content/public/browser/notification_service.h" | 44 #include "content/public/browser/notification_service.h" |
| 44 #include "content/public/browser/notification_source.h" | 45 #include "content/public/browser/notification_source.h" |
| 45 #include "content/public/browser/notification_types.h" | 46 #include "content/public/browser/notification_types.h" |
| 46 #include "content/public/browser/render_frame_host.h" | 47 #include "content/public/browser/render_frame_host.h" |
| 47 #include "content/public/browser/render_process_host.h" | 48 #include "content/public/browser/render_process_host.h" |
| 48 #include "content/public/browser/render_view_host.h" | 49 #include "content/public/browser/render_view_host.h" |
| 49 #include "content/public/browser/web_contents.h" | 50 #include "content/public/browser/web_contents.h" |
| 51 #include "content/public/common/browser_side_navigation_policy.h" |
| 50 #include "content/public/common/frame_navigate_params.h" | 52 #include "content/public/common/frame_navigate_params.h" |
| 51 #include "extensions/browser/api/declarative/rules_registry_service.h" | 53 #include "extensions/browser/api/declarative/rules_registry_service.h" |
| 52 #include "extensions/browser/extension_prefs.h" | 54 #include "extensions/browser/extension_prefs.h" |
| 53 #include "extensions/browser/extension_registry.h" | 55 #include "extensions/browser/extension_registry.h" |
| 54 #include "extensions/browser/extension_system.h" | 56 #include "extensions/browser/extension_system.h" |
| 55 #include "extensions/browser/extension_web_contents_observer.h" | 57 #include "extensions/browser/extension_web_contents_observer.h" |
| 56 #include "extensions/browser/image_loader.h" | 58 #include "extensions/browser/image_loader.h" |
| 57 #include "extensions/common/constants.h" | 59 #include "extensions/common/constants.h" |
| 58 #include "extensions/common/extension.h" | 60 #include "extensions/common/extension.h" |
| 59 #include "extensions/common/extension_icon_set.h" | 61 #include "extensions/common/extension_icon_set.h" |
| 60 #include "extensions/common/extension_messages.h" | 62 #include "extensions/common/extension_messages.h" |
| 61 #include "extensions/common/extension_resource.h" | 63 #include "extensions/common/extension_resource.h" |
| 62 #include "extensions/common/extension_urls.h" | 64 #include "extensions/common/extension_urls.h" |
| 63 #include "extensions/common/feature_switch.h" | 65 #include "extensions/common/feature_switch.h" |
| 64 #include "extensions/common/manifest_handlers/icons_handler.h" | 66 #include "extensions/common/manifest_handlers/icons_handler.h" |
| 67 #include "net/http/http_response_headers.h" |
| 65 #include "url/url_constants.h" | 68 #include "url/url_constants.h" |
| 66 | 69 |
| 67 #if defined(OS_WIN) | 70 #if defined(OS_WIN) |
| 68 #include "chrome/browser/web_applications/web_app_win.h" | 71 #include "chrome/browser/web_applications/web_app_win.h" |
| 69 #endif | 72 #endif |
| 70 | 73 |
| 71 using content::NavigationController; | 74 using content::NavigationController; |
| 72 using content::NavigationEntry; | 75 using content::NavigationEntry; |
| 73 using content::WebContents; | 76 using content::WebContents; |
| 74 | 77 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 void TabHelper::FinishCreateBookmarkApp( | 308 void TabHelper::FinishCreateBookmarkApp( |
| 306 const Extension* extension, | 309 const Extension* extension, |
| 307 const WebApplicationInfo& web_app_info) { | 310 const WebApplicationInfo& web_app_info) { |
| 308 pending_web_app_action_ = NONE; | 311 pending_web_app_action_ = NONE; |
| 309 } | 312 } |
| 310 | 313 |
| 311 void TabHelper::RenderFrameCreated(content::RenderFrameHost* host) { | 314 void TabHelper::RenderFrameCreated(content::RenderFrameHost* host) { |
| 312 SetTabId(host); | 315 SetTabId(host); |
| 313 } | 316 } |
| 314 | 317 |
| 318 void TabHelper::DidFinishNavigation( |
| 319 content::NavigationHandle* navigation_handle) { |
| 320 if (content::IsBrowserSideNavigationEnabled() && |
| 321 navigation_handle->GetResponseHeaders() && |
| 322 (navigation_handle->GetResponseHeaders()->response_code() == 204 || |
| 323 navigation_handle->GetResponseHeaders()->response_code() == 205)) { |
| 324 content::RenderFrameHost* rfh = navigation_handle->GetRenderFrameHost(); |
| 325 rfh->Send(new ExtensionMsg_Set204Or205Error(rfh->GetRoutingID())); |
| 326 } |
| 327 } |
| 328 |
| 315 void TabHelper::DidNavigateMainFrame( | 329 void TabHelper::DidNavigateMainFrame( |
| 316 const content::LoadCommittedDetails& details, | 330 const content::LoadCommittedDetails& details, |
| 317 const content::FrameNavigateParams& params) { | 331 const content::FrameNavigateParams& params) { |
| 318 InvokeForContentRulesRegistries( | 332 InvokeForContentRulesRegistries( |
| 319 [this, &details, ¶ms](ContentRulesRegistry* registry) { | 333 [this, &details, ¶ms](ContentRulesRegistry* registry) { |
| 320 registry->DidNavigateMainFrame(web_contents(), details, params); | 334 registry->DidNavigateMainFrame(web_contents(), details, params); |
| 321 }); | 335 }); |
| 322 | 336 |
| 323 content::BrowserContext* context = web_contents()->GetBrowserContext(); | 337 content::BrowserContext* context = web_contents()->GetBrowserContext(); |
| 324 ExtensionRegistry* registry = ExtensionRegistry::Get(context); | 338 ExtensionRegistry* registry = ExtensionRegistry::Get(context); |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 } | 689 } |
| 676 } | 690 } |
| 677 | 691 |
| 678 void TabHelper::SetTabId(content::RenderFrameHost* render_frame_host) { | 692 void TabHelper::SetTabId(content::RenderFrameHost* render_frame_host) { |
| 679 render_frame_host->Send( | 693 render_frame_host->Send( |
| 680 new ExtensionMsg_SetTabId(render_frame_host->GetRoutingID(), | 694 new ExtensionMsg_SetTabId(render_frame_host->GetRoutingID(), |
| 681 SessionTabHelper::IdForTab(web_contents()))); | 695 SessionTabHelper::IdForTab(web_contents()))); |
| 682 } | 696 } |
| 683 | 697 |
| 684 } // namespace extensions | 698 } // namespace extensions |
| OLD | NEW |