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

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

Issue 380813003: Remove remaining overrides of View::HitTestRect() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DoesIntersectRect() overrides made private Created 6 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" 10 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 header_painter_->SetHeaderHeightForPainting(painted_height); 289 header_painter_->SetHeaderHeightForPainting(painted_height);
290 if (avatar_button()) 290 if (avatar_button())
291 LayoutAvatar(); 291 LayoutAvatar();
292 BrowserNonClientFrameView::Layout(); 292 BrowserNonClientFrameView::Layout();
293 } 293 }
294 294
295 const char* BrowserNonClientFrameViewAsh::GetClassName() const { 295 const char* BrowserNonClientFrameViewAsh::GetClassName() const {
296 return kViewClassName; 296 return kViewClassName;
297 } 297 }
298 298
299 bool BrowserNonClientFrameViewAsh::HitTestRect(const gfx::Rect& rect) const {
300 if (!views::View::HitTestRect(rect)) {
301 // |rect| is outside BrowserNonClientFrameViewAsh's bounds.
302 return false;
303 }
304
305 TabStrip* tabstrip = browser_view()->tabstrip();
306 if (tabstrip && browser_view()->IsTabStripVisible()) {
307 // Claim |rect| only if it is above the bottom of the tabstrip in a non-tab
308 // portion.
309 gfx::RectF rect_in_tabstrip_coords_f(rect);
310 View::ConvertRectToTarget(this, tabstrip, &rect_in_tabstrip_coords_f);
311 gfx::Rect rect_in_tabstrip_coords = gfx::ToEnclosingRect(
312 rect_in_tabstrip_coords_f);
313
314 if (rect_in_tabstrip_coords.y() > tabstrip->height())
315 return false;
316
317 return !tabstrip->HitTestRect(rect_in_tabstrip_coords) ||
318 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords);
319 }
320
321 // Claim |rect| if it is above the top of the topmost view in the client area.
322 return rect.y() < GetTopInset();
323 }
324
325 void BrowserNonClientFrameViewAsh::GetAccessibleState( 299 void BrowserNonClientFrameViewAsh::GetAccessibleState(
326 ui::AXViewState* state) { 300 ui::AXViewState* state) {
327 state->role = ui::AX_ROLE_TITLE_BAR; 301 state->role = ui::AX_ROLE_TITLE_BAR;
328 } 302 }
329 303
330 gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() const { 304 gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() const {
331 gfx::Size min_client_view_size(frame()->client_view()->GetMinimumSize()); 305 gfx::Size min_client_view_size(frame()->client_view()->GetMinimumSize());
332 int min_width = std::max(header_painter_->GetMinimumHeaderWidth(), 306 int min_width = std::max(header_painter_->GetMinimumHeaderWidth(),
333 min_client_view_size.width()); 307 min_client_view_size.width());
334 if (browser_view()->IsTabStripVisible()) { 308 if (browser_view()->IsTabStripVisible()) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 gfx::ImageSkia BrowserNonClientFrameViewAsh::GetFaviconForTabIconView() { 347 gfx::ImageSkia BrowserNonClientFrameViewAsh::GetFaviconForTabIconView() {
374 views::WidgetDelegate* delegate = frame()->widget_delegate(); 348 views::WidgetDelegate* delegate = frame()->widget_delegate();
375 if (!delegate) 349 if (!delegate)
376 return gfx::ImageSkia(); 350 return gfx::ImageSkia();
377 return delegate->GetWindowIcon(); 351 return delegate->GetWindowIcon();
378 } 352 }
379 353
380 /////////////////////////////////////////////////////////////////////////////// 354 ///////////////////////////////////////////////////////////////////////////////
381 // BrowserNonClientFrameViewAsh, private: 355 // BrowserNonClientFrameViewAsh, private:
382 356
357 // views::NonClientFrameView:
358 bool BrowserNonClientFrameViewAsh::DoesIntersectRect(
359 const views::View* target,
360 const gfx::Rect& rect) const {
361 CHECK_EQ(target, this);
362 if (!views::ViewTargeterDelegate::DoesIntersectRect(this, rect)) {
363 // |rect| is outside BrowserNonClientFrameViewAsh's bounds.
364 return false;
365 }
366
367 TabStrip* tabstrip = browser_view()->tabstrip();
368 if (tabstrip && browser_view()->IsTabStripVisible()) {
369 // Claim |rect| only if it is above the bottom of the tabstrip in a non-tab
370 // portion.
371 gfx::RectF rect_in_tabstrip_coords_f(rect);
372 View::ConvertRectToTarget(this, tabstrip, &rect_in_tabstrip_coords_f);
373 gfx::Rect rect_in_tabstrip_coords = gfx::ToEnclosingRect(
374 rect_in_tabstrip_coords_f);
375
376 if (rect_in_tabstrip_coords.y() > tabstrip->height())
377 return false;
378
379 return !tabstrip->HitTestRect(rect_in_tabstrip_coords) ||
380 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords);
381 }
382
383 // Claim |rect| if it is above the top of the topmost view in the client area.
384 return rect.y() < GetTopInset();
385 }
386
383 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { 387 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const {
384 return avatar_button() ? kAvatarSideSpacing + 388 return avatar_button() ? kAvatarSideSpacing +
385 browser_view()->GetOTRAvatarIcon().width() + kAvatarSideSpacing : 389 browser_view()->GetOTRAvatarIcon().width() + kAvatarSideSpacing :
386 kTabstripLeftSpacing; 390 kTabstripLeftSpacing;
387 } 391 }
388 392
389 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { 393 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const {
390 return caption_button_container_->GetPreferredSize().width() + 394 return caption_button_container_->GetPreferredSize().width() +
391 kTabstripRightSpacing; 395 kTabstripRightSpacing;
392 } 396 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); 538 ThemeProperties::COLOR_TOOLBAR_SEPARATOR));
535 } 539 }
536 540
537 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { 541 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) {
538 DCHECK(!UsePackagedAppHeaderStyle()); 542 DCHECK(!UsePackagedAppHeaderStyle());
539 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), 543 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(),
540 width(), kClientEdgeThickness), 544 width(), kClientEdgeThickness),
541 ThemeProperties::GetDefaultColor( 545 ThemeProperties::GetDefaultColor(
542 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); 546 ThemeProperties::COLOR_TOOLBAR_SEPARATOR));
543 } 547 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698