| 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" |
| 11 #include "ui/views/window/frame_buttons.h" | 11 #include "ui/views/window/frame_buttons.h" |
| 12 | 12 |
| 13 class AvatarMenuButton; | 13 class AvatarMenuButton; |
| 14 class NewAvatarButton; | 14 class NewAvatarButton; |
| 15 class OpaqueBrowserFrameViewLayoutDelegate; | 15 class OpaqueBrowserFrameViewLayoutDelegate; |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 class ImageButton; | 18 class CustomButton; |
| 19 class Label; | 19 class Label; |
| 20 } | 20 } |
| 21 | 21 |
| 22 // Calculates the position of the widgets in the opaque browser frame view. | 22 // Calculates the position of the widgets in the opaque browser frame view. |
| 23 // | 23 // |
| 24 // This is separated out for testing reasons. OpaqueBrowserFrameView has tight | 24 // This is separated out for testing reasons. OpaqueBrowserFrameView has tight |
| 25 // dependencies with Browser and classes that depend on Browser. | 25 // dependencies with Browser and classes that depend on Browser. |
| 26 class OpaqueBrowserFrameViewLayout : public views::LayoutManager { | 26 class OpaqueBrowserFrameViewLayout : public views::LayoutManager { |
| 27 public: | 27 public: |
| 28 // Constants used by OpaqueBrowserFrameView as well. | 28 // Constants used by OpaqueBrowserFrameView as well. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 void ConfigureButton(views::View* host, | 137 void ConfigureButton(views::View* host, |
| 138 views::FrameButton button_id, | 138 views::FrameButton button_id, |
| 139 ButtonAlignment align, | 139 ButtonAlignment align, |
| 140 int caption_y); | 140 int caption_y); |
| 141 | 141 |
| 142 // Sets the visibility of all buttons associated with |button_id| to false. | 142 // Sets the visibility of all buttons associated with |button_id| to false. |
| 143 void HideButton(views::FrameButton button_id); | 143 void HideButton(views::FrameButton button_id); |
| 144 | 144 |
| 145 // Adds a window caption button to either the leading or trailing side. | 145 // Adds a window caption button to either the leading or trailing side. |
| 146 void SetBoundsForButton(views::View* host, | 146 void SetBoundsForButton(views::View* host, |
| 147 views::ImageButton* button, | 147 views::CustomButton* button, |
| 148 ButtonAlignment align, | 148 ButtonAlignment align, |
| 149 int caption_y); | 149 int caption_y); |
| 150 | 150 |
| 151 // Internal implementation of ViewAdded() and ViewRemoved(). | 151 // Internal implementation of ViewAdded() and ViewRemoved(). |
| 152 void SetView(int id, views::View* view); | 152 void SetView(int id, views::View* view); |
| 153 | 153 |
| 154 // Overriden from views::LayoutManager: | 154 // Overriden from views::LayoutManager: |
| 155 void Layout(views::View* host) override; | 155 void Layout(views::View* host) override; |
| 156 gfx::Size GetPreferredSize(const views::View* host) const override; | 156 gfx::Size GetPreferredSize(const views::View* host) const override; |
| 157 void ViewAdded(views::View* host, views::View* view) override; | 157 void ViewAdded(views::View* host, views::View* view) override; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 180 bool has_trailing_buttons_; | 180 bool has_trailing_buttons_; |
| 181 | 181 |
| 182 // Extra offset from the top of the frame to the top of the window control | 182 // Extra offset from the top of the frame to the top of the window control |
| 183 // buttons. Configurable based on platform and whether we are under test. | 183 // buttons. Configurable based on platform and whether we are under test. |
| 184 int extra_caption_y_; | 184 int extra_caption_y_; |
| 185 | 185 |
| 186 // Extra offset between the individual window caption buttons. | 186 // Extra offset between the individual window caption buttons. |
| 187 int window_caption_spacing_; | 187 int window_caption_spacing_; |
| 188 | 188 |
| 189 // Window controls. | 189 // Window controls. |
| 190 views::ImageButton* minimize_button_; | 190 views::CustomButton* minimize_button_; |
| 191 views::ImageButton* maximize_button_; | 191 views::CustomButton* maximize_button_; |
| 192 views::ImageButton* restore_button_; | 192 views::CustomButton* restore_button_; |
| 193 views::ImageButton* close_button_; | 193 views::CustomButton* close_button_; |
| 194 | 194 |
| 195 views::View* window_icon_; | 195 views::View* window_icon_; |
| 196 views::Label* window_title_; | 196 views::Label* window_title_; |
| 197 | 197 |
| 198 AvatarMenuButton* avatar_button_; | 198 AvatarMenuButton* avatar_button_; |
| 199 views::View* new_avatar_button_; | 199 views::View* new_avatar_button_; |
| 200 | 200 |
| 201 std::vector<views::FrameButton> leading_buttons_; | 201 std::vector<views::FrameButton> leading_buttons_; |
| 202 std::vector<views::FrameButton> trailing_buttons_; | 202 std::vector<views::FrameButton> trailing_buttons_; |
| 203 | 203 |
| 204 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameViewLayout); | 204 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameViewLayout); |
| 205 }; | 205 }; |
| 206 | 206 |
| 207 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_LAYOUT_H_ | 207 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_LAYOUT_H_ |
| OLD | NEW |