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/border.h" |
| 31 #include "ui/views/bubble/tooltip_icon.h" |
31 #include "ui/views/controls/button/checkbox.h" | 32 #include "ui/views/controls/button/checkbox.h" |
32 #include "ui/views/controls/combobox/combobox.h" | 33 #include "ui/views/controls/combobox/combobox.h" |
33 #include "ui/views/controls/image_view.h" | 34 #include "ui/views/controls/image_view.h" |
34 #include "ui/views/controls/label.h" | 35 #include "ui/views/controls/label.h" |
35 #include "ui/views/controls/link.h" | 36 #include "ui/views/controls/link.h" |
36 #include "ui/views/controls/textfield/textfield.h" | 37 #include "ui/views/controls/textfield/textfield.h" |
37 #include "ui/views/controls/throbber.h" | 38 #include "ui/views/controls/throbber.h" |
38 #include "ui/views/layout/box_layout.h" | 39 #include "ui/views/layout/box_layout.h" |
39 #include "ui/views/widget/widget.h" | 40 #include "ui/views/widget/widget.h" |
40 #include "ui/views/window/dialog_client_view.h" | 41 #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)); | 228 views::CreateSolidSidedBorder(1, 0, 0, 0, kSubtleBorderColor)); |
228 storage_row_->set_background( | 229 storage_row_->set_background( |
229 views::Background::CreateSolidBackground(kLightShadingColor)); | 230 views::Background::CreateSolidBackground(kLightShadingColor)); |
230 | 231 |
231 storage_checkbox_ = new views::Checkbox(l10n_util::GetStringUTF16( | 232 storage_checkbox_ = new views::Checkbox(l10n_util::GetStringUTF16( |
232 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_CHECKBOX)); | 233 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_CHECKBOX)); |
233 storage_checkbox_->SetChecked(controller_->GetStoreLocallyStartState()); | 234 storage_checkbox_->SetChecked(controller_->GetStoreLocallyStartState()); |
234 storage_row_->AddChildView(storage_checkbox_); | 235 storage_row_->AddChildView(storage_checkbox_); |
235 storage_row_layout->SetFlexForView(storage_checkbox_, 1); | 236 storage_row_layout->SetFlexForView(storage_checkbox_, 1); |
236 | 237 |
237 storage_row_->AddChildView(new TooltipIcon(l10n_util::GetStringUTF16( | 238 views::TooltipIcon* icon = new views::TooltipIcon(l10n_util::GetStringUTF16( |
238 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_TOOLTIP))); | 239 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_TOOLTIP)); |
| 240 const int kTooltipWidth = 233; |
| 241 icon->set_bubble_width(kTooltipWidth); |
| 242 storage_row_->AddChildView(icon); |
239 | 243 |
240 return storage_row_; | 244 return storage_row_; |
241 } | 245 } |
242 | 246 |
243 gfx::Size CardUnmaskPromptViews::GetPreferredSize() const { | 247 gfx::Size CardUnmaskPromptViews::GetPreferredSize() const { |
244 // Must hardcode a width so the label knows where to wrap. | 248 // Must hardcode a width so the label knows where to wrap. |
245 const int kWidth = 375; | 249 const int kWidth = 375; |
246 return gfx::Size(kWidth, GetHeightForWidth(kWidth)); | 250 return gfx::Size(kWidth, GetHeightForWidth(kWidth)); |
247 } | 251 } |
248 | 252 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 views::View::OnPaint(canvas); | 525 views::View::OnPaint(canvas); |
522 canvas->Restore(); | 526 canvas->Restore(); |
523 } | 527 } |
524 | 528 |
525 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { | 529 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { |
526 alpha_ = alpha; | 530 alpha_ = alpha; |
527 SchedulePaint(); | 531 SchedulePaint(); |
528 } | 532 } |
529 | 533 |
530 } // namespace autofill | 534 } // namespace autofill |
OLD | NEW |