| 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/extension_tab_helper.h" | 5 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
| 8 #include "chrome/browser/extensions/page_action_controller.h" | 8 #include "chrome/browser/extensions/page_action_controller.h" |
| 9 #include "chrome/browser/extensions/script_badge_controller.h" | 9 #include "chrome/browser/extensions/script_badge_controller.h" |
| 10 #include "chrome/browser/extensions/script_executor_impl.h" | 10 #include "chrome/browser/extensions/script_executor_impl.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 : content::WebContentsObserver(wrapper->web_contents()), | 46 : content::WebContentsObserver(wrapper->web_contents()), |
| 47 delegate_(NULL), | 47 delegate_(NULL), |
| 48 extension_app_(NULL), | 48 extension_app_(NULL), |
| 49 ALLOW_THIS_IN_INITIALIZER_LIST( | 49 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 50 extension_function_dispatcher_(wrapper->profile(), this)), | 50 extension_function_dispatcher_(wrapper->profile(), this)), |
| 51 wrapper_(wrapper) { | 51 wrapper_(wrapper) { |
| 52 if (extensions::switch_utils::IsActionBoxEnabled()) { | 52 if (extensions::switch_utils::IsActionBoxEnabled()) { |
| 53 script_badge_controller_.reset(new ScriptBadgeController(wrapper)); | 53 script_badge_controller_.reset(new ScriptBadgeController(wrapper)); |
| 54 } else { | 54 } else { |
| 55 script_executor_.reset(new ScriptExecutorImpl(wrapper->web_contents())); | 55 script_executor_.reset(new ScriptExecutorImpl(wrapper->web_contents())); |
| 56 action_box_controller_.reset(new PageActionController(wrapper)); | 56 location_bar_controller_.reset(new PageActionController(wrapper)); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 ExtensionTabHelper::~ExtensionTabHelper() { | 60 ExtensionTabHelper::~ExtensionTabHelper() { |
| 61 } | 61 } |
| 62 | 62 |
| 63 void ExtensionTabHelper::CopyStateFrom(const ExtensionTabHelper& source) { | 63 void ExtensionTabHelper::CopyStateFrom(const ExtensionTabHelper& source) { |
| 64 SetExtensionApp(source.extension_app()); | 64 SetExtensionApp(source.extension_app()); |
| 65 extension_app_icon_ = source.extension_app_icon_; | 65 extension_app_icon_ = source.extension_app_icon_; |
| 66 } | 66 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 return &extension_app_icon_; | 107 return &extension_app_icon_; |
| 108 } | 108 } |
| 109 | 109 |
| 110 extensions::ScriptExecutor* ExtensionTabHelper::script_executor() { | 110 extensions::ScriptExecutor* ExtensionTabHelper::script_executor() { |
| 111 if (script_badge_controller_.get()) | 111 if (script_badge_controller_.get()) |
| 112 return script_badge_controller_.get(); | 112 return script_badge_controller_.get(); |
| 113 return script_executor_.get(); | 113 return script_executor_.get(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 extensions::ActionBoxController* ExtensionTabHelper::action_box_controller() { | 116 extensions::LocationBarController* |
| 117 ExtensionTabHelper::location_bar_controller() { |
| 117 if (script_badge_controller_.get()) | 118 if (script_badge_controller_.get()) |
| 118 return script_badge_controller_.get(); | 119 return script_badge_controller_.get(); |
| 119 return action_box_controller_.get(); | 120 return location_bar_controller_.get(); |
| 120 } | 121 } |
| 121 | 122 |
| 122 void ExtensionTabHelper::DidNavigateMainFrame( | 123 void ExtensionTabHelper::DidNavigateMainFrame( |
| 123 const content::LoadCommittedDetails& details, | 124 const content::LoadCommittedDetails& details, |
| 124 const content::FrameNavigateParams& params) { | 125 const content::FrameNavigateParams& params) { |
| 125 if (details.is_in_page) | 126 if (details.is_in_page) |
| 126 return; | 127 return; |
| 127 | 128 |
| 128 Profile* profile = | 129 Profile* profile = |
| 129 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 130 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 void ExtensionTabHelper::OnInlineInstallFailure(int install_id, | 368 void ExtensionTabHelper::OnInlineInstallFailure(int install_id, |
| 368 int return_route_id, | 369 int return_route_id, |
| 369 const std::string& error) { | 370 const std::string& error) { |
| 370 Send(new ExtensionMsg_InlineWebstoreInstallResponse( | 371 Send(new ExtensionMsg_InlineWebstoreInstallResponse( |
| 371 return_route_id, install_id, false, error)); | 372 return_route_id, install_id, false, error)); |
| 372 } | 373 } |
| 373 | 374 |
| 374 WebContents* ExtensionTabHelper::GetAssociatedWebContents() const { | 375 WebContents* ExtensionTabHelper::GetAssociatedWebContents() const { |
| 375 return web_contents(); | 376 return web_contents(); |
| 376 } | 377 } |
| OLD | NEW |