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 "chrome/browser/autofill/autofill_manager.h" | 10 #include "chrome/browser/autofill/autofill_manager.h" |
10 #include "chrome/browser/infobars/infobar_tab_helper.h" | 11 #include "chrome/browser/infobars/infobar_tab_helper.h" |
11 #include "chrome/browser/password_manager/password_form_manager.h" | 12 #include "chrome/browser/password_manager/password_form_manager.h" |
12 #include "chrome/browser/password_manager/password_manager.h" | 13 #include "chrome/browser/password_manager/password_manager.h" |
13 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 14 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
14 #include "chrome/browser/ui/sync/one_click_signin_helper.h" | 15 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
15 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
16 #include "chrome/common/autofill_messages.h" | 17 #include "chrome/common/autofill_messages.h" |
17 #include "chrome/common/net/gaia/gaia_urls.h" | 18 #include "chrome/common/net/gaia/gaia_urls.h" |
18 #include "content/public/browser/navigation_entry.h" | 19 #include "content/public/browser/navigation_entry.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 disable_popup)); | 133 disable_popup)); |
133 } | 134 } |
134 | 135 |
135 void PasswordManagerDelegateImpl::AddSavePasswordInfoBarIfPermitted( | 136 void PasswordManagerDelegateImpl::AddSavePasswordInfoBarIfPermitted( |
136 PasswordFormManager* form_to_save) { | 137 PasswordFormManager* form_to_save) { |
137 // Don't show the password manager infobar if this form is for a google | 138 // Don't show the password manager infobar if this form is for a google |
138 // account and we are going to show the one-click singin infobar. | 139 // account and we are going to show the one-click singin infobar. |
139 // For now, one-click signin is fully implemented only on windows. | 140 // For now, one-click signin is fully implemented only on windows. |
140 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 141 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
141 GURL realm(form_to_save->realm()); | 142 GURL realm(form_to_save->realm()); |
142 if (realm == GURL(GaiaUrls::GetInstance()->gaia_login_form_realm()) && | 143 if ((realm == GURL(GaiaUrls::GetInstance()->gaia_login_form_realm()) || |
Roger Tawa OOO till Jul 10th
2012/06/15 17:56:00
Please open a bug about the full email problem, an
Mathieu
2012/06/21 13:13:00
Done.
| |
143 OneClickSigninHelper::CanOffer(tab_contents_->web_contents(), true)) { | 144 realm == GURL("https://www.google.com/")) && |
145 OneClickSigninHelper::CanOffer(tab_contents_->web_contents(), | |
146 UTF16ToUTF8(form_to_save->associated_username()), | |
147 true)) { | |
Roger Tawa OOO till Jul 10th
2012/06/15 17:56:00
could put the true on the previous line.
Mathieu
2012/06/21 13:13:00
Done.
| |
144 return; | 148 return; |
145 } | 149 } |
146 #endif | 150 #endif |
147 | 151 |
148 tab_contents_->infobar_tab_helper()->AddInfoBar( | 152 tab_contents_->infobar_tab_helper()->AddInfoBar( |
149 new SavePasswordInfoBarDelegate( | 153 new SavePasswordInfoBarDelegate( |
150 tab_contents_->infobar_tab_helper(), form_to_save)); | 154 tab_contents_->infobar_tab_helper(), form_to_save)); |
151 } | 155 } |
152 | 156 |
153 Profile* PasswordManagerDelegateImpl::GetProfile() { | 157 Profile* PasswordManagerDelegateImpl::GetProfile() { |
154 return tab_contents_->profile(); | 158 return tab_contents_->profile(); |
155 } | 159 } |
156 | 160 |
157 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { | 161 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { |
158 content::NavigationEntry* entry = | 162 content::NavigationEntry* entry = |
159 tab_contents_->web_contents()->GetController().GetActiveEntry(); | 163 tab_contents_->web_contents()->GetController().GetActiveEntry(); |
160 if (!entry) { | 164 if (!entry) { |
161 NOTREACHED(); | 165 NOTREACHED(); |
162 return false; | 166 return false; |
163 } | 167 } |
164 | 168 |
165 return net::IsCertStatusError(entry->GetSSL().cert_status); | 169 return net::IsCertStatusError(entry->GetSSL().cert_status); |
166 } | 170 } |
OLD | NEW |