| OLD | NEW |
| 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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "ui/views/controls/button/image_button.h" | 46 #include "ui/views/controls/button/image_button.h" |
| 47 #include "ui/views/controls/image_view.h" | 47 #include "ui/views/controls/image_view.h" |
| 48 #include "ui/views/controls/label.h" | 48 #include "ui/views/controls/label.h" |
| 49 #include "ui/views/layout/layout_constants.h" | 49 #include "ui/views/layout/layout_constants.h" |
| 50 #include "ui/views/resources/grit/views_resources.h" | 50 #include "ui/views/resources/grit/views_resources.h" |
| 51 #include "ui/views/views_delegate.h" | 51 #include "ui/views/views_delegate.h" |
| 52 #include "ui/views/widget/root_view.h" | 52 #include "ui/views/widget/root_view.h" |
| 53 #include "ui/views/window/frame_background.h" | 53 #include "ui/views/window/frame_background.h" |
| 54 #include "ui/views/window/window_shape.h" | 54 #include "ui/views/window/window_shape.h" |
| 55 | 55 |
| 56 #if defined(ENABLE_SUPERVISED_USERS) | |
| 57 #include "chrome/browser/ui/views/profiles/supervised_user_avatar_label.h" | |
| 58 #endif | |
| 59 | |
| 60 #if defined(OS_LINUX) | 56 #if defined(OS_LINUX) |
| 61 #include "ui/views/controls/menu/menu_runner.h" | 57 #include "ui/views/controls/menu/menu_runner.h" |
| 62 #endif | 58 #endif |
| 63 | 59 |
| 64 using content::WebContents; | 60 using content::WebContents; |
| 65 | 61 |
| 66 namespace { | 62 namespace { |
| 67 | 63 |
| 68 // While resize areas on Windows are normally the same size as the window | 64 // While resize areas on Windows are normally the same size as the window |
| 69 // borders, our top area is shrunk by 1 px to make it easier to move the window | 65 // borders, our top area is shrunk by 1 px to make it easier to move the window |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 return false; | 209 return false; |
| 214 } | 210 } |
| 215 | 211 |
| 216 int OpaqueBrowserFrameView::NonClientHitTest(const gfx::Point& point) { | 212 int OpaqueBrowserFrameView::NonClientHitTest(const gfx::Point& point) { |
| 217 if (!bounds().Contains(point)) | 213 if (!bounds().Contains(point)) |
| 218 return HTNOWHERE; | 214 return HTNOWHERE; |
| 219 | 215 |
| 220 // See if the point is within the avatar menu button. | 216 // See if the point is within the avatar menu button. |
| 221 if (IsWithinAvatarMenuButtons(point)) | 217 if (IsWithinAvatarMenuButtons(point)) |
| 222 return HTCLIENT; | 218 return HTCLIENT; |
| 223 #if defined(ENABLE_SUPERVISED_USERS) | |
| 224 // ...or within the avatar label, if it's a supervised user. | |
| 225 if ((supervised_user_avatar_label() && | |
| 226 supervised_user_avatar_label()->GetMirroredBounds().Contains(point))) | |
| 227 return HTCLIENT; | |
| 228 #endif | |
| 229 | 219 |
| 230 int frame_component = frame()->client_view()->NonClientHitTest(point); | 220 int frame_component = frame()->client_view()->NonClientHitTest(point); |
| 231 | 221 |
| 232 // See if we're in the sysmenu region. We still have to check the tabstrip | 222 // See if we're in the sysmenu region. We still have to check the tabstrip |
| 233 // first so that clicks in a tab don't get treated as sysmenu clicks. | 223 // first so that clicks in a tab don't get treated as sysmenu clicks. |
| 234 gfx::Rect sysmenu_rect(IconBounds()); | 224 gfx::Rect sysmenu_rect(IconBounds()); |
| 235 // In maximized mode we extend the rect to the screen corner to take advantage | 225 // In maximized mode we extend the rect to the screen corner to take advantage |
| 236 // of Fitts' Law. | 226 // of Fitts' Law. |
| 237 if (layout_->IsTitleBarCondensed()) | 227 if (layout_->IsTitleBarCondensed()) |
| 238 sysmenu_rect.SetRect(0, 0, sysmenu_rect.right(), sysmenu_rect.bottom()); | 228 sysmenu_rect.SetRect(0, 0, sysmenu_rect.right(), sysmenu_rect.bottom()); |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 // images because the images are meant to alpha-blend atop the frame whereas | 816 // images because the images are meant to alpha-blend atop the frame whereas |
| 827 // these rects are meant to be fully opaque, without anything overlaid. | 817 // these rects are meant to be fully opaque, without anything overlaid. |
| 828 gfx::Rect side(x - kClientEdgeThickness, y, kClientEdgeThickness, | 818 gfx::Rect side(x - kClientEdgeThickness, y, kClientEdgeThickness, |
| 829 bottom + kClientEdgeThickness - y); | 819 bottom + kClientEdgeThickness - y); |
| 830 canvas->FillRect(side, toolbar_color); | 820 canvas->FillRect(side, toolbar_color); |
| 831 canvas->FillRect(gfx::Rect(x, bottom, w, kClientEdgeThickness), | 821 canvas->FillRect(gfx::Rect(x, bottom, w, kClientEdgeThickness), |
| 832 toolbar_color); | 822 toolbar_color); |
| 833 side.set_x(right); | 823 side.set_x(right); |
| 834 canvas->FillRect(side, toolbar_color); | 824 canvas->FillRect(side, toolbar_color); |
| 835 } | 825 } |
| OLD | NEW |