OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/password_manager_delegate_impl.h" | 5 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // Don't show the password manager infobar if this form is for a google | 151 // Don't show the password manager infobar if this form is for a google |
152 // account and we are going to show the one-click singin infobar. | 152 // account and we are going to show the one-click singin infobar. |
153 // For now, one-click signin is fully implemented only on windows. | 153 // For now, one-click signin is fully implemented only on windows. |
154 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 154 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
155 GURL realm(form_to_save->realm()); | 155 GURL realm(form_to_save->realm()); |
156 // TODO(mathp): Checking only against associated_username() causes a bug | 156 // TODO(mathp): Checking only against associated_username() causes a bug |
157 // referenced here: crbug.com/133275 | 157 // referenced here: crbug.com/133275 |
158 if ((realm == GURL(GaiaUrls::GetInstance()->gaia_login_form_realm()) || | 158 if ((realm == GURL(GaiaUrls::GetInstance()->gaia_login_form_realm()) || |
159 realm == GURL("https://www.google.com/")) && | 159 realm == GURL("https://www.google.com/")) && |
160 OneClickSigninHelper::CanOffer(web_contents_, | 160 OneClickSigninHelper::CanOffer(web_contents_, |
161 UTF16ToUTF8(form_to_save->associated_username()), true)) { | 161 OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, |
| 162 UTF16ToUTF8(form_to_save->associated_username()), NULL)) { |
162 return; | 163 return; |
163 } | 164 } |
164 #endif | 165 #endif |
165 | 166 |
166 InfoBarTabHelper* infobar_tab_helper = | 167 InfoBarTabHelper* infobar_tab_helper = |
167 InfoBarTabHelper::FromWebContents(web_contents_); | 168 InfoBarTabHelper::FromWebContents(web_contents_); |
168 infobar_tab_helper->AddInfoBar( | 169 infobar_tab_helper->AddInfoBar( |
169 new SavePasswordInfoBarDelegate(infobar_tab_helper, form_to_save)); | 170 new SavePasswordInfoBarDelegate(infobar_tab_helper, form_to_save)); |
170 } | 171 } |
171 | 172 |
172 Profile* PasswordManagerDelegateImpl::GetProfile() { | 173 Profile* PasswordManagerDelegateImpl::GetProfile() { |
173 return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 174 return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
174 } | 175 } |
175 | 176 |
176 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { | 177 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { |
177 content::NavigationEntry* entry = | 178 content::NavigationEntry* entry = |
178 web_contents_->GetController().GetActiveEntry(); | 179 web_contents_->GetController().GetActiveEntry(); |
179 if (!entry) { | 180 if (!entry) { |
180 NOTREACHED(); | 181 NOTREACHED(); |
181 return false; | 182 return false; |
182 } | 183 } |
183 | 184 |
184 return net::IsCertStatusError(entry->GetSSL().cert_status); | 185 return net::IsCertStatusError(entry->GetSSL().cert_status); |
185 } | 186 } |
OLD | NEW |