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

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

Issue 355233002: Fix build when ENABLE_MANAGED_USERS is not defined (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits, minor refactoring 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
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/opaque_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/profiles/profiles_state.h" 14 #include "chrome/browser/profiles/profiles_state.h"
15 #include "chrome/browser/signin/signin_header_helper.h" 15 #include "chrome/browser/signin/signin_header_helper.h"
16 #include "chrome/browser/themes/theme_properties.h" 16 #include "chrome/browser/themes/theme_properties.h"
17 #include "chrome/browser/ui/views/frame/browser_frame.h" 17 #include "chrome/browser/ui/views/frame/browser_frame.h"
18 #include "chrome/browser/ui/views/frame/browser_view.h" 18 #include "chrome/browser/ui/views/frame/browser_view.h"
19 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" 19 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h"
20 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_platform_speci fic.h" 20 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_platform_speci fic.h"
21 #include "chrome/browser/ui/views/profiles/avatar_label.h"
22 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" 21 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h"
23 #include "chrome/browser/ui/views/profiles/new_avatar_button.h" 22 #include "chrome/browser/ui/views/profiles/new_avatar_button.h"
24 #include "chrome/browser/ui/views/tab_icon_view.h" 23 #include "chrome/browser/ui/views/tab_icon_view.h"
25 #include "chrome/browser/ui/views/tabs/tab_strip.h" 24 #include "chrome/browser/ui/views/tabs/tab_strip.h"
26 #include "chrome/browser/ui/views/theme_image_mapper.h" 25 #include "chrome/browser/ui/views/theme_image_mapper.h"
27 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 26 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
28 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
29 #include "components/signin/core/common/profile_management_switches.h" 28 #include "components/signin/core/common/profile_management_switches.h"
30 #include "content/public/browser/notification_service.h" 29 #include "content/public/browser/notification_service.h"
31 #include "content/public/browser/web_contents.h" 30 #include "content/public/browser/web_contents.h"
(...skipping 14 matching lines...) Expand all
46 #include "ui/gfx/rect_conversions.h" 45 #include "ui/gfx/rect_conversions.h"
47 #include "ui/views/controls/button/image_button.h" 46 #include "ui/views/controls/button/image_button.h"
48 #include "ui/views/controls/image_view.h" 47 #include "ui/views/controls/image_view.h"
49 #include "ui/views/controls/label.h" 48 #include "ui/views/controls/label.h"
50 #include "ui/views/layout/layout_constants.h" 49 #include "ui/views/layout/layout_constants.h"
51 #include "ui/views/views_delegate.h" 50 #include "ui/views/views_delegate.h"
52 #include "ui/views/widget/root_view.h" 51 #include "ui/views/widget/root_view.h"
53 #include "ui/views/window/frame_background.h" 52 #include "ui/views/window/frame_background.h"
54 #include "ui/views/window/window_shape.h" 53 #include "ui/views/window/window_shape.h"
55 54
55 #if defined(ENABLE_MANAGED_USERS)
56 #include "chrome/browser/ui/views/profiles/supervised_user_avatar_label.h"
57 #endif
58
56 #if defined(OS_LINUX) 59 #if defined(OS_LINUX)
57 #include "ui/views/controls/menu/menu_runner.h" 60 #include "ui/views/controls/menu/menu_runner.h"
58 #endif 61 #endif
59 62
60 using content::WebContents; 63 using content::WebContents;
61 64
62 namespace { 65 namespace {
63 66
64 // While resize areas on Windows are normally the same size as the window 67 // While resize areas on Windows are normally the same size as the window
65 // borders, our top area is shrunk by 1 px to make it easier to move the window 68 // borders, our top area is shrunk by 1 px to make it easier to move the window
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 201
199 gfx::Rect OpaqueBrowserFrameView::GetBoundsForClientView() const { 202 gfx::Rect OpaqueBrowserFrameView::GetBoundsForClientView() const {
200 return layout_->client_view_bounds(); 203 return layout_->client_view_bounds();
201 } 204 }
202 205
203 gfx::Rect OpaqueBrowserFrameView::GetWindowBoundsForClientBounds( 206 gfx::Rect OpaqueBrowserFrameView::GetWindowBoundsForClientBounds(
204 const gfx::Rect& client_bounds) const { 207 const gfx::Rect& client_bounds) const {
205 return layout_->GetWindowBoundsForClientBounds(client_bounds); 208 return layout_->GetWindowBoundsForClientBounds(client_bounds);
206 } 209 }
207 210
211 bool OpaqueBrowserFrameView::IsWithinAvatarMenuButtons(
212 const gfx::Point& point) const {
213 return (avatar_button() &&
214 (avatar_button()->GetMirroredBounds().Contains(point))) ||
Bernhard Bauer 2014/07/14 16:39:05 Consider also splitting this up into two checks.
mckev 2014/07/14 23:50:03 OK - I took a stab at it. Let me know what you th
Bernhard Bauer 2014/07/16 09:53:59 You can simplify this with multiple returns: if
215 (new_avatar_button() &&
216 new_avatar_button()->GetMirroredBounds().Contains(point));
217 }
218
208 int OpaqueBrowserFrameView::NonClientHitTest(const gfx::Point& point) { 219 int OpaqueBrowserFrameView::NonClientHitTest(const gfx::Point& point) {
209 if (!bounds().Contains(point)) 220 if (!bounds().Contains(point))
210 return HTNOWHERE; 221 return HTNOWHERE;
211 222
212 // See if the point is within the avatar menu button or within the avatar 223 // See if the point is within the avatar menu button or within the avatar
213 // label. 224 // label.
214 if ((avatar_button() && 225 #if defined(ENABLE_MANAGED_USERS)
215 avatar_button()->GetMirroredBounds().Contains(point)) || 226 if (IsWithinAvatarMenuButtons(point) ||
Bernhard Bauer 2014/07/14 16:39:05 Same here.
mckev 2014/07/14 23:50:03 Sure thing, makes sense since I made a similar cha
216 (avatar_label() && avatar_label()->GetMirroredBounds().Contains(point)) || 227 (supervised_user_avatar_label() &&
217 (new_avatar_button() && 228 supervised_user_avatar_label()->GetMirroredBounds().Contains(point)))
218 new_avatar_button()->GetMirroredBounds().Contains(point)))
219 return HTCLIENT; 229 return HTCLIENT;
230 #else
231 if (IsWithinAvatarMenuButtons(point))
232 return HTCLIENT;
233 #endif
220 234
221 int frame_component = frame()->client_view()->NonClientHitTest(point); 235 int frame_component = frame()->client_view()->NonClientHitTest(point);
222 236
223 // See if we're in the sysmenu region. We still have to check the tabstrip 237 // See if we're in the sysmenu region. We still have to check the tabstrip
224 // first so that clicks in a tab don't get treated as sysmenu clicks. 238 // first so that clicks in a tab don't get treated as sysmenu clicks.
225 gfx::Rect sysmenu_rect(IconBounds()); 239 gfx::Rect sysmenu_rect(IconBounds());
226 // In maximized mode we extend the rect to the screen corner to take advantage 240 // In maximized mode we extend the rect to the screen corner to take advantage
227 // of Fitts' Law. 241 // of Fitts' Law.
228 if (layout_->IsTitleBarCondensed()) 242 if (layout_->IsTitleBarCondensed())
229 sysmenu_rect.SetRect(0, 0, sysmenu_rect.right(), sysmenu_rect.bottom()); 243 sysmenu_rect.SetRect(0, 0, sysmenu_rect.right(), sysmenu_rect.bottom());
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 916
903 int OpaqueBrowserFrameView::GetTopAreaHeight() const { 917 int OpaqueBrowserFrameView::GetTopAreaHeight() const {
904 gfx::ImageSkia* frame_image = GetFrameImage(); 918 gfx::ImageSkia* frame_image = GetFrameImage();
905 int top_area_height = frame_image->height(); 919 int top_area_height = frame_image->height();
906 if (browser_view()->IsTabStripVisible()) { 920 if (browser_view()->IsTabStripVisible()) {
907 top_area_height = std::max(top_area_height, 921 top_area_height = std::max(top_area_height,
908 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom()); 922 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom());
909 } 923 }
910 return top_area_height; 924 return top_area_height;
911 } 925 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698