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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_view.cc

Issue 380813003: Remove remaining overrides of View::HitTestRect() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase against ToT 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/toolbar/toolbar_view.h" 5 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/i18n/number_formatting.h" 9 #include "base/i18n/number_formatting.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "ui/base/l10n/l10n_util.h" 60 #include "ui/base/l10n/l10n_util.h"
61 #include "ui/base/theme_provider.h" 61 #include "ui/base/theme_provider.h"
62 #include "ui/base/window_open_disposition.h" 62 #include "ui/base/window_open_disposition.h"
63 #include "ui/compositor/layer.h" 63 #include "ui/compositor/layer.h"
64 #include "ui/gfx/canvas.h" 64 #include "ui/gfx/canvas.h"
65 #include "ui/gfx/image/canvas_image_source.h" 65 #include "ui/gfx/image/canvas_image_source.h"
66 #include "ui/keyboard/keyboard_controller.h" 66 #include "ui/keyboard/keyboard_controller.h"
67 #include "ui/native_theme/native_theme_aura.h" 67 #include "ui/native_theme/native_theme_aura.h"
68 #include "ui/views/controls/menu/menu_listener.h" 68 #include "ui/views/controls/menu/menu_listener.h"
69 #include "ui/views/focus/view_storage.h" 69 #include "ui/views/focus/view_storage.h"
70 #include "ui/views/view_targeter.h"
70 #include "ui/views/widget/tooltip_manager.h" 71 #include "ui/views/widget/tooltip_manager.h"
71 #include "ui/views/widget/widget.h" 72 #include "ui/views/widget/widget.h"
72 #include "ui/views/window/non_client_view.h" 73 #include "ui/views/window/non_client_view.h"
73 74
74 #if defined(OS_WIN) 75 #if defined(OS_WIN)
75 #include "base/win/windows_version.h" 76 #include "base/win/windows_version.h"
76 #include "chrome/browser/enumerate_modules_model_win.h" 77 #include "chrome/browser/enumerate_modules_model_win.h"
77 #include "chrome/browser/ui/views/conflicting_module_view_win.h" 78 #include "chrome/browser/ui/views/conflicting_module_view_win.h"
78 #include "chrome/browser/ui/views/critical_notification_bubble_view.h" 79 #include "chrome/browser/ui/views/critical_notification_bubble_view.h"
79 #endif 80 #endif
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 home_(NULL), 134 home_(NULL),
134 location_bar_(NULL), 135 location_bar_(NULL),
135 browser_actions_(NULL), 136 browser_actions_(NULL),
136 app_menu_(NULL), 137 app_menu_(NULL),
137 browser_(browser), 138 browser_(browser),
138 extension_message_bubble_factory_( 139 extension_message_bubble_factory_(
139 new extensions::ExtensionMessageBubbleFactory(browser->profile(), 140 new extensions::ExtensionMessageBubbleFactory(browser->profile(),
140 this)) { 141 this)) {
141 set_id(VIEW_ID_TOOLBAR); 142 set_id(VIEW_ID_TOOLBAR);
142 143
144 SetEventTargeter(
145 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this)));
146
143 chrome::AddCommandObserver(browser_, IDC_BACK, this); 147 chrome::AddCommandObserver(browser_, IDC_BACK, this);
144 chrome::AddCommandObserver(browser_, IDC_FORWARD, this); 148 chrome::AddCommandObserver(browser_, IDC_FORWARD, this);
145 chrome::AddCommandObserver(browser_, IDC_RELOAD, this); 149 chrome::AddCommandObserver(browser_, IDC_RELOAD, this);
146 chrome::AddCommandObserver(browser_, IDC_HOME, this); 150 chrome::AddCommandObserver(browser_, IDC_HOME, this);
147 chrome::AddCommandObserver(browser_, IDC_LOAD_NEW_TAB_PAGE, this); 151 chrome::AddCommandObserver(browser_, IDC_LOAD_NEW_TAB_PAGE, this);
148 152
149 display_mode_ = DISPLAYMODE_LOCATION; 153 display_mode_ = DISPLAYMODE_LOCATION;
150 if (browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) || 154 if (browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ||
151 (browser->is_app() && IsStreamlinedHostedAppsEnabled())) 155 (browser->is_app() && IsStreamlinedHostedAppsEnabled()))
152 display_mode_ = DISPLAYMODE_NORMAL; 156 display_mode_ = DISPLAYMODE_NORMAL;
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 // required. 629 // required.
626 browser_actions_->Layout(); 630 browser_actions_->Layout();
627 631
628 // Extend the app menu to the screen's right edge in maximized mode just like 632 // Extend the app menu to the screen's right edge in maximized mode just like
629 // we extend the back button to the left edge. 633 // we extend the back button to the left edge.
630 if (maximized) 634 if (maximized)
631 app_menu_width += kRightEdgeSpacing; 635 app_menu_width += kRightEdgeSpacing;
632 app_menu_->SetBounds(next_element_x, child_y, app_menu_width, child_height); 636 app_menu_->SetBounds(next_element_x, child_y, app_menu_width, child_height);
633 } 637 }
634 638
635 bool ToolbarView::HitTestRect(const gfx::Rect& rect) const {
636 // Fall through to the tab strip above us if none of |rect| intersects
637 // with this view (intersection with the top shadow edge does not
638 // count as intersection with this view).
639 if (rect.bottom() < content_shadow_height())
640 return false;
641 // Otherwise let our superclass take care of it.
642 return AccessiblePaneView::HitTestRect(rect);
643 }
644
645 void ToolbarView::OnPaint(gfx::Canvas* canvas) { 639 void ToolbarView::OnPaint(gfx::Canvas* canvas) {
646 View::OnPaint(canvas); 640 View::OnPaint(canvas);
647 641
648 if (is_display_mode_normal()) 642 if (is_display_mode_normal())
649 return; 643 return;
650 644
651 // For glass, we need to draw a black line below the location bar to separate 645 // For glass, we need to draw a black line below the location bar to separate
652 // it from the content area. For non-glass, the NonClientView draws the 646 // it from the content area. For non-glass, the NonClientView draws the
653 // toolbar background below the location bar for us. 647 // toolbar background below the location bar for us.
654 // NOTE: Keep this in sync with BrowserView::GetInfoBarSeparatorColor()! 648 // NOTE: Keep this in sync with BrowserView::GetInfoBarSeparatorColor()!
(...skipping 18 matching lines...) Expand all
673 667
674 bool ToolbarView::IsWrenchMenuShowing() const { 668 bool ToolbarView::IsWrenchMenuShowing() const {
675 return wrench_menu_.get() && wrench_menu_->IsShowing(); 669 return wrench_menu_.get() && wrench_menu_->IsShowing();
676 } 670 }
677 671
678 bool ToolbarView::ShouldPaintBackground() const { 672 bool ToolbarView::ShouldPaintBackground() const {
679 return display_mode_ == DISPLAYMODE_NORMAL; 673 return display_mode_ == DISPLAYMODE_NORMAL;
680 } 674 }
681 675
682 //////////////////////////////////////////////////////////////////////////////// 676 ////////////////////////////////////////////////////////////////////////////////
677 // ToolbarView, views::ViewTargeterDelegate overrides:
678
679 bool ToolbarView::DoesIntersectRect(const views::View* target,
680 const gfx::Rect& rect) const {
681 CHECK_EQ(target, this);
682
683 // Fall through to the tab strip above us if none of |rect| intersects
684 // with this view (intersection with the top shadow edge does not
685 // count as intersection with this view).
686 if (rect.bottom() < content_shadow_height())
687 return false;
688 // Otherwise let our superclass take care of it.
689 return ViewTargeterDelegate::DoesIntersectRect(this, rect);
690 }
691
692 ////////////////////////////////////////////////////////////////////////////////
683 // ToolbarView, protected: 693 // ToolbarView, protected:
684 694
685 // Override this so that when the user presses F6 to rotate toolbar panes, 695 // Override this so that when the user presses F6 to rotate toolbar panes,
686 // the location bar gets focus, not the first control in the toolbar - and 696 // the location bar gets focus, not the first control in the toolbar - and
687 // also so that it selects all content in the location bar. 697 // also so that it selects all content in the location bar.
688 bool ToolbarView::SetPaneFocusAndFocusDefault() { 698 bool ToolbarView::SetPaneFocusAndFocusDefault() {
689 if (!location_bar_->HasFocus()) { 699 if (!location_bar_->HasFocus()) {
690 SetPaneFocus(location_bar_); 700 SetPaneFocus(location_bar_);
691 location_bar_->FocusLocation(true); 701 location_bar_->FocusLocation(true);
692 return true; 702 return true;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 851
842 void ToolbarView::OnShowHomeButtonChanged() { 852 void ToolbarView::OnShowHomeButtonChanged() {
843 Layout(); 853 Layout();
844 SchedulePaint(); 854 SchedulePaint();
845 } 855 }
846 856
847 int ToolbarView::content_shadow_height() const { 857 int ToolbarView::content_shadow_height() const {
848 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? 858 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
849 kContentShadowHeightAsh : kContentShadowHeight; 859 kContentShadowHeightAsh : kContentShadowHeight;
850 } 860 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698