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

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

Issue 10388160: Only return the visible page actions from PageActionController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/webstore_inline_installer.h" 8 #include "chrome/browser/extensions/webstore_inline_installer.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sessions/restore_tab_helper.h" 10 #include "chrome/browser/sessions/restore_tab_helper.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 ExtensionTabHelper::~ExtensionTabHelper() { 46 ExtensionTabHelper::~ExtensionTabHelper() {
47 } 47 }
48 48
49 void ExtensionTabHelper::CopyStateFrom(const ExtensionTabHelper& source) { 49 void ExtensionTabHelper::CopyStateFrom(const ExtensionTabHelper& source) {
50 SetExtensionApp(source.extension_app()); 50 SetExtensionApp(source.extension_app());
51 extension_app_icon_ = source.extension_app_icon_; 51 extension_app_icon_ = source.extension_app_icon_;
52 } 52 }
53 53
54 void ExtensionTabHelper::PageActionStateChanged() { 54 void ExtensionTabHelper::PageActionStateChanged() {
55 // TODO(kalman): replace this with just the Observer interface.
55 web_contents()->NotifyNavigationStateChanged( 56 web_contents()->NotifyNavigationStateChanged(
56 content::INVALIDATE_TYPE_PAGE_ACTIONS); 57 content::INVALIDATE_TYPE_PAGE_ACTIONS);
58
59 FOR_EACH_OBSERVER(Observer, observers_, OnPageActionStateChanged());
57 } 60 }
58 61
59 void ExtensionTabHelper::GetApplicationInfo(int32 page_id) { 62 void ExtensionTabHelper::GetApplicationInfo(int32 page_id) {
60 Send(new ExtensionMsg_GetApplicationInfo(routing_id(), page_id)); 63 Send(new ExtensionMsg_GetApplicationInfo(routing_id(), page_id));
61 } 64 }
62 65
66 void ExtensionTabHelper::AddObserver(ExtensionTabHelper::Observer* observer) {
67 observers_.AddObserver(observer);
68 }
69
70 void ExtensionTabHelper::RemoveObserver(
71 ExtensionTabHelper::Observer* observer) {
72 observers_.RemoveObserver(observer);
73 }
74
63 void ExtensionTabHelper::SetExtensionApp(const Extension* extension) { 75 void ExtensionTabHelper::SetExtensionApp(const Extension* extension) {
64 DCHECK(!extension || extension->GetFullLaunchURL().is_valid()); 76 DCHECK(!extension || extension->GetFullLaunchURL().is_valid());
65 extension_app_ = extension; 77 extension_app_ = extension;
66 78
67 UpdateExtensionAppIcon(extension_app_); 79 UpdateExtensionAppIcon(extension_app_);
68 80
69 content::NotificationService::current()->Notify( 81 content::NotificationService::current()->Notify(
70 chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, 82 chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED,
71 content::Source<ExtensionTabHelper>(this), 83 content::Source<ExtensionTabHelper>(this),
72 content::NotificationService::NoDetails()); 84 content::NotificationService::NoDetails());
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 void ExtensionTabHelper::OnInlineInstallFailure(int install_id, 353 void ExtensionTabHelper::OnInlineInstallFailure(int install_id,
342 int return_route_id, 354 int return_route_id,
343 const std::string& error) { 355 const std::string& error) {
344 Send(new ExtensionMsg_InlineWebstoreInstallResponse( 356 Send(new ExtensionMsg_InlineWebstoreInstallResponse(
345 return_route_id, install_id, false, error)); 357 return_route_id, install_id, false, error));
346 } 358 }
347 359
348 WebContents* ExtensionTabHelper::GetAssociatedWebContents() const { 360 WebContents* ExtensionTabHelper::GetAssociatedWebContents() const {
349 return web_contents(); 361 return web_contents();
350 } 362 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698