OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/profiles/profile_chooser_view.h" | 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/app/vector_icons/vector_icons.h" | 10 #include "chrome/app/vector_icons/vector_icons.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 : ui::NativeTheme::kColorId_LabelDisabledColor)); | 266 : ui::NativeTheme::kColorId_LabelDisabledColor)); |
267 } | 267 } |
268 } | 268 } |
269 | 269 |
270 views::Label* title_; | 270 views::Label* title_; |
271 views::Label* subtitle_; | 271 views::Label* subtitle_; |
272 | 272 |
273 DISALLOW_COPY_AND_ASSIGN(BackgroundColorHoverButton); | 273 DISALLOW_COPY_AND_ASSIGN(BackgroundColorHoverButton); |
274 }; | 274 }; |
275 | 275 |
276 // SizedContainer ------------------------------------------------- | |
277 | |
278 // A simple container view that takes an explicit preferred size. | |
279 class SizedContainer : public views::View { | |
280 public: | |
281 explicit SizedContainer(const gfx::Size& preferred_size) | |
282 : preferred_size_(preferred_size) {} | |
283 | |
284 gfx::Size GetPreferredSize() const override { return preferred_size_; } | |
285 | |
286 private: | |
287 gfx::Size preferred_size_; | |
288 }; | |
289 | |
290 // A view to host the GAIA webview overlapped with a back button. This class | 276 // A view to host the GAIA webview overlapped with a back button. This class |
291 // is needed to reparent the back button inside a native view so that on | 277 // is needed to reparent the back button inside a native view so that on |
292 // windows, user input can be be properly routed to the button. | 278 // windows, user input can be be properly routed to the button. |
293 class HostView : public views::View { | 279 class HostView : public views::View { |
294 public: | 280 public: |
295 HostView() {} | 281 HostView() {} |
296 | 282 |
297 private: | 283 private: |
298 // views::View: | 284 // views::View: |
299 void ViewHierarchyChanged( | 285 void ViewHierarchyChanged( |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 content_label->SetMultiLine(true); | 1254 content_label->SetMultiLine(true); |
1269 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1255 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
1270 vertical_view->AddChildView(content_label); | 1256 vertical_view->AddChildView(content_label); |
1271 | 1257 |
1272 // Adds an action button if an action exists. | 1258 // Adds an action button if an action exists. |
1273 if (button_string_id) { | 1259 if (button_string_id) { |
1274 // If the button string is specified, then the button itself needs to be | 1260 // If the button string is specified, then the button itself needs to be |
1275 // already initialized. | 1261 // already initialized. |
1276 DCHECK(button_out); | 1262 DCHECK(button_out); |
1277 // Adds a padding row between error title/content and the button. | 1263 // Adds a padding row between error title/content and the button. |
1278 SizedContainer* padding = | 1264 auto* padding = new views::View; |
1279 new SizedContainer(gfx::Size(0, views::kRelatedControlVerticalSpacing)); | 1265 padding->set_preferred_size( |
| 1266 gfx::Size(0, views::kRelatedControlVerticalSpacing)); |
1280 vertical_view->AddChildView(padding); | 1267 vertical_view->AddChildView(padding); |
1281 | 1268 |
1282 *button_out = views::MdTextButton::CreateSecondaryUiBlueButton( | 1269 *button_out = views::MdTextButton::CreateSecondaryUiBlueButton( |
1283 this, l10n_util::GetStringUTF16(button_string_id)); | 1270 this, l10n_util::GetStringUTF16(button_string_id)); |
1284 vertical_view->AddChildView(*button_out); | 1271 vertical_view->AddChildView(*button_out); |
1285 view->SetBorder(views::CreateEmptyBorder( | 1272 view->SetBorder(views::CreateEmptyBorder( |
1286 0, 0, views::kRelatedControlSmallVerticalSpacing, 0)); | 1273 0, 0, views::kRelatedControlSmallVerticalSpacing, 0)); |
1287 } | 1274 } |
1288 | 1275 |
1289 view->AddChildView(vertical_view); | 1276 view->AddChildView(vertical_view); |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1854 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1841 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
1855 IncognitoModePrefs::DISABLED; | 1842 IncognitoModePrefs::DISABLED; |
1856 return incognito_available && !browser_->profile()->IsGuestSession(); | 1843 return incognito_available && !browser_->profile()->IsGuestSession(); |
1857 } | 1844 } |
1858 | 1845 |
1859 void ProfileChooserView::PostActionPerformed( | 1846 void ProfileChooserView::PostActionPerformed( |
1860 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1847 ProfileMetrics::ProfileDesktopMenu action_performed) { |
1861 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1848 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
1862 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1849 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
1863 } | 1850 } |
OLD | NEW |