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/password_manager/save_password_infobar_delegate_android
.h" | 5 #include "chrome/browser/password_manager/save_password_infobar_delegate_android
.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
23 #include "url/origin.h" | 23 #include "url/origin.h" |
24 | 24 |
25 // static | 25 // static |
26 void SavePasswordInfoBarDelegate::Create( | 26 void SavePasswordInfoBarDelegate::Create( |
27 content::WebContents* web_contents, | 27 content::WebContents* web_contents, |
28 std::unique_ptr<password_manager::PasswordFormManager> form_to_save) { | 28 std::unique_ptr<password_manager::PasswordFormManager> form_to_save) { |
29 Profile* profile = | 29 Profile* profile = |
30 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 30 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
31 sync_driver::SyncService* sync_service = | 31 syncer::SyncService* sync_service = |
32 ProfileSyncServiceFactory::GetForProfile(profile); | 32 ProfileSyncServiceFactory::GetForProfile(profile); |
33 bool is_smartlock_branding_enabled = | 33 bool is_smartlock_branding_enabled = |
34 password_bubble_experiment::IsSmartLockBrandingSavePromptEnabled( | 34 password_bubble_experiment::IsSmartLockBrandingSavePromptEnabled( |
35 sync_service); | 35 sync_service); |
36 bool should_show_first_run_experience = | 36 bool should_show_first_run_experience = |
37 password_bubble_experiment::ShouldShowSavePromptFirstRunExperience( | 37 password_bubble_experiment::ShouldShowSavePromptFirstRunExperience( |
38 sync_service, profile->GetPrefs()); | 38 sync_service, profile->GetPrefs()); |
39 InfoBarService::FromWebContents(web_contents) | 39 InfoBarService::FromWebContents(web_contents) |
40 ->AddInfoBar(CreateSavePasswordInfoBar(base::WrapUnique( | 40 ->AddInfoBar(CreateSavePasswordInfoBar(base::WrapUnique( |
41 new SavePasswordInfoBarDelegate(web_contents, std::move(form_to_save), | 41 new SavePasswordInfoBarDelegate(web_contents, std::move(form_to_save), |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 infobar_response_ = password_manager::metrics_util::CLICKED_SAVE; | 108 infobar_response_ = password_manager::metrics_util::CLICKED_SAVE; |
109 return true; | 109 return true; |
110 } | 110 } |
111 | 111 |
112 bool SavePasswordInfoBarDelegate::Cancel() { | 112 bool SavePasswordInfoBarDelegate::Cancel() { |
113 DCHECK(form_to_save_.get()); | 113 DCHECK(form_to_save_.get()); |
114 form_to_save_->PermanentlyBlacklist(); | 114 form_to_save_->PermanentlyBlacklist(); |
115 infobar_response_ = password_manager::metrics_util::CLICKED_NEVER; | 115 infobar_response_ = password_manager::metrics_util::CLICKED_NEVER; |
116 return true; | 116 return true; |
117 } | 117 } |
OLD | NEW |