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/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | 10 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 window_title_->SetVisible(delegate_->ShouldShowWindowTitle()); | 195 window_title_->SetVisible(delegate_->ShouldShowWindowTitle()); |
196 window_title_->SetEnabledColor(SK_ColorWHITE); | 196 window_title_->SetEnabledColor(SK_ColorWHITE); |
197 window_title_->SetSubpixelRenderingEnabled(false); | 197 window_title_->SetSubpixelRenderingEnabled(false); |
198 window_title_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 198 window_title_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
199 window_title_->set_id(VIEW_ID_WINDOW_TITLE); | 199 window_title_->set_id(VIEW_ID_WINDOW_TITLE); |
200 root_view_->AddChildView(window_title_); | 200 root_view_->AddChildView(window_title_); |
201 } | 201 } |
202 | 202 |
203 void AddAvatarButton() { | 203 void AddAvatarButton() { |
204 // Disable the New Avatar Menu. | 204 // Disable the New Avatar Menu. |
205 switches::DisableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); | 205 switches::DisableNewAvatarMenuForTesting( |
| 206 base::CommandLine::ForCurrentProcess()); |
206 | 207 |
207 menu_button_ = new AvatarMenuButton(nullptr, false); | 208 menu_button_ = new AvatarMenuButton(nullptr, false); |
208 menu_button_->set_id(VIEW_ID_AVATAR_BUTTON); | 209 menu_button_->set_id(VIEW_ID_AVATAR_BUTTON); |
209 delegate_->SetShouldShowAvatar(true); | 210 delegate_->SetShouldShowAvatar(true); |
210 root_view_->AddChildView(menu_button_); | 211 root_view_->AddChildView(menu_button_); |
211 } | 212 } |
212 | 213 |
213 #if defined(ENABLE_SUPERVISED_USERS) | 214 #if defined(ENABLE_SUPERVISED_USERS) |
214 void AddSupervisedUserAvatarLabel() { | 215 void AddSupervisedUserAvatarLabel() { |
215 supervised_user_avatar_label_ = new SupervisedUserAvatarLabel(nullptr); | 216 supervised_user_avatar_label_ = new SupervisedUserAvatarLabel(nullptr); |
216 supervised_user_avatar_label_->set_id(VIEW_ID_SUPERVISED_USER_AVATAR_LABEL); | 217 supervised_user_avatar_label_->set_id(VIEW_ID_SUPERVISED_USER_AVATAR_LABEL); |
217 root_view_->AddChildView(supervised_user_avatar_label_); | 218 root_view_->AddChildView(supervised_user_avatar_label_); |
218 | 219 |
219 // The avatar label should only be used together with the avatar button. | 220 // The avatar label should only be used together with the avatar button. |
220 AddAvatarButton(); | 221 AddAvatarButton(); |
221 } | 222 } |
222 #endif | 223 #endif |
223 | 224 |
224 void AddNewAvatarButton() { | 225 void AddNewAvatarButton() { |
225 // Enable the New Avatar Menu. | 226 // Enable the New Avatar Menu. |
226 switches::EnableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); | 227 switches::EnableNewAvatarMenuForTesting( |
| 228 base::CommandLine::ForCurrentProcess()); |
227 | 229 |
228 new_avatar_button_ = | 230 new_avatar_button_ = |
229 new views::MenuButton(nullptr, base::string16(), nullptr, false); | 231 new views::MenuButton(nullptr, base::string16(), nullptr, false); |
230 new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON); | 232 new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON); |
231 root_view_->AddChildView(new_avatar_button_); | 233 root_view_->AddChildView(new_avatar_button_); |
232 } | 234 } |
233 | 235 |
234 void ExpectBasicWindowBounds() { | 236 void ExpectBasicWindowBounds() { |
235 EXPECT_EQ("428,1 25x18", maximize_button_->bounds().ToString()); | 237 EXPECT_EQ("428,1 25x18", maximize_button_->bounds().ToString()); |
236 EXPECT_EQ("402,1 26x18", minimize_button_->bounds().ToString()); | 238 EXPECT_EQ("402,1 26x18", minimize_button_->bounds().ToString()); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 // both are displayed on the left side. | 544 // both are displayed on the left side. |
543 // The label height and width depends on the font size and the text displayed. | 545 // The label height and width depends on the font size and the text displayed. |
544 // This may possibly change, so we don't test it here. | 546 // This may possibly change, so we don't test it here. |
545 EXPECT_EQ(menu_button_->bounds().x() - 2, | 547 EXPECT_EQ(menu_button_->bounds().x() - 2, |
546 supervised_user_avatar_label_->bounds().x()); | 548 supervised_user_avatar_label_->bounds().x()); |
547 EXPECT_EQ(menu_button_->bounds().bottom() - 3 - | 549 EXPECT_EQ(menu_button_->bounds().bottom() - 3 - |
548 supervised_user_avatar_label_->bounds().height(), | 550 supervised_user_avatar_label_->bounds().height(), |
549 supervised_user_avatar_label_->bounds().y()); | 551 supervised_user_avatar_label_->bounds().y()); |
550 } | 552 } |
551 #endif | 553 #endif |
OLD | NEW |