| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_layout_constants.h" | 9 #include "ash/ash_layout_constants.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" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "ui/compositor/layer_animator.h" | 45 #include "ui/compositor/layer_animator.h" |
| 46 #include "ui/gfx/canvas.h" | 46 #include "ui/gfx/canvas.h" |
| 47 #include "ui/gfx/geometry/rect_conversions.h" | 47 #include "ui/gfx/geometry/rect_conversions.h" |
| 48 #include "ui/gfx/image/image_skia.h" | 48 #include "ui/gfx/image/image_skia.h" |
| 49 #include "ui/gfx/scoped_canvas.h" | 49 #include "ui/gfx/scoped_canvas.h" |
| 50 #include "ui/views/controls/label.h" | 50 #include "ui/views/controls/label.h" |
| 51 #include "ui/views/layout/layout_constants.h" | 51 #include "ui/views/layout/layout_constants.h" |
| 52 #include "ui/views/widget/widget.h" | 52 #include "ui/views/widget/widget.h" |
| 53 #include "ui/views/widget/widget_delegate.h" | 53 #include "ui/views/widget/widget_delegate.h" |
| 54 | 54 |
| 55 #if defined(ENABLE_SUPERVISED_USERS) | |
| 56 #include "chrome/browser/ui/views/profiles/supervised_user_avatar_label.h" | |
| 57 #endif | |
| 58 | |
| 59 namespace { | 55 namespace { |
| 60 | 56 |
| 61 #if defined(FRAME_AVATAR_BUTTON) | 57 #if defined(FRAME_AVATAR_BUTTON) |
| 62 // Space between the new avatar button and the minimize button. | 58 // Space between the new avatar button and the minimize button. |
| 63 const int kNewAvatarButtonOffset = 5; | 59 const int kNewAvatarButtonOffset = 5; |
| 64 #endif | 60 #endif |
| 65 // Space between right edge of tabstrip and maximize button. | 61 // Space between right edge of tabstrip and maximize button. |
| 66 const int kTabstripRightSpacing = 10; | 62 const int kTabstripRightSpacing = 10; |
| 67 // Height of the shadow of the content area, at the top of the toolbar. | 63 // Height of the shadow of the content area, at the top of the toolbar. |
| 68 const int kContentShadowHeight = 1; | 64 const int kContentShadowHeight = 1; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 return HTCLIENT; | 248 return HTCLIENT; |
| 253 } | 249 } |
| 254 #endif | 250 #endif |
| 255 | 251 |
| 256 // See if the point is actually within the web app back button. | 252 // See if the point is actually within the web app back button. |
| 257 if (hit_test == HTCAPTION && web_app_left_header_view_ && | 253 if (hit_test == HTCAPTION && web_app_left_header_view_ && |
| 258 ConvertedHitTest(this, web_app_left_header_view_, point)) { | 254 ConvertedHitTest(this, web_app_left_header_view_, point)) { |
| 259 return HTCLIENT; | 255 return HTCLIENT; |
| 260 } | 256 } |
| 261 | 257 |
| 262 #if defined(ENABLE_SUPERVISED_USERS) | |
| 263 // ...or within the avatar label, if it's a supervised user. | |
| 264 if (hit_test == HTCAPTION && supervised_user_avatar_label() && | |
| 265 ConvertedHitTest(this, supervised_user_avatar_label(), point)) { | |
| 266 return HTCLIENT; | |
| 267 } | |
| 268 #endif | |
| 269 | |
| 270 // When the window is restored we want a large click target above the tabs | 258 // When the window is restored we want a large click target above the tabs |
| 271 // to drag the window, so redirect clicks in the tab's shadow to caption. | 259 // to drag the window, so redirect clicks in the tab's shadow to caption. |
| 272 if (hit_test == HTCLIENT && | 260 if (hit_test == HTCLIENT && |
| 273 !(frame()->IsMaximized() || frame()->IsFullscreen())) { | 261 !(frame()->IsMaximized() || frame()->IsFullscreen())) { |
| 274 // Convert point to client coordinates. | 262 // Convert point to client coordinates. |
| 275 gfx::Point client_point(point); | 263 gfx::Point client_point(point); |
| 276 View::ConvertPointToTarget(this, frame()->client_view(), &client_point); | 264 View::ConvertPointToTarget(this, frame()->client_view(), &client_point); |
| 277 // Report hits in shadow at top of tabstrip as caption. | 265 // Report hits in shadow at top of tabstrip as caption. |
| 278 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); | 266 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); |
| 279 if (client_point.y() < tabstrip_bounds.y() + kTabShadowHeight) | 267 if (client_point.y() < tabstrip_bounds.y() + kTabShadowHeight) |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 } | 717 } |
| 730 | 718 |
| 731 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { | 719 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { |
| 732 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); | 720 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); |
| 733 canvas->FillRect( | 721 canvas->FillRect( |
| 734 gfx::Rect(0, caption_button_container_->bounds().bottom(), width(), | 722 gfx::Rect(0, caption_button_container_->bounds().bottom(), width(), |
| 735 kClientEdgeThickness), | 723 kClientEdgeThickness), |
| 736 GetThemeProvider()->GetColor( | 724 GetThemeProvider()->GetColor( |
| 737 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); | 725 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); |
| 738 } | 726 } |
| OLD | NEW |