| 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 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_LAYOUT_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_LAYOUT_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_LAYOUT_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_LAYOUT_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" | 9 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" |
| 10 #include "ui/views/layout/layout_manager.h" | 10 #include "ui/views/layout/layout_manager.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 bool IsTitleBarCondensed() const; | 100 bool IsTitleBarCondensed() const; |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 // Whether a specific button should be inserted on the leading or trailing | 103 // Whether a specific button should be inserted on the leading or trailing |
| 104 // side. | 104 // side. |
| 105 enum ButtonAlignment { | 105 enum ButtonAlignment { |
| 106 ALIGN_LEADING, | 106 ALIGN_LEADING, |
| 107 ALIGN_TRAILING | 107 ALIGN_TRAILING |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 // Determines whether the avatar should be shown on the right side of the tab | 110 // Determines whether the incognito icon should be shown on the right side of |
| 111 // strip (instead of the usual left). | 111 // the tab strip (instead of the usual left). |
| 112 bool ShouldAvatarBeOnRight() const; | 112 bool ShouldIncognitoIconBeOnRight() const; |
| 113 | 113 |
| 114 // Determines the amount of spacing between the New Tab button and the element | 114 // Determines the amount of spacing between the New Tab button and the element |
| 115 // to its immediate right. | 115 // to its immediate right. |
| 116 int NewTabCaptionSpacing() const; | 116 int NewTabCaptionSpacing() const; |
| 117 | 117 |
| 118 // Layout various sub-components of this view. | 118 // Layout various sub-components of this view. |
| 119 void LayoutWindowControls(views::View* host); | 119 void LayoutWindowControls(views::View* host); |
| 120 void LayoutTitleBar(views::View* host); | 120 void LayoutTitleBar(views::View* host); |
| 121 void LayoutAvatar(views::View* host); | 121 void LayoutIncognitoIcon(views::View* host); |
| 122 void LayoutNewStyleAvatar(views::View* host); | 122 void LayoutNewStyleAvatar(views::View* host); |
| 123 | 123 |
| 124 void ConfigureButton(views::View* host, | 124 void ConfigureButton(views::View* host, |
| 125 views::FrameButton button_id, | 125 views::FrameButton button_id, |
| 126 ButtonAlignment align, | 126 ButtonAlignment align, |
| 127 int caption_y); | 127 int caption_y); |
| 128 | 128 |
| 129 // Sets the visibility of all buttons associated with |button_id| to false. | 129 // Sets the visibility of all buttons associated with |button_id| to false. |
| 130 void HideButton(views::FrameButton button_id); | 130 void HideButton(views::FrameButton button_id); |
| 131 | 131 |
| 132 // Adds a window caption button to either the leading or trailing side. | 132 // Adds a window caption button to either the leading or trailing side. |
| 133 void SetBoundsForButton(views::View* host, | 133 void SetBoundsForButton(views::View* host, |
| 134 views::ImageButton* button, | 134 views::ImageButton* button, |
| 135 ButtonAlignment align, | 135 ButtonAlignment align, |
| 136 int caption_y); | 136 int caption_y); |
| 137 | 137 |
| 138 // Internal implementation of ViewAdded() and ViewRemoved(). | 138 // Internal implementation of ViewAdded() and ViewRemoved(). |
| 139 void SetView(int id, views::View* view); | 139 void SetView(int id, views::View* view); |
| 140 | 140 |
| 141 // Overriden from views::LayoutManager: | 141 // Overriden from views::LayoutManager: |
| 142 void Layout(views::View* host) override; | 142 void Layout(views::View* host) override; |
| 143 gfx::Size GetPreferredSize(const views::View* host) const override; | 143 gfx::Size GetPreferredSize(const views::View* host) const override; |
| 144 void ViewAdded(views::View* host, views::View* view) override; | 144 void ViewAdded(views::View* host, views::View* view) override; |
| 145 void ViewRemoved(views::View* host, views::View* view) override; | 145 void ViewRemoved(views::View* host, views::View* view) override; |
| 146 | 146 |
| 147 OpaqueBrowserFrameViewLayoutDelegate* delegate_; | 147 OpaqueBrowserFrameViewLayoutDelegate* delegate_; |
| 148 | 148 |
| 149 // The layout rect of the avatar icon, if visible. | |
| 150 gfx::Rect avatar_bounds_; | |
| 151 | |
| 152 // The bounds of the ClientView. | 149 // The bounds of the ClientView. |
| 153 gfx::Rect client_view_bounds_; | 150 gfx::Rect client_view_bounds_; |
| 154 | 151 |
| 155 // The layout of the window icon, if visible. | 152 // The layout of the window icon, if visible. |
| 156 gfx::Rect window_icon_bounds_; | 153 gfx::Rect window_icon_bounds_; |
| 157 | 154 |
| 158 // How far from the leading/trailing edge of the view the next window control | 155 // How far from the leading/trailing edge of the view the next window control |
| 159 // should be placed. | 156 // should be placed. |
| 160 int leading_button_start_; | 157 int leading_button_start_; |
| 161 int trailing_button_start_; | 158 int trailing_button_start_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 188 AvatarMenuButton* avatar_button_; | 185 AvatarMenuButton* avatar_button_; |
| 189 views::View* new_avatar_button_; | 186 views::View* new_avatar_button_; |
| 190 | 187 |
| 191 std::vector<views::FrameButton> leading_buttons_; | 188 std::vector<views::FrameButton> leading_buttons_; |
| 192 std::vector<views::FrameButton> trailing_buttons_; | 189 std::vector<views::FrameButton> trailing_buttons_; |
| 193 | 190 |
| 194 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameViewLayout); | 191 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameViewLayout); |
| 195 }; | 192 }; |
| 196 | 193 |
| 197 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_LAYOUT_H_ | 194 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_LAYOUT_H_ |
| OLD | NEW |