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/autofill/card_unmask_prompt_views.h" | 5 #include "chrome/browser/ui/views/autofill/card_unmask_prompt_views.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
11 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" | 11 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" |
12 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" | |
13 #include "chrome/grit/generated_resources.h" | 12 #include "chrome/grit/generated_resources.h" |
14 #include "chrome/grit/theme_resources.h" | 13 #include "chrome/grit/theme_resources.h" |
15 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller.h" | 14 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller.h" |
16 #include "components/constrained_window/constrained_window_views.h" | 15 #include "components/constrained_window/constrained_window_views.h" |
17 #include "components/strings/grit/components_strings.h" | 16 #include "components/strings/grit/components_strings.h" |
18 #include "components/web_modal/web_contents_modal_dialog_host.h" | 17 #include "components/web_modal/web_contents_modal_dialog_host.h" |
19 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 18 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
20 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 19 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
21 #include "third_party/skia/include/core/SkColor.h" | 20 #include "third_party/skia/include/core/SkColor.h" |
22 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
23 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
24 #include "ui/compositor/compositing_recorder.h" | 23 #include "ui/compositor/compositing_recorder.h" |
25 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
26 #include "ui/gfx/color_palette.h" | 25 #include "ui/gfx/color_palette.h" |
27 #include "ui/gfx/geometry/safe_integer_conversions.h" | 26 #include "ui/gfx/geometry/safe_integer_conversions.h" |
28 #include "ui/gfx/paint_vector_icon.h" | 27 #include "ui/gfx/paint_vector_icon.h" |
29 #include "ui/gfx/vector_icons_public.h" | 28 #include "ui/gfx/vector_icons_public.h" |
30 #include "ui/views/background.h" | 29 #include "ui/views/background.h" |
30 #include "ui/views/bubble/tooltip_icon.h" | |
31 #include "ui/views/controls/button/checkbox.h" | 31 #include "ui/views/controls/button/checkbox.h" |
32 #include "ui/views/controls/combobox/combobox.h" | 32 #include "ui/views/controls/combobox/combobox.h" |
33 #include "ui/views/controls/image_view.h" | 33 #include "ui/views/controls/image_view.h" |
34 #include "ui/views/controls/label.h" | 34 #include "ui/views/controls/label.h" |
35 #include "ui/views/controls/link.h" | 35 #include "ui/views/controls/link.h" |
36 #include "ui/views/controls/textfield/textfield.h" | 36 #include "ui/views/controls/textfield/textfield.h" |
37 #include "ui/views/controls/throbber.h" | 37 #include "ui/views/controls/throbber.h" |
38 #include "ui/views/layout/box_layout.h" | 38 #include "ui/views/layout/box_layout.h" |
39 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
40 #include "ui/views/window/dialog_client_view.h" | 40 #include "ui/views/window/dialog_client_view.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 views::CreateSolidSidedBorder(1, 0, 0, 0, kSubtleBorderColor)); | 227 views::CreateSolidSidedBorder(1, 0, 0, 0, kSubtleBorderColor)); |
228 storage_row_->set_background( | 228 storage_row_->set_background( |
229 views::Background::CreateSolidBackground(kLightShadingColor)); | 229 views::Background::CreateSolidBackground(kLightShadingColor)); |
230 | 230 |
231 storage_checkbox_ = new views::Checkbox(l10n_util::GetStringUTF16( | 231 storage_checkbox_ = new views::Checkbox(l10n_util::GetStringUTF16( |
232 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_CHECKBOX)); | 232 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_CHECKBOX)); |
233 storage_checkbox_->SetChecked(controller_->GetStoreLocallyStartState()); | 233 storage_checkbox_->SetChecked(controller_->GetStoreLocallyStartState()); |
234 storage_row_->AddChildView(storage_checkbox_); | 234 storage_row_->AddChildView(storage_checkbox_); |
235 storage_row_layout->SetFlexForView(storage_checkbox_, 1); | 235 storage_row_layout->SetFlexForView(storage_checkbox_, 1); |
236 | 236 |
237 storage_row_->AddChildView(new TooltipIcon(l10n_util::GetStringUTF16( | 237 views::TooltipIcon* icon = new views::TooltipIcon(l10n_util::GetStringUTF16( |
238 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_TOOLTIP))); | 238 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_TOOLTIP)); |
239 icon->set_bubble_width(233); | |
msw
2017/02/15 21:06:37
nit: avoid inlining magic numbers, instead use |co
vasilii
2017/02/16 14:28:05
Done.
| |
240 storage_row_->AddChildView(icon); | |
239 | 241 |
240 return storage_row_; | 242 return storage_row_; |
241 } | 243 } |
242 | 244 |
243 gfx::Size CardUnmaskPromptViews::GetPreferredSize() const { | 245 gfx::Size CardUnmaskPromptViews::GetPreferredSize() const { |
244 // Must hardcode a width so the label knows where to wrap. | 246 // Must hardcode a width so the label knows where to wrap. |
245 const int kWidth = 375; | 247 const int kWidth = 375; |
246 return gfx::Size(kWidth, GetHeightForWidth(kWidth)); | 248 return gfx::Size(kWidth, GetHeightForWidth(kWidth)); |
247 } | 249 } |
248 | 250 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
521 views::View::OnPaint(canvas); | 523 views::View::OnPaint(canvas); |
522 canvas->Restore(); | 524 canvas->Restore(); |
523 } | 525 } |
524 | 526 |
525 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { | 527 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { |
526 alpha_ = alpha; | 528 alpha_ = alpha; |
527 SchedulePaint(); | 529 SchedulePaint(); |
528 } | 530 } |
529 | 531 |
530 } // namespace autofill | 532 } // namespace autofill |
OLD | NEW |