| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_mus.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "ui/gfx/canvas.h" | 42 #include "ui/gfx/canvas.h" |
| 43 #include "ui/gfx/geometry/rect_conversions.h" | 43 #include "ui/gfx/geometry/rect_conversions.h" |
| 44 #include "ui/gfx/image/image_skia.h" | 44 #include "ui/gfx/image/image_skia.h" |
| 45 #include "ui/gfx/scoped_canvas.h" | 45 #include "ui/gfx/scoped_canvas.h" |
| 46 #include "ui/views/controls/label.h" | 46 #include "ui/views/controls/label.h" |
| 47 #include "ui/views/layout/layout_constants.h" | 47 #include "ui/views/layout/layout_constants.h" |
| 48 #include "ui/views/mus/window_manager_frame_values.h" | 48 #include "ui/views/mus/window_manager_frame_values.h" |
| 49 #include "ui/views/widget/widget.h" | 49 #include "ui/views/widget/widget.h" |
| 50 #include "ui/views/widget/widget_delegate.h" | 50 #include "ui/views/widget/widget_delegate.h" |
| 51 | 51 |
| 52 #if defined(ENABLE_SUPERVISED_USERS) | |
| 53 #include "chrome/browser/ui/views/profiles/supervised_user_avatar_label.h" | |
| 54 #endif | |
| 55 | |
| 56 namespace { | 52 namespace { |
| 57 | 53 |
| 58 #if defined(FRAME_AVATAR_BUTTON) | 54 #if defined(FRAME_AVATAR_BUTTON) |
| 59 // Space between the new avatar button and the minimize button. | 55 // Space between the new avatar button and the minimize button. |
| 60 const int kNewAvatarButtonOffset = 5; | 56 const int kNewAvatarButtonOffset = 5; |
| 61 #endif | 57 #endif |
| 62 // Space between right edge of tabstrip and maximize button. | 58 // Space between right edge of tabstrip and maximize button. |
| 63 const int kTabstripRightSpacing = 10; | 59 const int kTabstripRightSpacing = 10; |
| 64 // Height of the shadow of the content area, at the top of the toolbar. | 60 // Height of the shadow of the content area, at the top of the toolbar. |
| 65 const int kContentShadowHeight = 1; | 61 const int kContentShadowHeight = 1; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 return HTCLIENT; | 217 return HTCLIENT; |
| 222 } | 218 } |
| 223 #endif | 219 #endif |
| 224 | 220 |
| 225 // See if the point is actually within the web app back button. | 221 // See if the point is actually within the web app back button. |
| 226 if (hit_test == HTCAPTION && web_app_left_header_view_ && | 222 if (hit_test == HTCAPTION && web_app_left_header_view_ && |
| 227 ConvertedHitTest(this, web_app_left_header_view_, point)) { | 223 ConvertedHitTest(this, web_app_left_header_view_, point)) { |
| 228 return HTCLIENT; | 224 return HTCLIENT; |
| 229 } | 225 } |
| 230 | 226 |
| 231 #if defined(ENABLE_SUPERVISED_USERS) | |
| 232 // ...or within the avatar label, if it's a supervised user. | |
| 233 if (hit_test == HTCAPTION && supervised_user_avatar_label() && | |
| 234 ConvertedHitTest(this, supervised_user_avatar_label(), point)) { | |
| 235 return HTCLIENT; | |
| 236 } | |
| 237 #endif | |
| 238 | |
| 239 // When the window is restored we want a large click target above the tabs | 227 // When the window is restored we want a large click target above the tabs |
| 240 // to drag the window, so redirect clicks in the tab's shadow to caption. | 228 // to drag the window, so redirect clicks in the tab's shadow to caption. |
| 241 if (hit_test == HTCLIENT && | 229 if (hit_test == HTCLIENT && |
| 242 !(frame()->IsMaximized() || frame()->IsFullscreen())) { | 230 !(frame()->IsMaximized() || frame()->IsFullscreen())) { |
| 243 // Convert point to client coordinates. | 231 // Convert point to client coordinates. |
| 244 gfx::Point client_point(point); | 232 gfx::Point client_point(point); |
| 245 View::ConvertPointToTarget(this, frame()->client_view(), &client_point); | 233 View::ConvertPointToTarget(this, frame()->client_view(), &client_point); |
| 246 // Report hits in shadow at top of tabstrip as caption. | 234 // Report hits in shadow at top of tabstrip as caption. |
| 247 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); | 235 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); |
| 248 if (client_point.y() < tabstrip_bounds.y() + kTabShadowHeight) | 236 if (client_point.y() < tabstrip_bounds.y() + kTabShadowHeight) |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 } | 650 } |
| 663 | 651 |
| 664 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { | 652 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { |
| 665 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); | 653 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); |
| 666 const int bottom = frame_values().normal_insets.bottom(); | 654 const int bottom = frame_values().normal_insets.bottom(); |
| 667 canvas->FillRect( | 655 canvas->FillRect( |
| 668 gfx::Rect(0, bottom, width(), kClientEdgeThickness), | 656 gfx::Rect(0, bottom, width(), kClientEdgeThickness), |
| 669 GetThemeProvider()->GetColor( | 657 GetThemeProvider()->GetColor( |
| 670 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); | 658 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); |
| 671 } | 659 } |
| OLD | NEW |