Chromium Code Reviews| 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 "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/themes/theme_properties.h" | 8 #include "chrome/browser/themes/theme_properties.h" |
| 9 #include "chrome/browser/themes/theme_service_factory.h" | 9 #include "chrome/browser/themes/theme_service_factory.h" |
| 10 #include "chrome/browser/ui/layout_constants.h" | 10 #include "chrome/browser/ui/layout_constants.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 | 148 |
| 149 void OpaqueBrowserFrameView::UpdateThrobber(bool running) { | 149 void OpaqueBrowserFrameView::UpdateThrobber(bool running) { |
| 150 if (window_icon_) | 150 if (window_icon_) |
| 151 window_icon_->Update(); | 151 window_icon_->Update(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 gfx::Size OpaqueBrowserFrameView::GetMinimumSize() const { | 154 gfx::Size OpaqueBrowserFrameView::GetMinimumSize() const { |
| 155 return layout_->GetMinimumSize(width()); | 155 return layout_->GetMinimumSize(width()); |
| 156 } | 156 } |
| 157 | 157 |
| 158 views::View* OpaqueBrowserFrameView::GetProfileSwitcherView() const { | 158 views::MenuButton* OpaqueBrowserFrameView::GetProfileSwitcherButton() const { |
| 159 return profile_switcher_.view(); | 159 return profile_switcher_.button(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 /////////////////////////////////////////////////////////////////////////////// | 162 /////////////////////////////////////////////////////////////////////////////// |
| 163 // OpaqueBrowserFrameView, views::NonClientFrameView implementation: | 163 // OpaqueBrowserFrameView, views::NonClientFrameView implementation: |
| 164 | 164 |
| 165 gfx::Rect OpaqueBrowserFrameView::GetBoundsForClientView() const { | 165 gfx::Rect OpaqueBrowserFrameView::GetBoundsForClientView() const { |
| 166 return layout_->client_view_bounds(); | 166 return layout_->client_view_bounds(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 gfx::Rect OpaqueBrowserFrameView::GetWindowBoundsForClientBounds( | 169 gfx::Rect OpaqueBrowserFrameView::GetWindowBoundsForClientBounds( |
| 170 const gfx::Rect& client_bounds) const { | 170 const gfx::Rect& client_bounds) const { |
| 171 return layout_->GetWindowBoundsForClientBounds(client_bounds); | 171 return layout_->GetWindowBoundsForClientBounds(client_bounds); |
| 172 } | 172 } |
| 173 | 173 |
| 174 bool OpaqueBrowserFrameView::IsWithinAvatarMenuButtons( | 174 bool OpaqueBrowserFrameView::IsWithinAvatarMenuButtons( |
| 175 const gfx::Point& point) const { | 175 const gfx::Point& point) const { |
| 176 if (profile_indicator_icon() && | 176 if (profile_indicator_icon() && |
| 177 profile_indicator_icon()->GetMirroredBounds().Contains(point)) { | 177 profile_indicator_icon()->GetMirroredBounds().Contains(point)) { |
| 178 return true; | 178 return true; |
| 179 } | 179 } |
| 180 if (profile_switcher_.view() && | 180 |
| 181 profile_switcher_.view()->GetMirroredBounds().Contains(point)) { | 181 views::View* button_view = GetProfileSwitcherButton(); |
|
msarda
2017/04/21 09:43:28
Nit: This is just the button, not another view. Co
emx
2017/04/24 16:23:10
Done.
| |
| 182 if (button_view && button_view->GetMirroredBounds().Contains(point)) | |
| 182 return true; | 183 return true; |
| 183 } | |
| 184 | 184 |
| 185 return false; | 185 return false; |
| 186 } | 186 } |
| 187 | 187 |
| 188 int OpaqueBrowserFrameView::NonClientHitTest(const gfx::Point& point) { | 188 int OpaqueBrowserFrameView::NonClientHitTest(const gfx::Point& point) { |
| 189 if (!bounds().Contains(point)) | 189 if (!bounds().Contains(point)) |
| 190 return HTNOWHERE; | 190 return HTNOWHERE; |
| 191 | 191 |
| 192 // See if the point is within the avatar menu button. | 192 // See if the point is within the avatar menu button. |
| 193 if (IsWithinAvatarMenuButtons(point)) | 193 if (IsWithinAvatarMenuButtons(point)) |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 665 gfx::Rect side(x, y, kClientEdgeThickness, h); | 665 gfx::Rect side(x, y, kClientEdgeThickness, h); |
| 666 canvas->FillRect(side, color); | 666 canvas->FillRect(side, color); |
| 667 if (draw_bottom) { | 667 if (draw_bottom) { |
| 668 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness), | 668 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness), |
| 669 kClientEdgeThickness), | 669 kClientEdgeThickness), |
| 670 color); | 670 color); |
| 671 } | 671 } |
| 672 side.Offset(w + kClientEdgeThickness, 0); | 672 side.Offset(w + kClientEdgeThickness, 0); |
| 673 canvas->FillRect(side, color); | 673 canvas->FillRect(side, color); |
| 674 } | 674 } |
| OLD | NEW |