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

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

Issue 10854017: Basic metro snap view omnibox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chromeos compilation. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/toolbar_view.cc
diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc
index 2351330f51557038666b289afad9e6c7ae4c4e00..3b0076a1bf3230c18d0d3819e9bedc9c8e239934 100644
--- a/chrome/browser/ui/views/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar_view.cc
@@ -220,6 +220,10 @@ ToolbarView::~ToolbarView() {
void ToolbarView::Init(views::View* location_bar_parent,
views::View* popup_parent_view) {
+ // Remember the popup_parent_view_ in case we need to swap out the
+ // LocationBarView later.
+ popup_parent_view_ = popup_parent_view;
+
back_ = new views::ButtonDropDown(this, new BackForwardMenuModel(
browser_, BackForwardMenuModel::BACKWARD_MENU));
back_->set_triggerable_event_flags(ui::EF_LEFT_MOUSE_BUTTON |
@@ -303,7 +307,7 @@ void ToolbarView::Init(views::View* location_bar_parent,
AddChildView(browser_actions_);
AddChildView(app_menu_);
- location_bar_->Init(popup_parent_view);
+ location_bar_->Init(popup_parent_view_);
show_home_button_.Init(prefs::kShowHomeButton,
browser_->profile()->GetPrefs(), this);
browser_actions_->Init();
@@ -407,6 +411,45 @@ void ToolbarView::LayoutForSearch() {
LayoutLocationBarNTP();
}
+void ToolbarView::SetMetroSnapDisplayMode(bool enable) {
+ if ((enable && display_mode_ == DISPLAYMODE_METROSNAP) ||
+ (!enable && display_mode_ != DISPLAYMODE_METROSNAP))
+ return;
+
+ LocationBarView::Mode location_bar_mode = LocationBarView::NORMAL;
+ views::View* parent_view = NULL;
+ if (enable) {
+ display_mode_ = DISPLAYMODE_METROSNAP;
+ location_bar_mode = LocationBarView::METRO_SNAP;
+ } else {
+ display_mode_ = DISPLAYMODE_NORMAL;
+ parent_view = popup_parent_view_;
+ }
+
+ // Create a new location bar to swap with the current one.
+ LocationBarView* new_location_bar_view = new LocationBarView(
+ browser_,
+ browser_->profile(),
+ browser_->command_controller()->command_updater(),
+ model_,
+ this,
+ browser_->search_model(),
+ location_bar_mode);
+ location_bar_container_->SetLocationBarView(new_location_bar_view);
+
+ // Since it has now been removed from the view hierarchy, it is safe to
+ // delete the old view location bar.
+ delete location_bar_;
+
+ location_bar_ = new_location_bar_view;
+ location_bar_->Init(parent_view);
+ location_bar_->Layout();
+
+ Layout();
+ LayoutForSearch();
+ SchedulePaint();
+}
+
////////////////////////////////////////////////////////////////////////////////
// ToolbarView, AccessiblePaneView overrides:
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698