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

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

Issue 23583037: Added hit test for ChromeOS avatar when visible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style tweak Created 7 years, 3 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/profiles/avatar_menu_model.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/wm/frame_painter.h" 7 #include "ash/wm/frame_painter.h"
8 #include "ash/wm/workspace/frame_caption_button_container_view.h" 8 #include "ash/wm/workspace/frame_caption_button_container_view.h"
9 #include "chrome/browser/themes/theme_properties.h" 9 #include "chrome/browser/themes/theme_properties.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/immersive_fullscreen_configuration.h" 11 #include "chrome/browser/ui/immersive_fullscreen_configuration.h"
12 #include "chrome/browser/ui/views/avatar_label.h"
12 #include "chrome/browser/ui/views/avatar_menu_button.h" 13 #include "chrome/browser/ui/views/avatar_menu_button.h"
13 #include "chrome/browser/ui/views/frame/browser_frame.h" 14 #include "chrome/browser/ui/views/frame/browser_frame.h"
14 #include "chrome/browser/ui/views/frame/browser_view.h" 15 #include "chrome/browser/ui/views/frame/browser_view.h"
15 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 16 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
16 #include "chrome/browser/ui/views/tab_icon_view.h" 17 #include "chrome/browser/ui/views/tab_icon_view.h"
17 #include "chrome/browser/ui/views/tabs/tab_strip.h" 18 #include "chrome/browser/ui/views/tabs/tab_strip.h"
18 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
19 #include "grit/ash_resources.h" 20 #include "grit/ash_resources.h"
20 #include "grit/theme_resources.h" 21 #include "grit/theme_resources.h"
21 #include "ui/aura/client/aura_constants.h" 22 #include "ui/aura/client/aura_constants.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 148
148 gfx::Rect BrowserNonClientFrameViewAsh::GetWindowBoundsForClientBounds( 149 gfx::Rect BrowserNonClientFrameViewAsh::GetWindowBoundsForClientBounds(
149 const gfx::Rect& client_bounds) const { 150 const gfx::Rect& client_bounds) const {
150 int top_height = NonClientTopBorderHeight(false); 151 int top_height = NonClientTopBorderHeight(false);
151 return frame_painter_->GetWindowBoundsForClientBounds(top_height, 152 return frame_painter_->GetWindowBoundsForClientBounds(top_height,
152 client_bounds); 153 client_bounds);
153 } 154 }
154 155
155 int BrowserNonClientFrameViewAsh::NonClientHitTest(const gfx::Point& point) { 156 int BrowserNonClientFrameViewAsh::NonClientHitTest(const gfx::Point& point) {
156 int hit_test = frame_painter_->NonClientHitTest(this, point); 157 int hit_test = frame_painter_->NonClientHitTest(this, point);
158
159 // See if the point is actually within the avatar menu button or within
160 // the avatar label.
161 if (hit_test == HTCAPTION && ((avatar_button() &&
James Cook 2013/09/05 15:15:16 This is fine. Now that I think about it another wa
162 avatar_button()->GetMirroredBounds().Contains(point)) ||
163 (avatar_label() && avatar_label()->GetMirroredBounds().Contains(point))))
164 return HTCLIENT;
165
157 // When the window is restored we want a large click target above the tabs 166 // When the window is restored we want a large click target above the tabs
158 // to drag the window, so redirect clicks in the tab's shadow to caption. 167 // to drag the window, so redirect clicks in the tab's shadow to caption.
159 if (hit_test == HTCLIENT && 168 if (hit_test == HTCLIENT &&
160 !(frame()->IsMaximized() || frame()->IsFullscreen())) { 169 !(frame()->IsMaximized() || frame()->IsFullscreen())) {
161 // Convert point to client coordinates. 170 // Convert point to client coordinates.
162 gfx::Point client_point(point); 171 gfx::Point client_point(point);
163 View::ConvertPointToTarget(this, frame()->client_view(), &client_point); 172 View::ConvertPointToTarget(this, frame()->client_view(), &client_point);
164 // Report hits in shadow at top of tabstrip as caption. 173 // Report hits in shadow at top of tabstrip as caption.
165 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); 174 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds());
166 if (client_point.y() < tabstrip_bounds.y() + kTabShadowHeight) 175 if (client_point.y() < tabstrip_bounds.y() + kTabShadowHeight)
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 int BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImageId() const { 538 int BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImageId() const {
530 ui::ThemeProvider* tp = GetThemeProvider(); 539 ui::ThemeProvider* tp = GetThemeProvider();
531 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && 540 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) &&
532 browser_view()->IsBrowserTypeNormal() && 541 browser_view()->IsBrowserTypeNormal() &&
533 !browser_view()->IsOffTheRecord()) { 542 !browser_view()->IsOffTheRecord()) {
534 return ShouldPaintAsActive() ? 543 return ShouldPaintAsActive() ?
535 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE; 544 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE;
536 } 545 }
537 return 0; 546 return 0;
538 } 547 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/avatar_menu_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698