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

Unified Diff: chrome/browser/ui/views/toolbar_view.cc

Issue 10677009: Move command handling and updating off Browser and onto a helper object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/toolbar_view.cc
===================================================================
--- chrome/browser/ui/views/toolbar_view.cc (revision 144216)
+++ chrome/browser/ui/views/toolbar_view.cc (working copy)
@@ -12,6 +12,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_command_controller.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h"
#include "chrome/browser/ui/browser_window.h"
@@ -152,11 +153,11 @@
profiles_menu_contents_(NULL) {
set_id(VIEW_ID_TOOLBAR);
- browser_->command_updater()->AddCommandObserver(IDC_BACK, this);
- browser_->command_updater()->AddCommandObserver(IDC_FORWARD, this);
- browser_->command_updater()->AddCommandObserver(IDC_RELOAD, this);
- browser_->command_updater()->AddCommandObserver(IDC_HOME, this);
- browser_->command_updater()->AddCommandObserver(IDC_LOAD_NEW_TAB_PAGE, this);
+ chrome::AddCommandObserver(browser_, IDC_BACK, this);
+ chrome::AddCommandObserver(browser_, IDC_FORWARD, this);
+ chrome::AddCommandObserver(browser_, IDC_RELOAD, this);
+ chrome::AddCommandObserver(browser_, IDC_HOME, this);
+ chrome::AddCommandObserver(browser_, IDC_LOAD_NEW_TAB_PAGE, this);
display_mode_ = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ?
DISPLAYMODE_NORMAL : DISPLAYMODE_LOCATION;
@@ -220,7 +221,7 @@
chrome::search::IsInstantExtendedAPIEnabled(browser_->profile()));
location_bar_ = new LocationBarView(
browser_->profile(),
- browser_->command_updater(),
+ browser_->command_controller()->command_updater(),
model_,
this,
(display_mode_ == DISPLAYMODE_LOCATION) ?
@@ -230,7 +231,8 @@
// location_bar_->set_view_to_focus(location_bar_container_);
location_bar_container_->SetLocationBarView(location_bar_);
- reload_ = new ReloadButton(location_bar_, browser_->command_updater());
+ reload_ = new ReloadButton(location_bar_,
+ browser_->command_controller()->command_updater());
reload_->set_triggerable_event_flags(ui::EF_LEFT_MOUSE_BUTTON |
ui::EF_MIDDLE_MOUSE_BUTTON);
reload_->set_tag(IDC_RELOAD);
@@ -473,7 +475,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-// ToolbarView, CommandUpdater::CommandObserver implementation:
+// ToolbarView, CommandObserver implementation:
void ToolbarView::EnabledStateChangedForCommand(int id, bool enabled) {
// Special case the reload button at the NTP for extended instant.
@@ -515,7 +517,7 @@
// action.
location_bar_->Revert();
}
- browser_->ExecuteCommandWithDisposition(command, disposition);
+ chrome::ExecuteCommandWithDisposition(browser_, command, disposition);
}
////////////////////////////////////////////////////////////////////////////////
@@ -699,7 +701,7 @@
// Force the reload button to go into disabled mode to display the grey
// circle and not the grey cross. The disabled reload state only exists for
// ntp pages.
- browser_->command_updater()->UpdateCommandEnabled(IDC_RELOAD, false);
+ chrome::UpdateCommandEnabled(browser_, IDC_RELOAD, false);
} else {
// Start the location bar animation.
if (si_mode.animate && si_mode.is_search() &&
@@ -712,7 +714,7 @@
} else {
SetLocationBarContainerBounds(location_bar_bounds);
}
- browser_->command_updater()->UpdateCommandEnabled(IDC_RELOAD, true);
+ chrome::UpdateCommandEnabled(browser_, IDC_RELOAD, true);
}
browser_actions_->SetBounds(location_bar_bounds.right(), 0,

Powered by Google App Engine
This is Rietveld 408576698