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

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

Issue 475813004: Clean up NOTIFICATION_EXTENSION_PAGE_ACTION_[ COUNT | VISIBILITY ]_CHANGED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac Compile Fix Created 6 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/location_bar_controller.h" 5 #include "chrome/browser/extensions/location_bar_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/extensions/active_script_controller.h" 8 #include "chrome/browser/extensions/active_script_controller.h"
9 #include "chrome/browser/extensions/page_action_controller.h" 9 #include "chrome/browser/extensions/page_action_controller.h"
10 #include "chrome/browser/ui/browser_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
11 #include "chrome/browser/ui/browser_window.h" 11 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/location_bar/location_bar.h" 12 #include "chrome/browser/ui/location_bar/location_bar.h"
13 #include "chrome/common/extensions/api/extension_action/action_info.h" 13 #include "chrome/common/extensions/api/extension_action/action_info.h"
14 #include "content/public/browser/invalidate_type.h" 14 #include "content/public/browser/invalidate_type.h"
15 #include "content/public/browser/navigation_details.h" 15 #include "content/public/browser/navigation_details.h"
16 #include "content/public/browser/notification_service.h"
17 #include "content/public/browser/notification_source.h"
16 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
17 #include "extensions/browser/extension_registry.h" 19 #include "extensions/browser/extension_registry.h"
20 #include "extensions/browser/notification_types.h"
18 21
19 namespace extensions { 22 namespace extensions {
20 23
21 LocationBarController::LocationBarController( 24 LocationBarController::LocationBarController(
22 content::WebContents* web_contents) 25 content::WebContents* web_contents)
23 : WebContentsObserver(web_contents), 26 : WebContentsObserver(web_contents),
24 web_contents_(web_contents), 27 web_contents_(web_contents),
25 active_script_controller_(new ActiveScriptController(web_contents_)), 28 active_script_controller_(new ActiveScriptController(web_contents_)),
26 page_action_controller_(new PageActionController(web_contents_)), 29 page_action_controller_(new PageActionController(web_contents_)),
27 extension_registry_observer_(this) { 30 extension_registry_observer_(this) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // static 81 // static
79 void LocationBarController::NotifyChange(content::WebContents* web_contents) { 82 void LocationBarController::NotifyChange(content::WebContents* web_contents) {
80 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); 83 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
81 if (!browser) 84 if (!browser)
82 return; 85 return;
83 LocationBar* location_bar = 86 LocationBar* location_bar =
84 browser->window() ? browser->window()->GetLocationBar() : NULL; 87 browser->window() ? browser->window()->GetLocationBar() : NULL;
85 if (!location_bar) 88 if (!location_bar)
86 return; 89 return;
87 location_bar->UpdatePageActions(); 90 location_bar->UpdatePageActions();
91
92 content::NotificationService::current()->Notify(
93 NOTIFICATION_EXTENSION_PAGE_ACTIONS_UPDATED,
94 content::Source<content::WebContents>(web_contents),
95 content::NotificationService::NoDetails());
Avi (use Gerrit) 2014/08/20 01:06:52 We're trying to kill off notifications. Overall th
Devlin 2014/08/20 03:21:00 TL;DR: That's the eventual goal, but I'd like to p
88 } 96 }
89 97
90 void LocationBarController::DidNavigateMainFrame( 98 void LocationBarController::DidNavigateMainFrame(
91 const content::LoadCommittedDetails& details, 99 const content::LoadCommittedDetails& details,
92 const content::FrameNavigateParams& params) { 100 const content::FrameNavigateParams& params) {
93 if (details.is_in_page) 101 if (details.is_in_page)
94 return; 102 return;
95 103
96 page_action_controller_->OnNavigated(); 104 page_action_controller_->OnNavigated();
97 active_script_controller_->OnNavigated(); 105 active_script_controller_->OnNavigated();
(...skipping 11 matching lines...) Expand all
109 if (active_script_controller_->GetActionForExtension(extension)) { 117 if (active_script_controller_->GetActionForExtension(extension)) {
110 active_script_controller_->OnExtensionUnloaded(extension); 118 active_script_controller_->OnExtensionUnloaded(extension);
111 should_update = true; 119 should_update = true;
112 } 120 }
113 121
114 if (should_update) 122 if (should_update)
115 NotifyChange(web_contents()); 123 NotifyChange(web_contents());
116 } 124 }
117 125
118 } // namespace extensions 126 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698