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); | |
47 | 46 |
48 enum ColumnSetType { | 47 enum ColumnSetType { |
49 // | | (FILL, FILL) | | | 48 // | | (FILL, FILL) | | |
50 // Used for the bubble's header, the credentials list, and for simple | 49 // Used for the bubble's header, the credentials list, and for simple |
51 // messages like "No passwords". | 50 // messages like "No passwords". |
52 SINGLE_VIEW_COLUMN_SET, | 51 SINGLE_VIEW_COLUMN_SET, |
53 | 52 |
54 // | | (TRAILING, CENTER) | | (TRAILING, CENTER) | | | 53 // | | (TRAILING, CENTER) | | (TRAILING, CENTER) | | |
55 // Used for buttons at the bottom of the bubble which should nest at the | 54 // Used for buttons at the bottom of the bubble which should nest at the |
56 // bottom-right corner. | 55 // bottom-right corner. |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | 311 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
313 AddTitleRowWithLink(layout, parent_->model(), this); | 312 AddTitleRowWithLink(layout, parent_->model(), this); |
314 | 313 |
315 // Credential row. | 314 // Credential row. |
316 if (item) { | 315 if (item) { |
317 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | 316 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
318 layout->AddView(item); | 317 layout->AddView(item); |
319 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); | 318 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); |
320 } | 319 } |
321 | 320 |
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 | |
337 // Button row. | 321 // Button row. |
338 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); | 322 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); |
339 layout->StartRow(0, DOUBLE_BUTTON_COLUMN_SET); | 323 layout->StartRow(0, DOUBLE_BUTTON_COLUMN_SET); |
340 layout->AddView(save_button_); | 324 layout->AddView(save_button_); |
341 layout->AddView(never_button_); | 325 layout->AddView(never_button_); |
342 | 326 |
343 parent_->set_initially_focused_view(save_button_); | 327 parent_->set_initially_focused_view(save_button_); |
344 } | 328 } |
345 | 329 |
346 ManagePasswordsBubbleView::PendingView::~PendingView() { | 330 ManagePasswordsBubbleView::PendingView::~PendingView() { |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 AddChildView(new SaveConfirmationView(this)); | 821 AddChildView(new SaveConfirmationView(this)); |
838 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { | 822 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { |
839 AddChildView(new AutoSigninView(this)); | 823 AddChildView(new AutoSigninView(this)); |
840 } else if (model_.state() == | 824 } else if (model_.state() == |
841 password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) { | 825 password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) { |
842 AddChildView(new SignInPromoView(this)); | 826 AddChildView(new SignInPromoView(this)); |
843 } else { | 827 } else { |
844 AddChildView(new ManageView(this)); | 828 AddChildView(new ManageView(this)); |
845 } | 829 } |
846 } | 830 } |
OLD | NEW |