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

Side by Side Diff: chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.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: More bauerb comments 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/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 <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" 10 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
11 #include "ash/frame/default_header_painter.h" 11 #include "ash/frame/default_header_painter.h"
12 #include "ash/frame/frame_border_hit_test_controller.h" 12 #include "ash/frame/frame_border_hit_test_controller.h"
13 #include "ash/frame/header_painter_util.h" 13 #include "ash/frame/header_painter_util.h"
14 #include "ash/shell.h" 14 #include "ash/shell.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "chrome/browser/themes/theme_properties.h" 16 #include "chrome/browser/themes/theme_properties.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/views/frame/browser_frame.h" 18 #include "chrome/browser/ui/views/frame/browser_frame.h"
19 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" 19 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h"
20 #include "chrome/browser/ui/views/frame/browser_view.h" 20 #include "chrome/browser/ui/views/frame/browser_view.h"
21 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 21 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
22 #include "chrome/browser/ui/views/profiles/avatar_label.h"
23 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" 22 #include "chrome/browser/ui/views/profiles/avatar_menu_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/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
27 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
28 #include "grit/ash_resources.h" 27 #include "grit/ash_resources.h"
29 #include "grit/theme_resources.h" 28 #include "grit/theme_resources.h"
30 #include "ui/accessibility/ax_view_state.h" 29 #include "ui/accessibility/ax_view_state.h"
31 #include "ui/aura/client/aura_constants.h" 30 #include "ui/aura/client/aura_constants.h"
32 #include "ui/aura/window.h" 31 #include "ui/aura/window.h"
33 #include "ui/base/hit_test.h" 32 #include "ui/base/hit_test.h"
34 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
35 #include "ui/base/layout.h" 34 #include "ui/base/layout.h"
36 #include "ui/base/resource/resource_bundle.h" 35 #include "ui/base/resource/resource_bundle.h"
37 #include "ui/base/theme_provider.h" 36 #include "ui/base/theme_provider.h"
38 #include "ui/compositor/layer_animator.h" 37 #include "ui/compositor/layer_animator.h"
39 #include "ui/gfx/canvas.h" 38 #include "ui/gfx/canvas.h"
40 #include "ui/gfx/image/image_skia.h" 39 #include "ui/gfx/image/image_skia.h"
41 #include "ui/gfx/rect_conversions.h" 40 #include "ui/gfx/rect_conversions.h"
42 #include "ui/views/controls/label.h" 41 #include "ui/views/controls/label.h"
43 #include "ui/views/layout/layout_constants.h" 42 #include "ui/views/layout/layout_constants.h"
44 #include "ui/views/widget/widget.h" 43 #include "ui/views/widget/widget.h"
45 #include "ui/views/widget/widget_delegate.h" 44 #include "ui/views/widget/widget_delegate.h"
46 45
46 #if defined(ENABLE_MANAGED_USERS)
47 #include "chrome/browser/ui/views/profiles/supervised_user_avatar_label.h"
48 #endif
49
47 namespace { 50 namespace {
48 51
49 // The avatar ends 2 px above the bottom of the tabstrip (which, given the 52 // The avatar ends 2 px above the bottom of the tabstrip (which, given the
50 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the 53 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the
51 // user). 54 // user).
52 const int kAvatarBottomSpacing = 2; 55 const int kAvatarBottomSpacing = 2;
53 // There are 2 px on each side of the avatar (between the frame border and 56 // There are 2 px on each side of the avatar (between the frame border and
54 // it on the left, and between it and the tabstrip on the right). 57 // it on the left, and between it and the tabstrip on the right).
55 const int kAvatarSideSpacing = 2; 58 const int kAvatarSideSpacing = 2;
56 // Space between left edge of window and tabstrip. 59 // Space between left edge of window and tabstrip.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 195
193 gfx::Rect BrowserNonClientFrameViewAsh::GetWindowBoundsForClientBounds( 196 gfx::Rect BrowserNonClientFrameViewAsh::GetWindowBoundsForClientBounds(
194 const gfx::Rect& client_bounds) const { 197 const gfx::Rect& client_bounds) const {
195 return client_bounds; 198 return client_bounds;
196 } 199 }
197 200
198 int BrowserNonClientFrameViewAsh::NonClientHitTest(const gfx::Point& point) { 201 int BrowserNonClientFrameViewAsh::NonClientHitTest(const gfx::Point& point) {
199 int hit_test = ash::FrameBorderHitTestController::NonClientHitTest(this, 202 int hit_test = ash::FrameBorderHitTestController::NonClientHitTest(this,
200 caption_button_container_, point); 203 caption_button_container_, point);
201 204
202 // See if the point is actually within the avatar menu button or within 205 // See if the point is actually within the avatar menu button.
203 // the avatar label.
204 if (hit_test == HTCAPTION && ((avatar_button() && 206 if (hit_test == HTCAPTION && ((avatar_button() &&
205 avatar_button()->GetMirroredBounds().Contains(point)) || 207 avatar_button()->GetMirroredBounds().Contains(point))))
206 (avatar_label() && avatar_label()->GetMirroredBounds().Contains(point))))
207 return HTCLIENT; 208 return HTCLIENT;
Bernhard Bauer 2014/07/21 08:55:15 This should be only two spaces indented; sorry I m
mckev 2014/08/05 01:09:14 No problem. I made the change above as well.
209 #if defined(ENABLE_MANAGED_USERS)
210 // ...or within the avatar label, if it's a supervised user.
211 if ((supervised_user_avatar_label() &&
212 supervised_user_avatar_label()->GetMirroredBounds().Contains(point)))
213 return HTCLIENT;
214 #endif
208 215
209 // When the window is restored we want a large click target above the tabs 216 // When the window is restored we want a large click target above the tabs
210 // to drag the window, so redirect clicks in the tab's shadow to caption. 217 // to drag the window, so redirect clicks in the tab's shadow to caption.
211 if (hit_test == HTCLIENT && 218 if (hit_test == HTCLIENT &&
212 !(frame()->IsMaximized() || frame()->IsFullscreen())) { 219 !(frame()->IsMaximized() || frame()->IsFullscreen())) {
213 // Convert point to client coordinates. 220 // Convert point to client coordinates.
214 gfx::Point client_point(point); 221 gfx::Point client_point(point);
215 View::ConvertPointToTarget(this, frame()->client_view(), &client_point); 222 View::ConvertPointToTarget(this, frame()->client_view(), &client_point);
216 // Report hits in shadow at top of tabstrip as caption. 223 // Report hits in shadow at top of tabstrip as caption.
217 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); 224 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds());
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); 541 ThemeProperties::COLOR_TOOLBAR_SEPARATOR));
535 } 542 }
536 543
537 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { 544 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) {
538 DCHECK(!UsePackagedAppHeaderStyle()); 545 DCHECK(!UsePackagedAppHeaderStyle());
539 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), 546 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(),
540 width(), kClientEdgeThickness), 547 width(), kClientEdgeThickness),
541 ThemeProperties::GetDefaultColor( 548 ThemeProperties::GetDefaultColor(
542 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); 549 ThemeProperties::COLOR_TOOLBAR_SEPARATOR));
543 } 550 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698