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

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

Issue 496403003: Remove NOTIFICATION_EXTENSION_PAGE_ACTIONS_UPDATED (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest master for CQ Created 6 years, 3 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/page_action_controller.h" 5 #include "chrome/browser/extensions/page_action_controller.h"
6 6
7 #include <set>
8
9 #include "base/lazy_instance.h"
10 #include "base/metrics/histogram.h"
11 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
12 #include "chrome/browser/extensions/extension_action.h"
13 #include "chrome/browser/extensions/extension_action_manager.h" 7 #include "chrome/browser/extensions/extension_action_manager.h"
14 #include "chrome/browser/extensions/tab_helper.h"
15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/sessions/session_tab_helper.h"
17 #include "content/public/browser/navigation_details.h"
18 #include "content/public/browser/web_contents.h" 8 #include "content/public/browser/web_contents.h"
19 #include "extensions/browser/extension_registry.h"
20 #include "extensions/common/extension_set.h"
21 9
22 namespace extensions { 10 namespace extensions {
23 11
24 // Keeps track of the profiles for which we've sent UMA statistics.
25 base::LazyInstance<std::set<Profile*> > g_reported_for_profiles =
26 LAZY_INSTANCE_INITIALIZER;
27
28 PageActionController::PageActionController(content::WebContents* web_contents) 12 PageActionController::PageActionController(content::WebContents* web_contents)
29 : web_contents_(web_contents), 13 : web_contents_(web_contents),
30 extension_action_observer_(this) { 14 browser_context_(web_contents_->GetBrowserContext()) {
31 extension_action_observer_.Add(
32 ExtensionActionAPI::Get(web_contents_->GetBrowserContext()));
33 } 15 }
34 16
35 PageActionController::~PageActionController() { 17 PageActionController::~PageActionController() {
36 } 18 }
37 19
38 ExtensionAction* PageActionController::GetActionForExtension( 20 ExtensionAction* PageActionController::GetActionForExtension(
39 const Extension* extension) { 21 const Extension* extension) {
40 return ExtensionActionManager::Get(GetProfile())->GetPageAction(*extension); 22 return ExtensionActionManager::Get(browser_context_)->GetPageAction(
23 *extension);
41 } 24 }
42 25
43 void PageActionController::OnNavigated() { 26 void PageActionController::OnNavigated() {
44 // Clearing extension action values is handled in TabHelper, so nothing to 27 // Clearing extension action values is handled in TabHelper, so nothing to
45 // do here. 28 // do here.
46 } 29 }
47 30
48 void PageActionController::OnExtensionActionUpdated(
49 ExtensionAction* extension_action,
50 content::WebContents* web_contents,
51 content::BrowserContext* browser_context) {
52 if (web_contents == web_contents_ &&
53 extension_action->action_type() == ActionInfo::TYPE_PAGE)
54 LocationBarController::NotifyChange(web_contents_);
55 }
56
57 Profile* PageActionController::GetProfile() {
58 return Profile::FromBrowserContext(web_contents_->GetBrowserContext());
59 }
60
61 } // namespace extensions 31 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/page_action_controller.h ('k') | chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698