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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view_layout.cc

Issue 19115003: Make the maximize button more easily hittable when there is a huge amount of tabs present (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/frame/browser_view_layout.h" 5 #include "chrome/browser/ui/views/frame/browser_view_layout.h"
6 6
7 #include "base/observer_list.h" 7 #include "base/observer_list.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 int scrollbar_width = gfx::scrollbar_size(); 242 int scrollbar_width = gfx::scrollbar_size();
243 bounding_box.set_width(std::max(0, bounding_box.width() - scrollbar_width)); 243 bounding_box.set_width(std::max(0, bounding_box.width() - scrollbar_width));
244 if (base::i18n::IsRTL()) 244 if (base::i18n::IsRTL())
245 bounding_box.set_x(bounding_box.x() + scrollbar_width); 245 bounding_box.set_x(bounding_box.x() + scrollbar_width);
246 246
247 return bounding_box; 247 return bounding_box;
248 } 248 }
249 249
250 bool BrowserViewLayout::IsPositionInWindowCaption( 250 bool BrowserViewLayout::IsPositionInWindowCaption(
251 const gfx::Point& point) { 251 const gfx::Point& point) {
252 // Tab strip may transiently have no parent between the RemoveChildView() and 252 views::View* window_switcher_button = delegate_->GetWindowSwitcherButton();
253 // AddChildView() caused by reparenting during an immersive mode reveal. 253 if (window_switcher_button) {
254 // During this window report that the point didn't hit a tab. 254 gfx::Point window_switcher_point(point);
255 if (!tab_strip_->parent()) 255 views::View::ConvertPointToTarget(browser_view_, window_switcher_button,
256 return true; 256 &window_switcher_point);
257 if (window_switcher_button->HitTestPoint(window_switcher_point))
258 return false;
259 }
260
257 gfx::Point tabstrip_point(point); 261 gfx::Point tabstrip_point(point);
258 views::View::ConvertPointToTarget(browser_view_, tab_strip_, &tabstrip_point); 262 views::View::ConvertPointToTarget(browser_view_, tab_strip_, &tabstrip_point);
263
264 // NonClientFrameView::HitTestRect() should have filtered out any points
265 // below |tab_strip_|.
266 DCHECK_LE(point.y(), tab_strip_->bounds().bottom());
267
268 // The window controls are in the non client view.
269 if (!tab_strip_->HitTestPoint(tabstrip_point))
James Cook 2013/07/12 23:12:12 Is there some other way to do this? In particular
270 return true;
259 return tab_strip_->IsPositionInWindowCaption(tabstrip_point); 271 return tab_strip_->IsPositionInWindowCaption(tabstrip_point);
260 } 272 }
261 273
262 int BrowserViewLayout::NonClientHitTest( 274 int BrowserViewLayout::NonClientHitTest(
263 const gfx::Point& point) { 275 const gfx::Point& point) {
264 // Since the TabStrip only renders in some parts of the top of the window, 276 // Since the TabStrip only renders in some parts of the top of the window,
265 // the un-obscured area is considered to be part of the non-client caption 277 // the un-obscured area is considered to be part of the non-client caption
266 // area of the window. So we need to treat hit-tests in these regions as 278 // area of the window. So we need to treat hit-tests in these regions as
267 // hit-tests of the titlebar. 279 // hit-tests of the titlebar.
268 280
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 return bottom; 653 return bottom;
642 } 654 }
643 655
644 bool BrowserViewLayout::InfobarVisible() const { 656 bool BrowserViewLayout::InfobarVisible() const {
645 // Cast to a views::View to access GetPreferredSize(). 657 // Cast to a views::View to access GetPreferredSize().
646 views::View* infobar_container = infobar_container_; 658 views::View* infobar_container = infobar_container_;
647 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. 659 // NOTE: Can't check if the size IsEmpty() since it's always 0-width.
648 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && 660 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) &&
649 (infobar_container->GetPreferredSize().height() != 0); 661 (infobar_container->GetPreferredSize().height() != 0);
650 } 662 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698