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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // static | 26 // static |
27 void SavePasswordInfoBarDelegate::Create( | 27 void SavePasswordInfoBarDelegate::Create( |
28 content::WebContents* web_contents, | 28 content::WebContents* web_contents, |
29 std::unique_ptr<password_manager::PasswordFormManager> form_to_save) { | 29 std::unique_ptr<password_manager::PasswordFormManager> form_to_save) { |
30 Profile* profile = | 30 Profile* profile = |
31 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 31 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
32 syncer::SyncService* sync_service = | 32 syncer::SyncService* sync_service = |
33 ProfileSyncServiceFactory::GetForProfile(profile); | 33 ProfileSyncServiceFactory::GetForProfile(profile); |
34 bool is_smartlock_branding_enabled = | 34 bool is_smartlock_branding_enabled = |
35 password_bubble_experiment::IsSmartLockBrandingSavePromptEnabled( | 35 password_bubble_experiment::IsSmartLockUser(sync_service); |
36 sync_service); | |
37 InfoBarService* infobar_service = | 36 InfoBarService* infobar_service = |
38 InfoBarService::FromWebContents(web_contents); | 37 InfoBarService::FromWebContents(web_contents); |
39 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | 38 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
40 std::unique_ptr<ConfirmInfoBarDelegate>( | 39 std::unique_ptr<ConfirmInfoBarDelegate>( |
41 new SavePasswordInfoBarDelegate(web_contents, std::move(form_to_save), | 40 new SavePasswordInfoBarDelegate(web_contents, std::move(form_to_save), |
42 is_smartlock_branding_enabled)))); | 41 is_smartlock_branding_enabled)))); |
43 } | 42 } |
44 | 43 |
45 SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { | 44 SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { |
46 password_manager::metrics_util::LogUIDismissalReason(infobar_response_); | 45 password_manager::metrics_util::LogUIDismissalReason(infobar_response_); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 infobar_response_ = password_manager::metrics_util::CLICKED_SAVE; | 89 infobar_response_ = password_manager::metrics_util::CLICKED_SAVE; |
91 return true; | 90 return true; |
92 } | 91 } |
93 | 92 |
94 bool SavePasswordInfoBarDelegate::Cancel() { | 93 bool SavePasswordInfoBarDelegate::Cancel() { |
95 DCHECK(form_to_save_.get()); | 94 DCHECK(form_to_save_.get()); |
96 form_to_save_->PermanentlyBlacklist(); | 95 form_to_save_->PermanentlyBlacklist(); |
97 infobar_response_ = password_manager::metrics_util::CLICKED_NEVER; | 96 infobar_response_ = password_manager::metrics_util::CLICKED_NEVER; |
98 return true; | 97 return true; |
99 } | 98 } |
OLD | NEW |