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/chrome_password_manager_client.h" | 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 17 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
18 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 18 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| 19 #include "chrome/browser/password_manager/password_manager_util.h" |
19 #include "chrome/browser/password_manager/password_store_factory.h" | 20 #include "chrome/browser/password_manager/password_store_factory.h" |
20 #include "chrome/browser/prerender/prerender_contents.h" | 21 #include "chrome/browser/prerender/prerender_contents.h" |
21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/signin/signin_manager_factory.h" | 23 #include "chrome/browser/signin/signin_manager_factory.h" |
23 #include "chrome/browser/sync/profile_sync_service_factory.h" | 24 #include "chrome/browser/sync/profile_sync_service_factory.h" |
24 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h
" | 25 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h
" |
25 #include "chrome/browser/ui/passwords/passwords_client_ui_delegate.h" | 26 #include "chrome/browser/ui/passwords/passwords_client_ui_delegate.h" |
26 #include "chrome/common/channel_info.h" | 27 #include "chrome/common/channel_info.h" |
27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
(...skipping 24 matching lines...) Expand all Loading... |
53 #include "content/public/browser/child_process_security_policy.h" | 54 #include "content/public/browser/child_process_security_policy.h" |
54 #include "content/public/browser/navigation_entry.h" | 55 #include "content/public/browser/navigation_entry.h" |
55 #include "content/public/browser/navigation_handle.h" | 56 #include "content/public/browser/navigation_handle.h" |
56 #include "content/public/browser/render_view_host.h" | 57 #include "content/public/browser/render_view_host.h" |
57 #include "content/public/browser/ssl_status.h" | 58 #include "content/public/browser/ssl_status.h" |
58 #include "content/public/browser/web_contents.h" | 59 #include "content/public/browser/web_contents.h" |
59 #include "content/public/common/origin_util.h" | 60 #include "content/public/common/origin_util.h" |
60 #include "extensions/features/features.h" | 61 #include "extensions/features/features.h" |
61 #include "google_apis/gaia/gaia_urls.h" | 62 #include "google_apis/gaia/gaia_urls.h" |
62 #include "net/base/url_util.h" | 63 #include "net/base/url_util.h" |
63 #include "net/http/transport_security_state.h" | |
64 #include "net/url_request/url_request_context.h" | |
65 #include "third_party/re2/src/re2/re2.h" | 64 #include "third_party/re2/src/re2/re2.h" |
66 | 65 |
67 #if defined(OS_ANDROID) | 66 #if defined(OS_ANDROID) |
68 #include "chrome/browser/android/tab_android.h" | 67 #include "chrome/browser/android/tab_android.h" |
69 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" | 68 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" |
70 #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h
" | 69 #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h
" |
71 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" | 70 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" |
72 #include "chrome/browser/password_manager/save_password_infobar_delegate_android
.h" | 71 #include "chrome/browser/password_manager/save_password_infobar_delegate_android
.h" |
73 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" | 72 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" |
74 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" | 73 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 IsFillingEnabledForCurrentPage(); | 219 IsFillingEnabledForCurrentPage(); |
221 } | 220 } |
222 | 221 |
223 bool ChromePasswordManagerClient::IsFillingEnabledForCurrentPage() const { | 222 bool ChromePasswordManagerClient::IsFillingEnabledForCurrentPage() const { |
224 return !DidLastPageLoadEncounterSSLErrors() && | 223 return !DidLastPageLoadEncounterSSLErrors() && |
225 IsPasswordManagementEnabledForCurrentPage(); | 224 IsPasswordManagementEnabledForCurrentPage(); |
226 } | 225 } |
227 | 226 |
228 bool ChromePasswordManagerClient::IsHSTSActiveForHost( | 227 bool ChromePasswordManagerClient::IsHSTSActiveForHost( |
229 const GURL& origin) const { | 228 const GURL& origin) const { |
230 if (!origin.is_valid()) | 229 return password_manager_util::IsHSTSActiveForProfileAndHost(profile_, origin); |
231 return false; | |
232 | |
233 net::TransportSecurityState* security_state = | |
234 profile_->GetRequestContext() | |
235 ->GetURLRequestContext() | |
236 ->transport_security_state(); | |
237 | |
238 if (!security_state) | |
239 return false; | |
240 | |
241 return security_state->ShouldUpgradeToSSL(origin.host()); | |
242 } | 230 } |
243 | 231 |
244 bool ChromePasswordManagerClient::OnCredentialManagerUsed() { | 232 bool ChromePasswordManagerClient::OnCredentialManagerUsed() { |
245 prerender::PrerenderContents* prerender_contents = | 233 prerender::PrerenderContents* prerender_contents = |
246 prerender::PrerenderContents::FromWebContents(web_contents()); | 234 prerender::PrerenderContents::FromWebContents(web_contents()); |
247 if (prerender_contents) { | 235 if (prerender_contents) { |
248 prerender_contents->Destroy(prerender::FINAL_STATUS_CREDENTIAL_MANAGER_API); | 236 prerender_contents->Destroy(prerender::FINAL_STATUS_CREDENTIAL_MANAGER_API); |
249 return false; | 237 return false; |
250 } | 238 } |
251 return true; | 239 return true; |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 // static | 664 // static |
677 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { | 665 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { |
678 std::string scheme = url.scheme(); | 666 std::string scheme = url.scheme(); |
679 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 667 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
680 scheme) && | 668 scheme) && |
681 #if BUILDFLAG(ENABLE_EXTENSIONS) | 669 #if BUILDFLAG(ENABLE_EXTENSIONS) |
682 scheme != extensions::kExtensionScheme && | 670 scheme != extensions::kExtensionScheme && |
683 #endif | 671 #endif |
684 scheme != content::kChromeDevToolsScheme); | 672 scheme != content::kChromeDevToolsScheme); |
685 } | 673 } |
OLD | NEW |