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

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: Changed completely 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
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 return frame_painter_->GetBoundsForClientView(top_height, bounds()); 155 return frame_painter_->GetBoundsForClientView(top_height, bounds());
156 } 156 }
157 157
158 gfx::Rect BrowserNonClientFrameViewAsh::GetWindowBoundsForClientBounds( 158 gfx::Rect BrowserNonClientFrameViewAsh::GetWindowBoundsForClientBounds(
159 const gfx::Rect& client_bounds) const { 159 const gfx::Rect& client_bounds) const {
160 int top_height = NonClientTopBorderHeight(false); 160 int top_height = NonClientTopBorderHeight(false);
161 return frame_painter_->GetWindowBoundsForClientBounds(top_height, 161 return frame_painter_->GetWindowBoundsForClientBounds(top_height,
162 client_bounds); 162 client_bounds);
163 } 163 }
164 164
165 int BrowserNonClientFrameViewAsh::NonClientHitTest(const gfx::Point& point) { 165 int BrowserNonClientFrameViewAsh::NonClientHitTest(
166 const gfx::Point& point) const {
166 int hit_test = frame_painter_->NonClientHitTest(this, point); 167 int hit_test = frame_painter_->NonClientHitTest(this, point);
167 // When the window is restored we want a large click target above the tabs 168 // When the window is restored we want a large click target above the tabs
168 // to drag the window, so redirect clicks in the tab's shadow to caption. 169 // to drag the window, so redirect clicks in the tab's shadow to caption.
169 if (hit_test == HTCLIENT && 170 if (hit_test == HTCLIENT &&
170 !(frame()->IsMaximized() || frame()->IsFullscreen())) { 171 !(frame()->IsMaximized() || frame()->IsFullscreen())) {
171 // Convert point to client coordinates. 172 // Convert point to client coordinates.
172 gfx::Point client_point(point); 173 gfx::Point client_point(point);
173 View::ConvertPointToTarget(this, frame()->client_view(), &client_point); 174 View::ConvertPointToTarget(this, frame()->client_view(), &client_point);
174 // Report hits in shadow at top of tabstrip as caption. 175 // Report hits in shadow at top of tabstrip as caption.
175 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); 176 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds());
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 if (avatar_button()) 258 if (avatar_button())
258 LayoutAvatar(); 259 LayoutAvatar();
259 BrowserNonClientFrameView::Layout(); 260 BrowserNonClientFrameView::Layout();
260 } 261 }
261 262
262 const char* BrowserNonClientFrameViewAsh::GetClassName() const { 263 const char* BrowserNonClientFrameViewAsh::GetClassName() const {
263 return kViewClassName; 264 return kViewClassName;
264 } 265 }
265 266
266 bool BrowserNonClientFrameViewAsh::HitTestRect(const gfx::Rect& rect) const { 267 bool BrowserNonClientFrameViewAsh::HitTestRect(const gfx::Rect& rect) const {
267 // If the rect is outside the bounds of the client area, claim it.
268 if (NonClientFrameView::HitTestRect(rect))
269 return true;
270
271 // Otherwise claim it only if it's in a non-tab portion of the tabstrip.
272 if (!browser_view()->tabstrip())
273 return false;
274 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds());
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())
James Cook 2013/07/16 19:25:52 I don't understand how we can get away with removi
279 return false;
280
281 // We convert from our parent's coordinates since we assume we fill its bounds
282 // completely. We need to do this since we're not a parent of the tabstrip,
283 // meaning ConvertPointToTarget would otherwise return something bogus.
284 // TODO(tdanderson): Initialize |browser_view_point| using |rect| instead of 268 // TODO(tdanderson): Initialize |browser_view_point| using |rect| instead of
285 // its center point once GetEventHandlerForRect() is implemented. 269 // its center point once GetEventHandlerForRect() is implemented.
286 gfx::Point browser_view_point(rect.CenterPoint()); 270 gfx::Point browser_view_point(rect.CenterPoint());
287 View::ConvertPointToTarget(parent(), browser_view(), &browser_view_point); 271 return NonClientHitTest(browser_view_point) != HTCLIENT;
James Cook 2013/07/16 19:25:52 Won't this return true if frame_painter_->NonClien
288 return browser_view()->IsPositionInWindowCaption(browser_view_point);
289 } 272 }
290 273
291 void BrowserNonClientFrameViewAsh::GetAccessibleState( 274 void BrowserNonClientFrameViewAsh::GetAccessibleState(
292 ui::AccessibleViewState* state) { 275 ui::AccessibleViewState* state) {
293 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; 276 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR;
294 } 277 }
295 278
296 gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() { 279 gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() {
297 return frame_painter_->GetMinimumSize(this); 280 return frame_painter_->GetMinimumSize(this);
298 } 281 }
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 int BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImageId() const { 526 int BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImageId() const {
544 ui::ThemeProvider* tp = GetThemeProvider(); 527 ui::ThemeProvider* tp = GetThemeProvider();
545 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && 528 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) &&
546 browser_view()->IsBrowserTypeNormal() && 529 browser_view()->IsBrowserTypeNormal() &&
547 !browser_view()->IsOffTheRecord()) { 530 !browser_view()->IsOffTheRecord()) {
548 return ShouldPaintAsActive() ? 531 return ShouldPaintAsActive() ?
549 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE; 532 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE;
550 } 533 }
551 return 0; 534 return 0;
552 } 535 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698