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

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: 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
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 if (hit_test == HTCAPTION) {
160 // See if the point is actually within the avatar menu button or within
161 // the avatar label.
162 if ((avatar_button() &&
James Cook 2013/09/04 23:25:18 Consolidate this with the if() above
michaelpg 2013/09/05 02:42:45 Ok, how's this? Seems to be the least ugly way to
163 avatar_button()->GetMirroredBounds().Contains(point)) ||
164 (avatar_label() && avatar_label()->GetMirroredBounds().Contains(point)))
165 return HTCLIENT;
166 }
167
157 // When the window is restored we want a large click target above the tabs 168 // 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. 169 // to drag the window, so redirect clicks in the tab's shadow to caption.
159 if (hit_test == HTCLIENT && 170 if (hit_test == HTCLIENT &&
160 !(frame()->IsMaximized() || frame()->IsFullscreen())) { 171 !(frame()->IsMaximized() || frame()->IsFullscreen())) {
161 // Convert point to client coordinates. 172 // Convert point to client coordinates.
162 gfx::Point client_point(point); 173 gfx::Point client_point(point);
163 View::ConvertPointToTarget(this, frame()->client_view(), &client_point); 174 View::ConvertPointToTarget(this, frame()->client_view(), &client_point);
164 // Report hits in shadow at top of tabstrip as caption. 175 // Report hits in shadow at top of tabstrip as caption.
165 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); 176 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds());
166 if (client_point.y() < tabstrip_bounds.y() + kTabShadowHeight) 177 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 { 540 int BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImageId() const {
530 ui::ThemeProvider* tp = GetThemeProvider(); 541 ui::ThemeProvider* tp = GetThemeProvider();
531 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && 542 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) &&
532 browser_view()->IsBrowserTypeNormal() && 543 browser_view()->IsBrowserTypeNormal() &&
533 !browser_view()->IsOffTheRecord()) { 544 !browser_view()->IsOffTheRecord()) {
534 return ShouldPaintAsActive() ? 545 return ShouldPaintAsActive() ?
535 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE; 546 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE;
536 } 547 }
537 return 0; 548 return 0;
538 } 549 }
OLDNEW
« chrome/browser/profiles/avatar_menu_model.cc ('K') | « 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