diff options
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/detachable_toolbar_view.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/detachable_toolbar_view.h | 3 | ||||
-rw-r--r-- | chrome/browser/views/extensions/extension_shelf.cc | 22 | ||||
-rw-r--r-- | chrome/browser/views/extensions/extension_shelf.h | 1 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view_layout.cc | 44 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view_layout.h | 2 |
6 files changed, 9 insertions, 68 deletions
diff --git a/chrome/browser/views/detachable_toolbar_view.cc b/chrome/browser/views/detachable_toolbar_view.cc index fcf8f5c..924ecb0 100644 --- a/chrome/browser/views/detachable_toolbar_view.cc +++ b/chrome/browser/views/detachable_toolbar_view.cc @@ -56,9 +56,8 @@ void DetachableToolbarView::CalculateContentArea( void DetachableToolbarView::PaintHorizontalBorder(gfx::Canvas* canvas, DetachableToolbarView* view) { // Border can be at the top or at the bottom of the view depending on whether - // the view (bar/shelf) is at the top/at the bottom and whether it is attached - // or detached. - int y = view->IsOnTop() == !view->IsDetached() ? view->height() - 1 : 0; + // the view (bar/shelf) is attached or detached. + int y = !view->IsDetached() ? view->height() - 1 : 0; canvas->FillRectInt(ResourceBundle::toolbar_separator_color, 0, y, view->width(), 1); } diff --git a/chrome/browser/views/detachable_toolbar_view.h b/chrome/browser/views/detachable_toolbar_view.h index 7d49c9b..381fcbb 100644 --- a/chrome/browser/views/detachable_toolbar_view.h +++ b/chrome/browser/views/detachable_toolbar_view.h @@ -25,9 +25,6 @@ class DetachableToolbarView : public AccessibleToolbarView { // Whether the view is currently detached from the Chrome frame. virtual bool IsDetached() const = 0; - // Whether the shelf/bar is above the page or below it. - virtual bool IsOnTop() const = 0; - // Gets the current state of the resize animation (show/hide). virtual double GetAnimationValue() const = 0; diff --git a/chrome/browser/views/extensions/extension_shelf.cc b/chrome/browser/views/extensions/extension_shelf.cc index 6923d0f..69b6dc1 100644 --- a/chrome/browser/views/extensions/extension_shelf.cc +++ b/chrome/browser/views/extensions/extension_shelf.cc @@ -455,14 +455,7 @@ void ExtensionShelf::Toolstrip::LayoutWindow() { // level widget, we need to do some coordinate conversion to get this right. gfx::Point origin(-kToolstripPadding, 0); if (expanded_ || mole_animation_->IsAnimating()) { - if (shelf_->IsOnTop()) { - if (handle_visible_) - origin.set_y(-GetHandlePreferredSize().height()); - else - origin.set_y(0); - } else { - origin.set_y(GetShelfView()->height() - window_size.height()); - } + origin.set_y(GetShelfView()->height() - window_size.height()); views::View::ConvertPointToView(GetShelfView(), shelf_->GetRootView(), &origin); } else { @@ -692,10 +685,7 @@ ExtensionShelf::ExtensionShelf(Browser* browser) fullscreen_(false) { SetID(VIEW_ID_DEV_EXTENSION_SHELF); - if (IsOnTop()) - top_margin_ = kTopMarginWhenExtensionsOnTop; - else - top_margin_ = kTopMarginWhenExtensionsOnBottom; + top_margin_ = kTopMarginWhenExtensionsOnBottom; model_->AddObserver(this); LoadFromModel(); @@ -1103,12 +1093,6 @@ gfx::Size ExtensionShelf::LayoutItems(bool compute_bounds_only) { return prefsize; } -bool ExtensionShelf::IsOnTop() const { - static bool is_on_top = CommandLine::ForCurrentProcess()->HasSwitch( - switches::kShowExtensionsOnTop); - return is_on_top; -} - bool ExtensionShelf::IsDetached() const { return OnNewTabPage() && (size_animation_->GetCurrentValue() != 1); } @@ -1127,7 +1111,7 @@ void ExtensionShelf::OnFullscreenToggled(bool fullscreen) { if (fullscreen == fullscreen_) return; fullscreen_ = fullscreen; - if (!IsAlwaysShown() || IsOnTop()) + if (!IsAlwaysShown()) return; size_animation_->Reset(fullscreen ? 0 : 1); } diff --git a/chrome/browser/views/extensions/extension_shelf.h b/chrome/browser/views/extensions/extension_shelf.h index 3be5791..2a0ef6b 100644 --- a/chrome/browser/views/extensions/extension_shelf.h +++ b/chrome/browser/views/extensions/extension_shelf.h @@ -39,7 +39,6 @@ class ExtensionShelf : public DetachableToolbarView, int top_margin() { return top_margin_; } // DetachableToolbarView methods: - virtual bool IsOnTop() const; virtual bool IsDetached() const; virtual double GetAnimationValue() const { return size_animation_->GetCurrentValue(); diff --git a/chrome/browser/views/frame/browser_view_layout.cc b/chrome/browser/views/frame/browser_view_layout.cc index e2c5ae1..ec75cac 100644 --- a/chrome/browser/views/frame/browser_view_layout.cc +++ b/chrome/browser/views/frame/browser_view_layout.cc @@ -314,30 +314,20 @@ int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top) { // need to show any Info bar _above_ the Bookmark bar, since the // Bookmark bar is styled to look like it's part of the page. if (active_bookmark_bar_->IsDetached()) - return LayoutTopBar(LayoutInfoBar(top)); + return LayoutBookmarkBar(LayoutInfoBar(top)); // Otherwise, Bookmark bar first, Info bar second. - top = LayoutTopBar(top); + top = LayoutBookmarkBar(top); } find_bar_y_ = top + browser_view_->y() - 1; return LayoutInfoBar(top); } -int BrowserViewLayout::LayoutTopBar(int top) { - // This method lays out the the bookmark bar, and, if required, - // the extension shelf by its side. The bookmark bar appears on - // the right of the extension shelf. If there are too many - // bookmark items and extension toolstrips to fit in the single - // bar, some compromises are made as follows: 1. The bookmark bar - // is shrunk till it reaches the minimum width. 2. After reaching - // the minimum width, the bookmark bar width is kept fixed - the - // extension shelf bar width is reduced. +int BrowserViewLayout::LayoutBookmarkBar(int top) { DCHECK(active_bookmark_bar_); int y = top, x = 0; if (!browser_view_->IsBookmarkBarVisible()) { active_bookmark_bar_->SetVisible(false); active_bookmark_bar_->SetBounds(0, y, browser_view_->width(), 0); - if (extension_shelf_->IsOnTop()) - extension_shelf_->SetVisible(false); return y; } @@ -346,31 +336,6 @@ int BrowserViewLayout::LayoutTopBar(int top) { active_bookmark_bar_->IsDetached() ? 0 : active_bookmark_bar_->GetToolbarOverlap(false)); - if (extension_shelf_->IsOnTop()) { - if (!active_bookmark_bar_->IsDetached()) { - int extension_shelf_width = - extension_shelf_->GetPreferredSize().width(); - int bookmark_bar_given_width = - browser_view_->width() - extension_shelf_width; - int minimum_allowed_bookmark_bar_width = - active_bookmark_bar_->GetMinimumSize().width(); - if (bookmark_bar_given_width < minimum_allowed_bookmark_bar_width) { - // The bookmark bar cannot compromise on its width any more. The - // extension shelf needs to shrink now. - extension_shelf_width = - browser_view_->width() - minimum_allowed_bookmark_bar_width; - } - extension_shelf_->SetVisible(true); - extension_shelf_->SetBounds(x, y, extension_shelf_width, - bookmark_bar_height); - x += extension_shelf_width; - } else { - // TODO(sidchat): For detached style bookmark bar, set the extensions - // shelf in a better position. Issue = 20741. - extension_shelf_->SetVisible(false); - } - } - active_bookmark_bar_->SetVisible(true); active_bookmark_bar_->SetBounds(x, y, browser_view_->width() - x, @@ -429,9 +394,6 @@ int BrowserViewLayout::LayoutDownloadShelf(int bottom) { } int BrowserViewLayout::LayoutExtensionShelf(int bottom) { - if (!extension_shelf_ || extension_shelf_->IsOnTop()) - return bottom; - if (extension_shelf_) { bool visible = browser()->SupportsWindowFeature( Browser::FEATURE_EXTENSIONSHELF); diff --git a/chrome/browser/views/frame/browser_view_layout.h b/chrome/browser/views/frame/browser_view_layout.h index 33333fa..e3706be 100644 --- a/chrome/browser/views/frame/browser_view_layout.h +++ b/chrome/browser/views/frame/browser_view_layout.h @@ -51,7 +51,7 @@ class BrowserViewLayout : public views::LayoutManager { // of the bottom of the control, for laying out the next control. int LayoutToolbar(int top); int LayoutBookmarkAndInfoBars(int top); - int LayoutTopBar(int top); + int LayoutBookmarkBar(int top); int LayoutInfoBar(int top); // Layout the TabContents container, between the coordinates |top| and |