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

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

Issue 265073003: [Win, Mac] UI fixes for the delete account button in the new avatar bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix image width on win Created 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/lifetime/application_lifetime.h" 10 #include "chrome/browser/lifetime/application_lifetime.h"
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 layout->StartRow(1, 0); 1130 layout->StartRow(1, 0);
1131 layout->AddView(add_account_link_); 1131 layout->AddView(add_account_link_);
1132 return view; 1132 return view;
1133 } 1133 }
1134 1134
1135 void ProfileChooserView::CreateAccountButton(views::GridLayout* layout, 1135 void ProfileChooserView::CreateAccountButton(views::GridLayout* layout,
1136 const std::string& account, 1136 const std::string& account,
1137 bool is_primary_account, 1137 bool is_primary_account,
1138 int width) { 1138 int width) {
1139 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 1139 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
1140 const gfx::ImageSkia* menu_marker = 1140 const gfx::ImageSkia* default_image =
1141 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia(); 1141 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia();
1142 int kDeleteButtonWidth = default_image->width();
1143 int available_width = width -
1144 kDeleteButtonWidth - views::kButtonHEdgeMarginNew;
1142 1145
1143 views::LabelButton* email_button = new BackgroundColorHoverButton( 1146 views::LabelButton* email_button = new BackgroundColorHoverButton(
1144 this, 1147 NULL,
1145 gfx::ElideEmail(base::UTF8ToUTF16(account), 1148 gfx::ElideEmail(base::UTF8ToUTF16(account),
1146 rb->GetFontList(ui::ResourceBundle::BaseFont), 1149 rb->GetFontList(ui::ResourceBundle::BaseFont),
1147 width - menu_marker->width()), 1150 available_width),
1148 gfx::ImageSkia(), 1151 gfx::ImageSkia(),
1149 gfx::ImageSkia()); 1152 gfx::ImageSkia());
1150 layout->StartRow(1, 0); 1153 layout->StartRow(1, 0);
1151 layout->AddView(email_button); 1154 layout->AddView(email_button);
1152 1155
1156 // Delete button.
1157 views::ImageButton* delete_button = new views::ImageButton(this);
1158 delete_button->SetImageAlignment(views::ImageButton::ALIGN_RIGHT,
1159 views::ImageButton::ALIGN_MIDDLE);
1160 delete_button->SetImage(views::ImageButton::STATE_NORMAL,
1161 default_image);
1162 delete_button->SetImage(views::ImageButton::STATE_HOVERED,
1163 rb->GetImageSkiaNamed(IDR_CLOSE_1_H));
1164 delete_button->SetImage(views::ImageButton::STATE_PRESSED,
1165 rb->GetImageSkiaNamed(IDR_CLOSE_1_P));
1166 delete_button->SetBounds(
1167 available_width, 0, kDeleteButtonWidth, kButtonHeight);
1168
1169 email_button->set_notify_enter_exit_on_child(true);
1170 email_button->AddChildView(delete_button);
1171
1153 // Save the original email address, as the button text could be elided. 1172 // Save the original email address, as the button text could be elided.
1154 current_profile_accounts_map_[email_button] = account; 1173 current_profile_accounts_map_[delete_button] = account;
1155 } 1174 }
1156 1175
1157 views::View* ProfileChooserView::CreateGaiaSigninView( 1176 views::View* ProfileChooserView::CreateGaiaSigninView(
1158 bool add_secondary_account) { 1177 bool add_secondary_account) {
1159 // Adds Gaia signin webview 1178 // Adds Gaia signin webview
1160 Profile* profile = browser_->profile(); 1179 Profile* profile = browser_->profile();
1161 views::WebView* web_view = new views::WebView(profile); 1180 views::WebView* web_view = new views::WebView(profile);
1162 signin::Source source = add_secondary_account ? 1181 signin::Source source = add_secondary_account ?
1163 signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT : 1182 signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT :
1164 signin::SOURCE_AVATAR_BUBBLE_SIGN_IN; 1183 signin::SOURCE_AVATAR_BUBBLE_SIGN_IN;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 layout->StartRowWithPadding( 1296 layout->StartRowWithPadding(
1278 1, 0, 0, views::kUnrelatedControlVerticalSpacing); 1297 1, 0, 0, views::kUnrelatedControlVerticalSpacing);
1279 layout->AddView(end_preview_and_relaunch_button_); 1298 layout->AddView(end_preview_and_relaunch_button_);
1280 1299
1281 TitleCard* title_card = new TitleCard( 1300 TitleCard* title_card = new TitleCard(
1282 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); 1301 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_);
1283 return TitleCard::AddPaddedTitleCard( 1302 return TitleCard::AddPaddedTitleCard(
1284 view, title_card, kFixedAccountRemovalViewWidth); 1303 view, title_card, kFixedAccountRemovalViewWidth);
1285 } 1304 }
1286 1305
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698