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

Side by Side Diff: chrome/browser/ui/views/autofill/card_unmask_prompt_views.cc

Issue 981293003: Autofill - Add tooltip icon to cvc verification dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad rebase Created 5 years, 9 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
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/ui/views/autofill/tooltip_icon.h » ('j') | 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" 7 #include "chrome/browser/ui/autofill/autofill_dialog_models.h"
8 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" 8 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
9 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h" 9 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h"
10 #include "chrome/browser/ui/autofill/card_unmask_prompt_view.h" 10 #include "chrome/browser/ui/autofill/card_unmask_prompt_view.h"
11 #include "chrome/browser/ui/views/autofill/decorated_textfield.h" 11 #include "chrome/browser/ui/views/autofill/decorated_textfield.h"
12 #include "chrome/browser/ui/views/autofill/tooltip_icon.h"
12 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
13 #include "components/constrained_window/constrained_window_views.h" 14 #include "components/constrained_window/constrained_window_views.h"
14 #include "components/web_modal/web_contents_modal_dialog_host.h" 15 #include "components/web_modal/web_contents_modal_dialog_host.h"
15 #include "components/web_modal/web_contents_modal_dialog_manager.h" 16 #include "components/web_modal/web_contents_modal_dialog_manager.h"
16 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" 17 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
17 #include "grit/theme_resources.h" 18 #include "grit/theme_resources.h"
18 #include "third_party/skia/include/core/SkColor.h" 19 #include "third_party/skia/include/core/SkColor.h"
19 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/views/background.h" 22 #include "ui/views/background.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 View* GetContentsView() override { 127 View* GetContentsView() override {
127 InitIfNecessary(); 128 InitIfNecessary();
128 return this; 129 return this;
129 } 130 }
130 131
131 // views::View 132 // views::View
132 gfx::Size GetPreferredSize() const override { 133 gfx::Size GetPreferredSize() const override {
133 // Must hardcode a width so the label knows where to wrap. TODO(estade): 134 // Must hardcode a width so the label knows where to wrap. TODO(estade):
134 // This can lead to a weird looking dialog if we end up getting allocated 135 // This can lead to a weird looking dialog if we end up getting allocated
135 // more width than we ask for, e.g. if the title is super long. 136 // more width than we ask for, e.g. if the title is super long.
136 const int kWidth = 450; 137 const int kWidth = 375;
137 return gfx::Size(kWidth, GetHeightForWidth(kWidth)); 138 return gfx::Size(kWidth, GetHeightForWidth(kWidth));
138 } 139 }
139 140
140 void Layout() override { 141 void Layout() override {
141 for (int i = 0; i < child_count(); ++i) { 142 for (int i = 0; i < child_count(); ++i) {
142 child_at(i)->SetBoundsRect(GetContentsBounds()); 143 child_at(i)->SetBoundsRect(GetContentsBounds());
143 } 144 }
144 } 145 }
145 146
146 int GetHeightForWidth(int width) const override { 147 int GetHeightForWidth(int width) const override {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 cvc_image->SetImage(rb.GetImageSkiaNamed(controller_->GetCvcImageRid())); 277 cvc_image->SetImage(rb.GetImageSkiaNamed(controller_->GetCvcImageRid()));
277 278
278 input_row->AddChildView(cvc_image); 279 input_row->AddChildView(cvc_image);
279 280
280 // Reserve vertical space for the error label, assuming it's one line. 281 // Reserve vertical space for the error label, assuming it's one line.
281 error_label_ = new views::Label(base::ASCIIToUTF16(" ")); 282 error_label_ = new views::Label(base::ASCIIToUTF16(" "));
282 error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 283 error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
283 error_label_->SetEnabledColor(kWarningColor); 284 error_label_->SetEnabledColor(kWarningColor);
284 controls_container_->AddChildView(error_label_); 285 controls_container_->AddChildView(error_label_);
285 286
287 // Local storage checkbox and (?) tooltip.
288 views::View* storage_row = new views::View();
289 views::BoxLayout* storage_row_layout =
290 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0);
291 storage_row->SetLayoutManager(storage_row_layout);
292 controls_container_->AddChildView(storage_row);
293
286 storage_checkbox_ = new views::Checkbox(l10n_util::GetStringUTF16( 294 storage_checkbox_ = new views::Checkbox(l10n_util::GetStringUTF16(
287 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_CHECKBOX)); 295 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_CHECKBOX));
288 storage_checkbox_->SetChecked(controller_->GetStoreLocallyStartState()); 296 storage_checkbox_->SetChecked(controller_->GetStoreLocallyStartState());
289 controls_container_->AddChildView(storage_checkbox_); 297 storage_row->AddChildView(storage_checkbox_);
298 storage_row_layout->SetFlexForView(storage_checkbox_, 1);
299
300 TooltipIcon* tooltip = new TooltipIcon(l10n_util::GetStringUTF16(
301 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_TOOLTIP));
302 tooltip->set_bubble_arrow(views::BubbleBorder::BOTTOM_RIGHT);
303 storage_row->AddChildView(tooltip);
290 304
291 progress_overlay_ = new views::View(); 305 progress_overlay_ = new views::View();
292 views::BoxLayout* progress_layout = 306 views::BoxLayout* progress_layout =
293 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); 307 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0);
294 progress_layout->set_main_axis_alignment( 308 progress_layout->set_main_axis_alignment(
295 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); 309 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER);
296 progress_layout->set_cross_axis_alignment( 310 progress_layout->set_cross_axis_alignment(
297 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); 311 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER);
298 progress_overlay_->SetLayoutManager(progress_layout); 312 progress_overlay_->SetLayoutManager(progress_layout);
299 313
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 347
334 // static 348 // static
335 CardUnmaskPromptView* CardUnmaskPromptView::CreateAndShow( 349 CardUnmaskPromptView* CardUnmaskPromptView::CreateAndShow(
336 CardUnmaskPromptController* controller) { 350 CardUnmaskPromptController* controller) {
337 CardUnmaskPromptViews* view = new CardUnmaskPromptViews(controller); 351 CardUnmaskPromptViews* view = new CardUnmaskPromptViews(controller);
338 view->Show(); 352 view->Show();
339 return view; 353 return view;
340 } 354 }
341 355
342 } // namespace autofill 356 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/ui/views/autofill/tooltip_icon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698