OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_layout.h" | 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/profiles/profiles_state.h" | 8 #include "chrome/browser/profiles/profiles_state.h" |
9 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | 9 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" |
10 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 10 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 } else { | 384 } else { |
385 // We set the icon bounds to a small rectangle in the top leading corner | 385 // We set the icon bounds to a small rectangle in the top leading corner |
386 // if there are no icons on the leading side. | 386 // if there are no icons on the leading side. |
387 window_icon_bounds_ = gfx::Rect( | 387 window_icon_bounds_ = gfx::Rect( |
388 frame_thickness + kIconLeftSpacing, frame_thickness, size, size); | 388 frame_thickness + kIconLeftSpacing, frame_thickness, size, size); |
389 } | 389 } |
390 } | 390 } |
391 } | 391 } |
392 | 392 |
393 void OpaqueBrowserFrameViewLayout::LayoutNewStyleAvatar(views::View* host) { | 393 void OpaqueBrowserFrameViewLayout::LayoutNewStyleAvatar(views::View* host) { |
394 DCHECK(switches::IsNewAvatarMenu()); | |
395 if (!new_avatar_button_) | 394 if (!new_avatar_button_) |
396 return; | 395 return; |
397 | 396 |
398 int button_width = new_avatar_button_->GetPreferredSize().width(); | 397 int button_width = new_avatar_button_->GetPreferredSize().width(); |
399 int button_width_with_offset = button_width + kNewAvatarButtonOffset; | 398 int button_width_with_offset = button_width + kNewAvatarButtonOffset; |
400 | 399 |
401 int button_x = | 400 int button_x = |
402 host->width() - trailing_button_start_ - button_width_with_offset; | 401 host->width() - trailing_button_start_ - button_width_with_offset; |
403 int button_y = CaptionButtonY(!IsTitleBarCondensed()); | 402 int button_y = CaptionButtonY(!IsTitleBarCondensed()); |
404 | 403 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 has_trailing_buttons_ = false; | 681 has_trailing_buttons_ = false; |
683 | 682 |
684 LayoutWindowControls(host); | 683 LayoutWindowControls(host); |
685 LayoutTitleBar(host); | 684 LayoutTitleBar(host); |
686 | 685 |
687 // We now add a single pixel to the leading spacing. We do this because the | 686 // We now add a single pixel to the leading spacing. We do this because the |
688 // avatar and tab strip start one pixel inward compared to where things start | 687 // avatar and tab strip start one pixel inward compared to where things start |
689 // on the trailing side. | 688 // on the trailing side. |
690 leading_button_start_++; | 689 leading_button_start_++; |
691 | 690 |
692 if (delegate_->IsRegularOrGuestSession() && switches::IsNewAvatarMenu()) | 691 if (delegate_->IsRegularOrGuestSession()) |
693 LayoutNewStyleAvatar(host); | 692 LayoutNewStyleAvatar(host); |
694 else | 693 else |
695 LayoutAvatar(host); | 694 LayoutAvatar(host); |
696 | 695 |
697 client_view_bounds_ = CalculateClientAreaBounds( | 696 client_view_bounds_ = CalculateClientAreaBounds( |
698 host->width(), host->height()); | 697 host->width(), host->height()); |
699 } | 698 } |
700 | 699 |
701 gfx::Size OpaqueBrowserFrameViewLayout::GetPreferredSize( | 700 gfx::Size OpaqueBrowserFrameViewLayout::GetPreferredSize( |
702 const views::View* host) const { | 701 const views::View* host) const { |
703 // This is never used; NonClientView::GetPreferredSize() will be called | 702 // This is never used; NonClientView::GetPreferredSize() will be called |
704 // instead. | 703 // instead. |
705 NOTREACHED(); | 704 NOTREACHED(); |
706 return gfx::Size(); | 705 return gfx::Size(); |
707 } | 706 } |
708 | 707 |
709 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host, | 708 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host, |
710 views::View* view) { | 709 views::View* view) { |
711 SetView(view->id(), view); | 710 SetView(view->id(), view); |
712 } | 711 } |
713 | 712 |
714 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host, | 713 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host, |
715 views::View* view) { | 714 views::View* view) { |
716 SetView(view->id(), nullptr); | 715 SetView(view->id(), nullptr); |
717 } | 716 } |
OLD | NEW |