| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 return layout_->client_view_bounds(); | 181 return layout_->client_view_bounds(); |
| 182 } | 182 } |
| 183 | 183 |
| 184 gfx::Rect OpaqueBrowserFrameView::GetWindowBoundsForClientBounds( | 184 gfx::Rect OpaqueBrowserFrameView::GetWindowBoundsForClientBounds( |
| 185 const gfx::Rect& client_bounds) const { | 185 const gfx::Rect& client_bounds) const { |
| 186 return layout_->GetWindowBoundsForClientBounds(client_bounds); | 186 return layout_->GetWindowBoundsForClientBounds(client_bounds); |
| 187 } | 187 } |
| 188 | 188 |
| 189 bool OpaqueBrowserFrameView::IsWithinAvatarMenuButtons( | 189 bool OpaqueBrowserFrameView::IsWithinAvatarMenuButtons( |
| 190 const gfx::Point& point) const { | 190 const gfx::Point& point) const { |
| 191 if (profile_indicator_icon() && | 191 return profile_indicator_icon() && |
| 192 profile_indicator_icon()->GetMirroredBounds().Contains(point)) { | 192 profile_indicator_icon()->GetMirroredBounds().Contains(point); |
| 193 return true; | |
| 194 } | |
| 195 if (profile_switcher_.view() && | |
| 196 profile_switcher_.view()->GetMirroredBounds().Contains(point)) { | |
| 197 return true; | |
| 198 } | |
| 199 | |
| 200 return false; | |
| 201 } | 193 } |
| 202 | 194 |
| 203 int OpaqueBrowserFrameView::NonClientHitTest(const gfx::Point& point) { | 195 int OpaqueBrowserFrameView::NonClientHitTest(const gfx::Point& point) { |
| 204 if (!bounds().Contains(point)) | 196 if (!bounds().Contains(point)) |
| 205 return HTNOWHERE; | 197 return HTNOWHERE; |
| 206 | 198 |
| 207 // See if the point is within the avatar menu button. | 199 // See if the point is within the avatar menu button or profile switcher. |
| 208 if (IsWithinAvatarMenuButtons(point)) | 200 if (profile_switcher_.HitTest(point) || IsWithinAvatarMenuButtons(point)) |
| 209 return HTCLIENT; | 201 return HTCLIENT; |
| 210 | 202 |
| 211 int frame_component = frame()->client_view()->NonClientHitTest(point); | 203 int frame_component = frame()->client_view()->NonClientHitTest(point); |
| 212 | 204 |
| 213 // See if we're in the sysmenu region. We still have to check the tabstrip | 205 // See if we're in the sysmenu region. We still have to check the tabstrip |
| 214 // first so that clicks in a tab don't get treated as sysmenu clicks. | 206 // first so that clicks in a tab don't get treated as sysmenu clicks. |
| 215 gfx::Rect sysmenu_rect(IconBounds()); | 207 gfx::Rect sysmenu_rect(IconBounds()); |
| 216 // In maximized mode we extend the rect to the screen corner to take advantage | 208 // In maximized mode we extend the rect to the screen corner to take advantage |
| 217 // of Fitts' Law. | 209 // of Fitts' Law. |
| 218 if (layout_->IsTitleBarCondensed()) | 210 if (layout_->IsTitleBarCondensed()) |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 gfx::Rect side(x, y, kClientEdgeThickness, h); | 814 gfx::Rect side(x, y, kClientEdgeThickness, h); |
| 823 canvas->FillRect(side, color); | 815 canvas->FillRect(side, color); |
| 824 if (draw_bottom) { | 816 if (draw_bottom) { |
| 825 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness), | 817 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness), |
| 826 kClientEdgeThickness), | 818 kClientEdgeThickness), |
| 827 color); | 819 color); |
| 828 } | 820 } |
| 829 side.Offset(w + kClientEdgeThickness, 0); | 821 side.Offset(w + kClientEdgeThickness, 0); |
| 830 canvas->FillRect(side, color); | 822 canvas->FillRect(side, color); |
| 831 } | 823 } |
| OLD | NEW |