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

Side by Side Diff: chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.cc

Issue 10827198: Change View::HitTest to View::HitTestRect (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed errors reported by trybots 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 unified diff | Download patch
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/ash/browser_non_client_frame_view_ash.h" 5 #include "chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.h"
6 6
7 #include "ash/wm/frame_painter.h" 7 #include "ash/wm/frame_painter.h"
8 #include "ash/wm/workspace/frame_maximize_button.h" 8 #include "ash/wm/workspace/frame_maximize_button.h"
9 #include "chrome/browser/themes/theme_service.h" 9 #include "chrome/browser/themes/theme_service.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 frame_painter_->LayoutHeader(this, UseShortHeader()); 325 frame_painter_->LayoutHeader(this, UseShortHeader());
326 if (avatar_button()) 326 if (avatar_button())
327 LayoutAvatar(); 327 LayoutAvatar();
328 BrowserNonClientFrameView::Layout(); 328 BrowserNonClientFrameView::Layout();
329 } 329 }
330 330
331 std::string BrowserNonClientFrameViewAsh::GetClassName() const { 331 std::string BrowserNonClientFrameViewAsh::GetClassName() const {
332 return kViewClassName; 332 return kViewClassName;
333 } 333 }
334 334
335 bool BrowserNonClientFrameViewAsh::HitTest(const gfx::Point& l) const { 335 bool BrowserNonClientFrameViewAsh::HitTestRect(const gfx::Rect& rect) const {
336 // If the point is outside the bounds of the client area, claim it. 336 // If the rect is outside the bounds of the client area, claim it.
337 if (NonClientFrameView::HitTest(l)) 337 if (NonClientFrameView::HitTestRect(rect))
338 return true; 338 return true;
339 339
340 // Otherwise claim it only if it's in a non-tab portion of the tabstrip. 340 // Otherwise claim it only if it's in a non-tab portion of the tabstrip.
341 if (!browser_view()->tabstrip()) 341 if (!browser_view()->tabstrip())
342 return false; 342 return false;
343 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); 343 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds());
344 gfx::Point tabstrip_origin(tabstrip_bounds.origin()); 344 gfx::Point tabstrip_origin(tabstrip_bounds.origin());
345 View::ConvertPointToView(frame()->client_view(), this, &tabstrip_origin); 345 View::ConvertPointToView(frame()->client_view(), this, &tabstrip_origin);
346 tabstrip_bounds.set_origin(tabstrip_origin); 346 tabstrip_bounds.set_origin(tabstrip_origin);
347 if (l.y() > tabstrip_bounds.bottom()) 347 if (rect.bottom() > tabstrip_bounds.bottom())
348 return false; 348 return false;
349 349
350 // We convert from our parent's coordinates since we assume we fill its bounds 350 // We convert from our parent's coordinates since we assume we fill its bounds
351 // completely. We need to do this since we're not a parent of the tabstrip, 351 // completely. We need to do this since we're not a parent of the tabstrip,
352 // meaning ConvertPointToView would otherwise return something bogus. 352 // meaning ConvertPointToView would otherwise return something bogus.
353 gfx::Point browser_view_point(l); 353 // TODO(tdanderson): Initialize |browser_view_point| using |rect| instead of
354 // its center point once GetEventHandlerForRect() is implemented.
355 gfx::Point browser_view_point(rect.CenterPoint());
354 View::ConvertPointToView(parent(), browser_view(), &browser_view_point); 356 View::ConvertPointToView(parent(), browser_view(), &browser_view_point);
355 return browser_view()->IsPositionInWindowCaption(browser_view_point); 357 return browser_view()->IsPositionInWindowCaption(browser_view_point);
356 } 358 }
357 359
358 void BrowserNonClientFrameViewAsh::GetAccessibleState( 360 void BrowserNonClientFrameViewAsh::GetAccessibleState(
359 ui::AccessibleViewState* state) { 361 ui::AccessibleViewState* state) {
360 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; 362 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR;
361 } 363 }
362 364
363 gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() { 365 gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImage() const { 606 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImage() const {
605 ui::ThemeProvider* tp = GetThemeProvider(); 607 ui::ThemeProvider* tp = GetThemeProvider();
606 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && 608 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) &&
607 browser_view()->IsBrowserTypeNormal() && 609 browser_view()->IsBrowserTypeNormal() &&
608 !browser_view()->IsOffTheRecord()) { 610 !browser_view()->IsOffTheRecord()) {
609 return tp->GetImageSkiaNamed(ShouldPaintAsActive() ? 611 return tp->GetImageSkiaNamed(ShouldPaintAsActive() ?
610 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); 612 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE);
611 } 613 }
612 return NULL; 614 return NULL;
613 } 615 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.h ('k') | chrome/browser/ui/views/avatar_menu_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698