Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1726)

Side by Side Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 1958453002: Update some secondary UI buttons to MD style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: msw review Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 28 matching lines...) Expand all
39 #include "components/signin/core/browser/profile_oauth2_token_service.h" 39 #include "components/signin/core/browser/profile_oauth2_token_service.h"
40 #include "components/signin/core/browser/signin_error_controller.h" 40 #include "components/signin/core/browser/signin_error_controller.h"
41 #include "components/signin/core/browser/signin_header_helper.h" 41 #include "components/signin/core/browser/signin_header_helper.h"
42 #include "components/signin/core/browser/signin_manager.h" 42 #include "components/signin/core/browser/signin_manager.h"
43 #include "components/signin/core/common/profile_management_switches.h" 43 #include "components/signin/core/common/profile_management_switches.h"
44 #include "content/public/browser/render_widget_host_view.h" 44 #include "content/public/browser/render_widget_host_view.h"
45 #include "content/public/browser/user_metrics.h" 45 #include "content/public/browser/user_metrics.h"
46 #include "grit/theme_resources.h" 46 #include "grit/theme_resources.h"
47 #include "third_party/skia/include/core/SkColor.h" 47 #include "third_party/skia/include/core/SkColor.h"
48 #include "ui/base/l10n/l10n_util.h" 48 #include "ui/base/l10n/l10n_util.h"
49 #include "ui/base/material_design/material_design_controller.h"
49 #include "ui/base/resource/resource_bundle.h" 50 #include "ui/base/resource/resource_bundle.h"
50 #include "ui/compositor/clip_recorder.h" 51 #include "ui/compositor/clip_recorder.h"
51 #include "ui/gfx/canvas.h" 52 #include "ui/gfx/canvas.h"
52 #include "ui/gfx/color_palette.h" 53 #include "ui/gfx/color_palette.h"
53 #include "ui/gfx/image/canvas_image_source.h" 54 #include "ui/gfx/image/canvas_image_source.h"
54 #include "ui/gfx/image/image.h" 55 #include "ui/gfx/image/image.h"
55 #include "ui/gfx/image/image_skia.h" 56 #include "ui/gfx/image/image_skia.h"
56 #include "ui/gfx/paint_vector_icon.h" 57 #include "ui/gfx/paint_vector_icon.h"
57 #include "ui/gfx/path.h" 58 #include "ui/gfx/path.h"
58 #include "ui/gfx/skia_util.h" 59 #include "ui/gfx/skia_util.h"
59 #include "ui/gfx/text_elider.h" 60 #include "ui/gfx/text_elider.h"
60 #include "ui/gfx/vector_icons_public.h" 61 #include "ui/gfx/vector_icons_public.h"
61 #include "ui/native_theme/common_theme.h" 62 #include "ui/native_theme/common_theme.h"
62 #include "ui/native_theme/native_theme.h" 63 #include "ui/native_theme/native_theme.h"
63 #include "ui/views/controls/button/blue_button.h" 64 #include "ui/views/controls/button/blue_button.h"
64 #include "ui/views/controls/button/image_button.h" 65 #include "ui/views/controls/button/image_button.h"
65 #include "ui/views/controls/button/label_button.h" 66 #include "ui/views/controls/button/label_button.h"
66 #include "ui/views/controls/button/label_button_border.h" 67 #include "ui/views/controls/button/label_button_border.h"
68 #include "ui/views/controls/button/md_text_button.h"
67 #include "ui/views/controls/button/menu_button.h" 69 #include "ui/views/controls/button/menu_button.h"
68 #include "ui/views/controls/label.h" 70 #include "ui/views/controls/label.h"
69 #include "ui/views/controls/link.h" 71 #include "ui/views/controls/link.h"
70 #include "ui/views/controls/separator.h" 72 #include "ui/views/controls/separator.h"
71 #include "ui/views/controls/styled_label.h" 73 #include "ui/views/controls/styled_label.h"
72 #include "ui/views/controls/textfield/textfield.h" 74 #include "ui/views/controls/textfield/textfield.h"
73 #include "ui/views/controls/webview/webview.h" 75 #include "ui/views/controls/webview/webview.h"
74 #include "ui/views/layout/box_layout.h" 76 #include "ui/views/layout/box_layout.h"
75 #include "ui/views/layout/fill_layout.h" 77 #include "ui/views/layout/fill_layout.h"
76 #include "ui/views/layout/grid_layout.h" 78 #include "ui/views/layout/grid_layout.h"
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 button_columns->AddPaddingColumn( 1241 button_columns->AddPaddingColumn(
1240 1, views::kUnrelatedControlHorizontalSpacing); 1242 1, views::kUnrelatedControlHorizontalSpacing);
1241 button_columns->AddColumn(views::GridLayout::TRAILING, 1243 button_columns->AddColumn(views::GridLayout::TRAILING,
1242 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); 1244 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0);
1243 layout->SetInsets(views::kButtonVEdgeMarginNew, 1245 layout->SetInsets(views::kButtonVEdgeMarginNew,
1244 views::kButtonHEdgeMarginNew, 1246 views::kButtonHEdgeMarginNew,
1245 views::kButtonVEdgeMarginNew, 1247 views::kButtonVEdgeMarginNew,
1246 views::kButtonHEdgeMarginNew); 1248 views::kButtonHEdgeMarginNew);
1247 1249
1248 // Adds title and close button if needed. 1250 // Adds title and close button if needed.
1251 const SkColor kTitleAndButtonTextColor = SK_ColorWHITE;
1249 views::Label* title_label = new views::Label(title_text); 1252 views::Label* title_label = new views::Label(title_text);
1250 title_label->SetMultiLine(true); 1253 title_label->SetMultiLine(true);
1251 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1254 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1252 title_label->SetAutoColorReadabilityEnabled(false); 1255 title_label->SetAutoColorReadabilityEnabled(false);
1253 title_label->SetEnabledColor(SK_ColorWHITE); 1256 title_label->SetEnabledColor(kTitleAndButtonTextColor);
1254 title_label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( 1257 title_label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList(
1255 ui::ResourceBundle::MediumFont)); 1258 ui::ResourceBundle::MediumFont));
1256 1259
1257 if (close_button) { 1260 if (close_button) {
1258 layout->StartRow(1, 1); 1261 layout->StartRow(1, 1);
1259 layout->AddView(title_label); 1262 layout->AddView(title_label);
1260 *close_button = new views::ImageButton(this); 1263 *close_button = new views::ImageButton(this);
1261 (*close_button)->SetImageAlignment(views::ImageButton::ALIGN_RIGHT, 1264 (*close_button)->SetImageAlignment(views::ImageButton::ALIGN_RIGHT,
1262 views::ImageButton::ALIGN_MIDDLE); 1265 views::ImageButton::ALIGN_MIDDLE);
1263 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 1266 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
(...skipping 14 matching lines...) Expand all
1278 content_label->SetMultiLine(true); 1281 content_label->SetMultiLine(true);
1279 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1282 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1280 content_label->SetAutoColorReadabilityEnabled(false); 1283 content_label->SetAutoColorReadabilityEnabled(false);
1281 content_label->SetEnabledColor(profiles::kAvatarTutorialContentTextColor); 1284 content_label->SetEnabledColor(profiles::kAvatarTutorialContentTextColor);
1282 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing); 1285 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing);
1283 layout->AddView(content_label); 1286 layout->AddView(content_label);
1284 1287
1285 // Adds links and buttons. 1288 // Adds links and buttons.
1286 bool has_button = !button_text.empty(); 1289 bool has_button = !button_text.empty();
1287 if (has_button) { 1290 if (has_button) {
1288 *button = new views::LabelButton(this, button_text); 1291 *button = views::MdTextButton::CreateSecondaryUiButton(this, button_text);
1289 (*button)->SetHorizontalAlignment(gfx::ALIGN_CENTER); 1292 if (ui::MaterialDesignController::IsSecondaryUiMaterial())
1290 (*button)->SetStyle(views::Button::STYLE_BUTTON); 1293 (*button)->SetEnabledTextColors(kTitleAndButtonTextColor);
1294 else
1295 (*button)->SetHorizontalAlignment(gfx::ALIGN_CENTER);
1291 } 1296 }
1292 1297
1293 bool has_link = !link_text.empty(); 1298 bool has_link = !link_text.empty();
1294 if (has_link) { 1299 if (has_link) {
1295 *link = CreateLink(link_text, this); 1300 *link = CreateLink(link_text, this);
1296 (*link)->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1301 (*link)->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1297 (*link)->SetAutoColorReadabilityEnabled(false); 1302 (*link)->SetAutoColorReadabilityEnabled(false);
1298 (*link)->SetEnabledColor(SK_ColorWHITE); 1303 (*link)->SetEnabledColor(kTitleAndButtonTextColor);
1299 } 1304 }
1300 1305
1301 if (stack_button) { 1306 if (stack_button) {
1302 DCHECK(has_button); 1307 DCHECK(has_button);
1303 layout->StartRowWithPadding( 1308 layout->StartRowWithPadding(
1304 1, 0, 0, views::kUnrelatedControlVerticalSpacing); 1309 1, 0, 0, views::kUnrelatedControlVerticalSpacing);
1305 layout->AddView(*button); 1310 layout->AddView(*button);
1306 if (has_link) { 1311 if (has_link) {
1307 layout->StartRowWithPadding( 1312 layout->StartRowWithPadding(
1308 1, 0, 0, views::kRelatedControlVerticalSpacing); 1313 1, 0, 0, views::kRelatedControlVerticalSpacing);
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1885 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1881 IncognitoModePrefs::DISABLED; 1886 IncognitoModePrefs::DISABLED;
1882 return incognito_available && !browser_->profile()->IsGuestSession(); 1887 return incognito_available && !browser_->profile()->IsGuestSession();
1883 } 1888 }
1884 1889
1885 void ProfileChooserView::PostActionPerformed( 1890 void ProfileChooserView::PostActionPerformed(
1886 ProfileMetrics::ProfileDesktopMenu action_performed) { 1891 ProfileMetrics::ProfileDesktopMenu action_performed) {
1887 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1892 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1888 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1893 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1889 } 1894 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698