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

Side by Side Diff: chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.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 | « no previous file | chrome/browser/ui/views/frame/browser_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/frame/browser_non_client_frame_view_ash.h" 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h"
6 6
7 #include "ash/shell_delegate.h" 7 #include "ash/shell_delegate.h"
8 #include "ash/wm/frame_painter.h" 8 #include "ash/wm/frame_painter.h"
9 #include "ash/wm/workspace/frame_maximize_button.h" 9 #include "ash/wm/workspace/frame_maximize_button.h"
10 #include "chrome/browser/themes/theme_properties.h" 10 #include "chrome/browser/themes/theme_properties.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 if (avatar_button()) 257 if (avatar_button())
258 LayoutAvatar(); 258 LayoutAvatar();
259 BrowserNonClientFrameView::Layout(); 259 BrowserNonClientFrameView::Layout();
260 } 260 }
261 261
262 const char* BrowserNonClientFrameViewAsh::GetClassName() const { 262 const char* BrowserNonClientFrameViewAsh::GetClassName() const {
263 return kViewClassName; 263 return kViewClassName;
264 } 264 }
265 265
266 bool BrowserNonClientFrameViewAsh::HitTestRect(const gfx::Rect& rect) const { 266 bool BrowserNonClientFrameViewAsh::HitTestRect(const gfx::Rect& rect) const {
267 if (!views::View::HitTestRect(rect)) {
268 // |rect| is outside BrowserNonClientFrameViewAsh's bounds.
269 return false;
270 }
267 // If the rect is outside the bounds of the client area, claim it. 271 // If the rect is outside the bounds of the client area, claim it.
268 if (NonClientFrameView::HitTestRect(rect)) 272 // TODO(tdanderson): Implement View::ConvertRectToTarget().
273 gfx::Point rect_in_client_view_coords_origin(rect.origin());
274 View::ConvertPointToTarget(this, frame()->client_view(),
275 &rect_in_client_view_coords_origin);
276 gfx::Rect rect_in_client_view_coords(
277 rect_in_client_view_coords_origin, rect.size());
278 if (!frame()->client_view()->HitTestRect(rect_in_client_view_coords))
269 return true; 279 return true;
270 280
271 // Otherwise claim it only if it's in a non-tab portion of the tabstrip. 281 // Otherwise, claim |rect| only if it is above the bottom of the tabstrip in
272 if (!browser_view()->tabstrip()) 282 // a non-tab portion.
273 return false; 283 TabStrip* tabstrip = browser_view()->tabstrip();
274 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); 284 if (!tabstrip || !browser_view()->IsTabStripVisible())
275 gfx::Point tabstrip_origin(tabstrip_bounds.origin());
276 View::ConvertPointToTarget(frame()->client_view(), this, &tabstrip_origin);
277 tabstrip_bounds.set_origin(tabstrip_origin);
278 if (rect.bottom() > tabstrip_bounds.bottom())
279 return false; 285 return false;
280 286
281 // We convert from our parent's coordinates since we assume we fill its bounds 287 gfx::Point rect_in_tabstrip_coords_origin(rect.origin());
282 // completely. We need to do this since we're not a parent of the tabstrip, 288 View::ConvertPointToTarget(this, tabstrip,
283 // meaning ConvertPointToTarget would otherwise return something bogus. 289 &rect_in_tabstrip_coords_origin);
284 // TODO(tdanderson): Initialize |browser_view_point| using |rect| instead of 290 gfx::Rect rect_in_tabstrip_coords(rect_in_tabstrip_coords_origin,
285 // its center point once GetEventHandlerForRect() is implemented. 291 rect.size());
286 gfx::Point browser_view_point(rect.CenterPoint()); 292
287 View::ConvertPointToTarget(parent(), browser_view(), &browser_view_point); 293 if (rect_in_tabstrip_coords.bottom() > tabstrip->GetLocalBounds().bottom()) {
288 return browser_view()->IsPositionInWindowCaption(browser_view_point); 294 // |rect| is below the tabstrip.
295 return false;
296 }
297
298 if (tabstrip->HitTestRect(rect_in_tabstrip_coords)) {
299 // Claim |rect| if it is in a non-tab portion of the tabstrip.
300 // TODO(tdanderson): Pass |rect_in_tabstrip_coords| instead of its center
301 // point to TabStrip::IsPositionInWindowCaption() once
302 // GetEventHandlerForRect() is implemented.
303 return tabstrip->IsPositionInWindowCaption(
304 rect_in_tabstrip_coords.CenterPoint());
305 }
306
307 // We claim |rect| because it is above the bottom of the tabstrip, but
308 // not in the tabstrip. In particular, the window controls are right of
309 // the tabstrip.
310 return true;
289 } 311 }
290 312
291 void BrowserNonClientFrameViewAsh::GetAccessibleState( 313 void BrowserNonClientFrameViewAsh::GetAccessibleState(
292 ui::AccessibleViewState* state) { 314 ui::AccessibleViewState* state) {
293 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; 315 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR;
294 } 316 }
295 317
296 gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() { 318 gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() {
297 return frame_painter_->GetMinimumSize(this); 319 return frame_painter_->GetMinimumSize(this);
298 } 320 }
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 int BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImageId() const { 565 int BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImageId() const {
544 ui::ThemeProvider* tp = GetThemeProvider(); 566 ui::ThemeProvider* tp = GetThemeProvider();
545 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && 567 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) &&
546 browser_view()->IsBrowserTypeNormal() && 568 browser_view()->IsBrowserTypeNormal() &&
547 !browser_view()->IsOffTheRecord()) { 569 !browser_view()->IsOffTheRecord()) {
548 return ShouldPaintAsActive() ? 570 return ShouldPaintAsActive() ?
549 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE; 571 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE;
550 } 572 }
551 return 0; 573 return 0;
552 } 574 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/frame/browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698