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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 10446034: Rename ActionBoxController -> LocationBarController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blah 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/ui/views/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/app/chrome_command_ids.h" 13 #include "chrome/app/chrome_command_ids.h"
14 #include "chrome/browser/alternate_nav_url_fetcher.h" 14 #include "chrome/browser/alternate_nav_url_fetcher.h"
15 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" 15 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
16 #include "chrome/browser/chrome_to_mobile_service.h" 16 #include "chrome/browser/chrome_to_mobile_service.h"
17 #include "chrome/browser/chrome_to_mobile_service_factory.h" 17 #include "chrome/browser/chrome_to_mobile_service_factory.h"
18 #include "chrome/browser/defaults.h" 18 #include "chrome/browser/defaults.h"
19 #include "chrome/browser/extensions/action_box_controller.h"
20 #include "chrome/browser/extensions/extension_browser_event_router.h" 19 #include "chrome/browser/extensions/extension_browser_event_router.h"
21 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
22 #include "chrome/browser/extensions/extension_tab_helper.h" 21 #include "chrome/browser/extensions/extension_tab_helper.h"
22 #include "chrome/browser/extensions/location_bar_controller.h"
23 #include "chrome/browser/favicon/favicon_tab_helper.h" 23 #include "chrome/browser/favicon/favicon_tab_helper.h"
24 #include "chrome/browser/instant/instant_controller.h" 24 #include "chrome/browser/instant/instant_controller.h"
25 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/search_engines/template_url.h" 26 #include "chrome/browser/search_engines/template_url.h"
27 #include "chrome/browser/search_engines/template_url_service.h" 27 #include "chrome/browser/search_engines/template_url_service.h"
28 #include "chrome/browser/search_engines/template_url_service_factory.h" 28 #include "chrome/browser/search_engines/template_url_service_factory.h"
29 #include "chrome/browser/ui/browser.h" 29 #include "chrome/browser/ui/browser.h"
30 #include "chrome/browser/ui/browser_finder.h" 30 #include "chrome/browser/ui/browser_finder.h"
31 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 31 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
32 #include "chrome/browser/ui/view_ids.h" 32 #include "chrome/browser/ui/view_ids.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 chrome_to_mobile_view_ = new ChromeToMobileView(this, command_updater_); 251 chrome_to_mobile_view_ = new ChromeToMobileView(this, command_updater_);
252 AddChildView(chrome_to_mobile_view_); 252 AddChildView(chrome_to_mobile_view_);
253 ChromeToMobileService* service = 253 ChromeToMobileService* service =
254 ChromeToMobileServiceFactory::GetForProfile(profile_); 254 ChromeToMobileServiceFactory::GetForProfile(profile_);
255 service->RequestMobileListUpdate(); 255 service->RequestMobileListUpdate();
256 chrome_to_mobile_view_->SetVisible(service->HasDevices()); 256 chrome_to_mobile_view_->SetVisible(service->HasDevices());
257 } 257 }
258 } 258 }
259 259
260 registrar_.Add(this, 260 registrar_.Add(this,
261 chrome::NOTIFICATION_EXTENSION_ACTION_BOX_UPDATED, 261 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED,
262 content::Source<Profile>(profile_)); 262 content::Source<Profile>(profile_));
263 263
264 // Initialize the location entry. We do this to avoid a black flash which is 264 // Initialize the location entry. We do this to avoid a black flash which is
265 // visible when the location entry has just been initialized. 265 // visible when the location entry has just been initialized.
266 Update(NULL); 266 Update(NULL);
267 267
268 OnChanged(); 268 OnChanged();
269 } 269 }
270 270
271 bool LocationBarView::IsInitialized() const { 271 bool LocationBarView::IsInitialized() const {
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 std::map<ExtensionAction*, bool> old_visibility; 1008 std::map<ExtensionAction*, bool> old_visibility;
1009 for (PageActionViews::const_iterator i(page_action_views_.begin()); 1009 for (PageActionViews::const_iterator i(page_action_views_.begin());
1010 i != page_action_views_.end(); ++i) { 1010 i != page_action_views_.end(); ++i) {
1011 old_visibility[(*i)->image_view()->page_action()] = (*i)->visible(); 1011 old_visibility[(*i)->image_view()->page_action()] = (*i)->visible();
1012 } 1012 }
1013 1013
1014 std::vector<ExtensionAction*> page_actions; 1014 std::vector<ExtensionAction*> page_actions;
1015 1015
1016 TabContentsWrapper* tab_contents = GetTabContentsWrapper(); 1016 TabContentsWrapper* tab_contents = GetTabContentsWrapper();
1017 if (tab_contents) { 1017 if (tab_contents) {
1018 extensions::ActionBoxController* controller = 1018 extensions::LocationBarController* controller =
1019 tab_contents->extension_tab_helper()->action_box_controller(); 1019 tab_contents->extension_tab_helper()->location_bar_controller();
1020 page_actions.swap(*controller->GetCurrentActions()); 1020 page_actions.swap(*controller->GetCurrentActions());
1021 } 1021 }
1022 1022
1023 // On startup we sometimes haven't loaded any extensions. This makes sure 1023 // On startup we sometimes haven't loaded any extensions. This makes sure
1024 // we catch up when the extensions (and any page actions) load. 1024 // we catch up when the extensions (and any page actions) load.
1025 if (page_actions.size() != page_action_views_.size()) { 1025 if (page_actions.size() != page_action_views_.size()) {
1026 DeletePageActionViews(); // Delete the old views (if any). 1026 DeletePageActionViews(); // Delete the old views (if any).
1027 1027
1028 page_action_views_.resize(page_actions.size()); 1028 page_action_views_.resize(page_actions.size());
1029 View* right_anchor = chrome_to_mobile_view_; 1029 View* right_anchor = chrome_to_mobile_view_;
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 const content::NotificationSource& source, 1297 const content::NotificationSource& source,
1298 const content::NotificationDetails& details) { 1298 const content::NotificationDetails& details) {
1299 switch (type) { 1299 switch (type) {
1300 case chrome::NOTIFICATION_PREF_CHANGED: { 1300 case chrome::NOTIFICATION_PREF_CHANGED: {
1301 std::string* name = content::Details<std::string>(details).ptr(); 1301 std::string* name = content::Details<std::string>(details).ptr();
1302 if (*name == prefs::kEditBookmarksEnabled) 1302 if (*name == prefs::kEditBookmarksEnabled)
1303 Update(NULL); 1303 Update(NULL);
1304 break; 1304 break;
1305 } 1305 }
1306 1306
1307 case chrome::NOTIFICATION_EXTENSION_ACTION_BOX_UPDATED: { 1307 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: {
1308 // Only update if the updated action box was for the active tab contents. 1308 // Only update if the updated action box was for the active tab contents.
1309 TabContentsWrapper* target_tab = 1309 TabContentsWrapper* target_tab =
1310 content::Details<TabContentsWrapper>(details).ptr(); 1310 content::Details<TabContentsWrapper>(details).ptr();
1311 if (target_tab == GetTabContentsWrapper()) 1311 if (target_tab == GetTabContentsWrapper())
1312 UpdatePageActions(); 1312 UpdatePageActions();
1313 break; 1313 break;
1314 } 1314 }
1315 1315
1316 default: 1316 default:
1317 NOTREACHED() << "Unexpected notification."; 1317 NOTREACHED() << "Unexpected notification.";
(...skipping 11 matching lines...) Expand all
1329 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1329 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1330 !suggested_text_view_->text().empty(); 1330 !suggested_text_view_->text().empty();
1331 } 1331 }
1332 1332
1333 #if !defined(USE_AURA) 1333 #if !defined(USE_AURA)
1334 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { 1334 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() {
1335 return static_cast<OmniboxViewWin*>(location_entry_.get()); 1335 return static_cast<OmniboxViewWin*>(location_entry_.get());
1336 } 1336 }
1337 #endif 1337 #endif
1338 #endif 1338 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/location_bar_view_gtk.cc ('k') | chrome/browser/ui/views/location_bar/page_action_image_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698