| 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/layout_constants.h" |
| 9 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | 10 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" |
| 10 #include "chrome/browser/ui/views/tabs/tab_strip.h" | |
| 11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 12 #include "components/signin/core/common/profile_management_switches.h" | 12 #include "components/signin/core/common/profile_management_switches.h" |
| 13 #include "ui/gfx/font.h" | 13 #include "ui/gfx/font.h" |
| 14 #include "ui/views/controls/button/image_button.h" | 14 #include "ui/views/controls/button/image_button.h" |
| 15 #include "ui/views/controls/label.h" | 15 #include "ui/views/controls/label.h" |
| 16 | 16 |
| 17 #if defined(ENABLE_SUPERVISED_USERS) | 17 #if defined(ENABLE_SUPERVISED_USERS) |
| 18 #include "chrome/browser/ui/views/profiles/supervised_user_avatar_label.h" | 18 #include "chrome/browser/ui/views/profiles/supervised_user_avatar_label.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 host->width() - trailing_button_start_ - button_width_with_offset; | 400 host->width() - trailing_button_start_ - button_width_with_offset; |
| 401 int button_y = CaptionButtonY(!IsTitleBarCondensed()); | 401 int button_y = CaptionButtonY(!IsTitleBarCondensed()); |
| 402 | 402 |
| 403 minimum_size_for_buttons_ += button_width_with_offset; | 403 minimum_size_for_buttons_ += button_width_with_offset; |
| 404 trailing_button_start_ += button_width_with_offset; | 404 trailing_button_start_ += button_width_with_offset; |
| 405 | 405 |
| 406 // In non-maximized mode, allow the new tab button to completely slide under | 406 // In non-maximized mode, allow the new tab button to completely slide under |
| 407 // the avatar button. | 407 // the avatar button. |
| 408 if (!IsTitleBarCondensed()) { | 408 if (!IsTitleBarCondensed()) { |
| 409 trailing_button_start_ -= | 409 trailing_button_start_ -= |
| 410 TabStrip::kNewTabButtonAssetWidth + kNewTabCaptionNormalSpacing; | 410 GetLayoutConstant(NEW_TAB_BUTTON_WIDTH) + kNewTabCaptionNormalSpacing; |
| 411 } | 411 } |
| 412 | 412 |
| 413 // Do not include the 1px padding that is added for the caption buttons. | 413 // Do not include the 1px padding that is added for the caption buttons. |
| 414 new_avatar_button_->SetBounds( | 414 new_avatar_button_->SetBounds( |
| 415 button_x, button_y, button_width, kCaptionButtonHeightWithPadding - 1); | 415 button_x, button_y, button_width, kCaptionButtonHeightWithPadding - 1); |
| 416 } | 416 } |
| 417 | 417 |
| 418 void OpaqueBrowserFrameViewLayout::LayoutAvatar(views::View* host) { | 418 void OpaqueBrowserFrameViewLayout::LayoutAvatar(views::View* host) { |
| 419 // Even though the avatar is used for both incognito and profiles we always | 419 // Even though the avatar is used for both incognito and profiles we always |
| 420 // use the incognito icon to layout the avatar button. The profile icon | 420 // use the incognito icon to layout the avatar button. The profile icon |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 | 706 |
| 707 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host, | 707 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host, |
| 708 views::View* view) { | 708 views::View* view) { |
| 709 SetView(view->id(), view); | 709 SetView(view->id(), view); |
| 710 } | 710 } |
| 711 | 711 |
| 712 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host, | 712 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host, |
| 713 views::View* view) { | 713 views::View* view) { |
| 714 SetView(view->id(), nullptr); | 714 SetView(view->id(), nullptr); |
| 715 } | 715 } |
| OLD | NEW |