Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: chrome/browser/extensions/extension_tab_helper.cc

Issue 10446005: Revert half of the changes from 137638 that are probably causing breakages in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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, this)); 56 action_box_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 }
67 67
68 void ExtensionTabHelper::PageActionStateChanged() { 68 void ExtensionTabHelper::PageActionStateChanged() {
69 // TODO(kalman): replace this with just the Observer interface.
70 web_contents()->NotifyNavigationStateChanged( 69 web_contents()->NotifyNavigationStateChanged(
71 content::INVALIDATE_TYPE_PAGE_ACTIONS); 70 content::INVALIDATE_TYPE_PAGE_ACTIONS);
72
73 FOR_EACH_OBSERVER(Observer, observers_, OnPageActionStateChanged());
74 } 71 }
75 72
76 void ExtensionTabHelper::GetApplicationInfo(int32 page_id) { 73 void ExtensionTabHelper::GetApplicationInfo(int32 page_id) {
77 Send(new ExtensionMsg_GetApplicationInfo(routing_id(), page_id)); 74 Send(new ExtensionMsg_GetApplicationInfo(routing_id(), page_id));
78 } 75 }
79 76
80 void ExtensionTabHelper::AddObserver(ExtensionTabHelper::Observer* observer) {
81 observers_.AddObserver(observer);
82 }
83
84 void ExtensionTabHelper::RemoveObserver(
85 ExtensionTabHelper::Observer* observer) {
86 observers_.RemoveObserver(observer);
87 }
88
89 void ExtensionTabHelper::SetExtensionApp(const Extension* extension) { 77 void ExtensionTabHelper::SetExtensionApp(const Extension* extension) {
90 DCHECK(!extension || extension->GetFullLaunchURL().is_valid()); 78 DCHECK(!extension || extension->GetFullLaunchURL().is_valid());
91 extension_app_ = extension; 79 extension_app_ = extension;
92 80
93 UpdateExtensionAppIcon(extension_app_); 81 UpdateExtensionAppIcon(extension_app_);
94 82
95 content::NotificationService::current()->Notify( 83 content::NotificationService::current()->Notify(
96 chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, 84 chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED,
97 content::Source<ExtensionTabHelper>(this), 85 content::Source<ExtensionTabHelper>(this),
98 content::NotificationService::NoDetails()); 86 content::NotificationService::NoDetails());
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 void ExtensionTabHelper::OnInlineInstallFailure(int install_id, 367 void ExtensionTabHelper::OnInlineInstallFailure(int install_id,
380 int return_route_id, 368 int return_route_id,
381 const std::string& error) { 369 const std::string& error) {
382 Send(new ExtensionMsg_InlineWebstoreInstallResponse( 370 Send(new ExtensionMsg_InlineWebstoreInstallResponse(
383 return_route_id, install_id, false, error)); 371 return_route_id, install_id, false, error));
384 } 372 }
385 373
386 WebContents* ExtensionTabHelper::GetAssociatedWebContents() const { 374 WebContents* ExtensionTabHelper::GetAssociatedWebContents() const {
387 return web_contents(); 375 return web_contents();
388 } 376 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tab_helper.h ('k') | chrome/browser/extensions/page_action_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698