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/glass_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 266 |
267 void GlassBrowserFrameView::Layout() { | 267 void GlassBrowserFrameView::Layout() { |
268 if (browser_view()->IsRegularOrGuestSession() && switches::IsNewAvatarMenu()) | 268 if (browser_view()->IsRegularOrGuestSession() && switches::IsNewAvatarMenu()) |
269 LayoutNewStyleAvatar(); | 269 LayoutNewStyleAvatar(); |
270 else | 270 else |
271 LayoutAvatar(); | 271 LayoutAvatar(); |
272 | 272 |
273 LayoutClientView(); | 273 LayoutClientView(); |
274 } | 274 } |
275 | 275 |
276 bool GlassBrowserFrameView::HitTestRect(const gfx::Rect& rect) const { | |
277 bool hit_avatar_button = avatar_button() && | |
278 avatar_button()->GetMirroredBounds().Intersects(rect); | |
279 bool hit_new_avatar_button = new_avatar_button() && | |
280 new_avatar_button()->GetMirroredBounds().Intersects(rect); | |
281 return hit_avatar_button || hit_new_avatar_button || | |
282 !frame()->client_view()->bounds().Intersects(rect); | |
283 } | |
284 | |
285 /////////////////////////////////////////////////////////////////////////////// | 276 /////////////////////////////////////////////////////////////////////////////// |
286 // GlassBrowserFrameView, views::ButtonListener overrides: | 277 // GlassBrowserFrameView, views::ButtonListener overrides: |
287 void GlassBrowserFrameView::ButtonPressed(views::Button* sender, | 278 void GlassBrowserFrameView::ButtonPressed(views::Button* sender, |
288 const ui::Event& event) { | 279 const ui::Event& event) { |
289 if (sender == new_avatar_button()) { | 280 if (sender == new_avatar_button()) { |
290 browser_view()->ShowAvatarBubbleFromAvatarButton( | 281 browser_view()->ShowAvatarBubbleFromAvatarButton( |
291 BrowserWindow::AVATAR_BUBBLE_MODE_DEFAULT, | 282 BrowserWindow::AVATAR_BUBBLE_MODE_DEFAULT, |
292 signin::ManageAccountsParams()); | 283 signin::ManageAccountsParams()); |
293 } | 284 } |
294 } | 285 } |
295 | 286 |
296 /////////////////////////////////////////////////////////////////////////////// | 287 /////////////////////////////////////////////////////////////////////////////// |
297 // GlassBrowserFrameView, private: | 288 // GlassBrowserFrameView, private: |
298 | 289 |
| 290 // views::NonClientFrameView: |
| 291 bool GlassBrowserFrameView::DoesIntersectRect(const views::View* target, |
| 292 const gfx::Rect& rect) const { |
| 293 CHECK_EQ(target, this); |
| 294 bool hit_avatar_button = avatar_button() && |
| 295 avatar_button()->GetMirroredBounds().Intersects(rect); |
| 296 bool hit_new_avatar_button = new_avatar_button() && |
| 297 new_avatar_button()->GetMirroredBounds().Intersects(rect); |
| 298 return hit_avatar_button || hit_new_avatar_button || |
| 299 !frame()->client_view()->bounds().Intersects(rect); |
| 300 } |
| 301 |
299 int GlassBrowserFrameView::FrameBorderThickness() const { | 302 int GlassBrowserFrameView::FrameBorderThickness() const { |
300 return (frame()->IsMaximized() || frame()->IsFullscreen()) ? | 303 return (frame()->IsMaximized() || frame()->IsFullscreen()) ? |
301 0 : gfx::win::GetSystemMetricsInDIP(SM_CXSIZEFRAME); | 304 0 : gfx::win::GetSystemMetricsInDIP(SM_CXSIZEFRAME); |
302 } | 305 } |
303 | 306 |
304 int GlassBrowserFrameView::NonClientBorderThickness() const { | 307 int GlassBrowserFrameView::NonClientBorderThickness() const { |
305 if (frame()->IsMaximized() || frame()->IsFullscreen()) | 308 if (frame()->IsMaximized() || frame()->IsFullscreen()) |
306 return 0; | 309 return 0; |
307 | 310 |
308 return kNonClientBorderThickness; | 311 return kNonClientBorderThickness; |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 static bool initialized = false; | 589 static bool initialized = false; |
587 if (!initialized) { | 590 if (!initialized) { |
588 for (int i = 0; i < kThrobberIconCount; ++i) { | 591 for (int i = 0; i < kThrobberIconCount; ++i) { |
589 throbber_icons_[i] = | 592 throbber_icons_[i] = |
590 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); | 593 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); |
591 DCHECK(throbber_icons_[i]); | 594 DCHECK(throbber_icons_[i]); |
592 } | 595 } |
593 initialized = true; | 596 initialized = true; |
594 } | 597 } |
595 } | 598 } |
OLD | NEW |