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_delegate_impl.h" | 5 #include "chrome/browser/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 "chrome/browser/infobars/infobar_tab_helper.h" | 9 #include "chrome/browser/infobars/infobar_tab_helper.h" |
10 #include "chrome/browser/password_manager/password_form_manager.h" | 10 #include "chrome/browser/password_manager/password_form_manager.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 tab_contents_->web_contents()->GetRenderViewHost()->Send( | 126 tab_contents_->web_contents()->GetRenderViewHost()->Send( |
127 new AutofillMsg_FillPasswordForm( | 127 new AutofillMsg_FillPasswordForm( |
128 tab_contents_->web_contents()->GetRenderViewHost()->GetRoutingID(), | 128 tab_contents_->web_contents()->GetRenderViewHost()->GetRoutingID(), |
129 form_data)); | 129 form_data)); |
130 } | 130 } |
131 | 131 |
132 void PasswordManagerDelegateImpl::AddSavePasswordInfoBarIfPermitted( | 132 void PasswordManagerDelegateImpl::AddSavePasswordInfoBarIfPermitted( |
133 PasswordFormManager* form_to_save) { | 133 PasswordFormManager* form_to_save) { |
134 // Don't show the password manager infobar if this form is for a google | 134 // Don't show the password manager infobar if this form is for a google |
135 // account and we are going to show the one-click singin infobar. | 135 // account and we are going to show the one-click singin infobar. |
136 // For now, one-click signin is fully implemented only on windows. When | 136 // For now, one-click signin is fully implemented only on windows. |
137 // the feature is finally implemented on mac and linux, will need to add | 137 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
138 // OS_MACOSX and OS_LINUX. | |
139 #if defined(OS_WIN) | |
140 GURL realm(form_to_save->realm()); | 138 GURL realm(form_to_save->realm()); |
141 if (realm == GURL(GaiaUrls::GetInstance()->gaia_login_form_realm()) && | 139 if (realm == GURL(GaiaUrls::GetInstance()->gaia_login_form_realm()) && |
142 OneClickSigninHelper::CanOffer(tab_contents_->web_contents(), true)) { | 140 OneClickSigninHelper::CanOffer(tab_contents_->web_contents(), true)) { |
143 return; | 141 return; |
144 } | 142 } |
145 #endif | 143 #endif |
146 | 144 |
147 tab_contents_->infobar_tab_helper()->AddInfoBar( | 145 tab_contents_->infobar_tab_helper()->AddInfoBar( |
148 new SavePasswordInfoBarDelegate( | 146 new SavePasswordInfoBarDelegate( |
149 tab_contents_->infobar_tab_helper(), form_to_save)); | 147 tab_contents_->infobar_tab_helper(), form_to_save)); |
150 } | 148 } |
151 | 149 |
152 Profile* PasswordManagerDelegateImpl::GetProfileForPasswordManager() { | 150 Profile* PasswordManagerDelegateImpl::GetProfileForPasswordManager() { |
153 return tab_contents_->profile(); | 151 return tab_contents_->profile(); |
154 } | 152 } |
155 | 153 |
156 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { | 154 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { |
157 content::NavigationEntry* entry = | 155 content::NavigationEntry* entry = |
158 tab_contents_->web_contents()->GetController().GetActiveEntry(); | 156 tab_contents_->web_contents()->GetController().GetActiveEntry(); |
159 if (!entry) { | 157 if (!entry) { |
160 NOTREACHED(); | 158 NOTREACHED(); |
161 return false; | 159 return false; |
162 } | 160 } |
163 | 161 |
164 return net::IsCertStatusError(entry->GetSSL().cert_status); | 162 return net::IsCertStatusError(entry->GetSSL().cert_status); |
165 } | 163 } |
OLD | NEW |