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

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: 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
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_view.h ('k') | ui/views/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 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 } 693 }
700 694
701 void ToolbarView::RemovePaneFocus() { 695 void ToolbarView::RemovePaneFocus() {
702 AccessiblePaneView::RemovePaneFocus(); 696 AccessiblePaneView::RemovePaneFocus();
703 location_bar_->SetShowFocusRect(false); 697 location_bar_->SetShowFocusRect(false);
704 } 698 }
705 699
706 //////////////////////////////////////////////////////////////////////////////// 700 ////////////////////////////////////////////////////////////////////////////////
707 // ToolbarView, private: 701 // ToolbarView, private:
708 702
703 // views::ViewTargeterDelegate:
704 bool ToolbarView::DoesIntersectRect(const views::View* target,
705 const gfx::Rect& rect) const {
706 CHECK_EQ(target, this);
707
708 // Fall through to the tab strip above us if none of |rect| intersects
709 // with this view (intersection with the top shadow edge does not
710 // count as intersection with this view).
711 if (rect.bottom() < content_shadow_height())
712 return false;
713 // Otherwise let our superclass take care of it.
714 return ViewTargeterDelegate::DoesIntersectRect(this, rect);
715 }
716
709 bool ToolbarView::ShouldShowUpgradeRecommended() { 717 bool ToolbarView::ShouldShowUpgradeRecommended() {
710 #if defined(OS_CHROMEOS) 718 #if defined(OS_CHROMEOS)
711 // In chromeos, the update recommendation is shown in the system tray. So it 719 // In chromeos, the update recommendation is shown in the system tray. So it
712 // should not be displayed in the wrench menu. 720 // should not be displayed in the wrench menu.
713 return false; 721 return false;
714 #else 722 #else
715 return (UpgradeDetector::GetInstance()->notify_upgrade()); 723 return (UpgradeDetector::GetInstance()->notify_upgrade());
716 #endif 724 #endif
717 } 725 }
718 726
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 849
842 void ToolbarView::OnShowHomeButtonChanged() { 850 void ToolbarView::OnShowHomeButtonChanged() {
843 Layout(); 851 Layout();
844 SchedulePaint(); 852 SchedulePaint();
845 } 853 }
846 854
847 int ToolbarView::content_shadow_height() const { 855 int ToolbarView::content_shadow_height() const {
848 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? 856 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
849 kContentShadowHeightAsh : kContentShadowHeight; 857 kContentShadowHeightAsh : kContentShadowHeight;
850 } 858 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_view.h ('k') | ui/views/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698