OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/passwords/manage_passwords_bubble_view.h" | 5 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "ui/views/layout/layout_constants.h" | 36 #include "ui/views/layout/layout_constants.h" |
37 #include "ui/views/widget/widget.h" | 37 #include "ui/views/widget/widget.h" |
38 | 38 |
39 int ManagePasswordsBubbleView::auto_signin_toast_timeout_ = 3; | 39 int ManagePasswordsBubbleView::auto_signin_toast_timeout_ = 3; |
40 | 40 |
41 // Helpers -------------------------------------------------------------------- | 41 // Helpers -------------------------------------------------------------------- |
42 | 42 |
43 namespace { | 43 namespace { |
44 | 44 |
45 const int kDesiredBubbleWidth = 370; | 45 const int kDesiredBubbleWidth = 370; |
| 46 const SkColor kWarmWelcomeColor = SkColorSetARGB(0xFF, 0x64, 0x64, 0x64); |
46 | 47 |
47 enum ColumnSetType { | 48 enum ColumnSetType { |
48 // | | (FILL, FILL) | | | 49 // | | (FILL, FILL) | | |
49 // Used for the bubble's header, the credentials list, and for simple | 50 // Used for the bubble's header, the credentials list, and for simple |
50 // messages like "No passwords". | 51 // messages like "No passwords". |
51 SINGLE_VIEW_COLUMN_SET, | 52 SINGLE_VIEW_COLUMN_SET, |
52 | 53 |
53 // | | (TRAILING, CENTER) | | (TRAILING, CENTER) | | | 54 // | | (TRAILING, CENTER) | | (TRAILING, CENTER) | | |
54 // Used for buttons at the bottom of the bubble which should nest at the | 55 // Used for buttons at the bottom of the bubble which should nest at the |
55 // bottom-right corner. | 56 // bottom-right corner. |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | 312 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
312 AddTitleRowWithLink(layout, parent_->model(), this); | 313 AddTitleRowWithLink(layout, parent_->model(), this); |
313 | 314 |
314 // Credential row. | 315 // Credential row. |
315 if (item) { | 316 if (item) { |
316 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | 317 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
317 layout->AddView(item); | 318 layout->AddView(item); |
318 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); | 319 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); |
319 } | 320 } |
320 | 321 |
| 322 // Smart Lock warm welcome. |
| 323 if (parent_->model()->ShouldShowGoogleSmartLockWelcome()) { |
| 324 views::Label* smart_lock_label = new views::Label( |
| 325 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK_WELCOME)); |
| 326 smart_lock_label->SetMultiLine(true); |
| 327 smart_lock_label->SetFontList( |
| 328 ui::ResourceBundle::GetSharedInstance().GetFontList( |
| 329 ui::ResourceBundle::SmallFont)); |
| 330 smart_lock_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 331 smart_lock_label->SetEnabledColor(kWarmWelcomeColor); |
| 332 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
| 333 layout->AddView(smart_lock_label); |
| 334 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); |
| 335 } |
| 336 |
321 // Button row. | 337 // Button row. |
322 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); | 338 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); |
323 layout->StartRow(0, DOUBLE_BUTTON_COLUMN_SET); | 339 layout->StartRow(0, DOUBLE_BUTTON_COLUMN_SET); |
324 layout->AddView(save_button_); | 340 layout->AddView(save_button_); |
325 layout->AddView(never_button_); | 341 layout->AddView(never_button_); |
326 | 342 |
327 parent_->set_initially_focused_view(save_button_); | 343 parent_->set_initially_focused_view(save_button_); |
328 } | 344 } |
329 | 345 |
330 ManagePasswordsBubbleView::PendingView::~PendingView() { | 346 ManagePasswordsBubbleView::PendingView::~PendingView() { |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 AddChildView(new SaveConfirmationView(this)); | 837 AddChildView(new SaveConfirmationView(this)); |
822 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { | 838 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { |
823 AddChildView(new AutoSigninView(this)); | 839 AddChildView(new AutoSigninView(this)); |
824 } else if (model_.state() == | 840 } else if (model_.state() == |
825 password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) { | 841 password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) { |
826 AddChildView(new SignInPromoView(this)); | 842 AddChildView(new SignInPromoView(this)); |
827 } else { | 843 } else { |
828 AddChildView(new ManageView(this)); | 844 AddChildView(new ManageView(this)); |
829 } | 845 } |
830 } | 846 } |
OLD | NEW |