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.h" | 5 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/passwords/password_bubble_experiment.h" | 10 #include "chrome/browser/ui/passwords/password_bubble_experiment.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 scoped_ptr<password_manager::PasswordFormManager> form_to_save, | 37 scoped_ptr<password_manager::PasswordFormManager> form_to_save, |
38 const std::string& uma_histogram_suffix, | 38 const std::string& uma_histogram_suffix, |
39 password_manager::CredentialSourceType source_type) { | 39 password_manager::CredentialSourceType source_type) { |
40 InfoBarService* infobar_service = | 40 InfoBarService* infobar_service = |
41 InfoBarService::FromWebContents(web_contents); | 41 InfoBarService::FromWebContents(web_contents); |
42 Profile* profile = | 42 Profile* profile = |
43 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 43 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
44 SavePasswordInfoBarDelegate* infobar_delegate = | 44 SavePasswordInfoBarDelegate* infobar_delegate = |
45 new SavePasswordInfoBarDelegate( | 45 new SavePasswordInfoBarDelegate( |
46 form_to_save.Pass(), uma_histogram_suffix, source_type, | 46 form_to_save.Pass(), uma_histogram_suffix, source_type, |
47 password_bubble_experiment::IsEnabledSmartLockBranding(profile)); | 47 password_bubble_experiment::IsSmartLockBrandingEnabled(profile)); |
48 #if defined(OS_ANDROID) | 48 #if defined(OS_ANDROID) |
49 // For Android in case of smart lock we need different appearance of infobar. | 49 // For Android in case of smart lock we need different appearance of infobar. |
50 scoped_ptr<infobars::InfoBar> infobar = | 50 scoped_ptr<infobars::InfoBar> infobar = |
51 make_scoped_ptr(new SavePasswordInfoBar( | 51 make_scoped_ptr(new SavePasswordInfoBar( |
52 scoped_ptr<SavePasswordInfoBarDelegate>(infobar_delegate))); | 52 scoped_ptr<SavePasswordInfoBarDelegate>(infobar_delegate))); |
53 #else | 53 #else |
54 // For desktop we'll keep using the ConfirmInfobar. | 54 // For desktop we'll keep using the ConfirmInfobar. |
55 scoped_ptr<infobars::InfoBar> infobar(infobar_service->CreateConfirmInfoBar( | 55 scoped_ptr<infobars::InfoBar> infobar(infobar_service->CreateConfirmInfoBar( |
56 scoped_ptr<ConfirmInfoBarDelegate>(infobar_delegate))); | 56 scoped_ptr<ConfirmInfoBarDelegate>(infobar_delegate))); |
57 #endif | 57 #endif |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 WindowOpenDisposition disposition) { | 176 WindowOpenDisposition disposition) { |
177 InfoBarService::WebContentsFromInfoBar(infobar()) | 177 InfoBarService::WebContentsFromInfoBar(infobar()) |
178 ->OpenURL(content::OpenURLParams( | 178 ->OpenURL(content::OpenURLParams( |
179 GURL(l10n_util::GetStringUTF16( | 179 GURL(l10n_util::GetStringUTF16( |
180 IDS_PASSWORD_MANAGER_SMART_LOCK_ARTICLE)), | 180 IDS_PASSWORD_MANAGER_SMART_LOCK_ARTICLE)), |
181 content::Referrer(), | 181 content::Referrer(), |
182 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 182 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
183 ui::PAGE_TRANSITION_LINK, false)); | 183 ui::PAGE_TRANSITION_LINK, false)); |
184 return true; | 184 return true; |
185 } | 185 } |
OLD | NEW |