| 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" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "content/public/browser/child_process_security_policy.h" | 53 #include "content/public/browser/child_process_security_policy.h" |
| 54 #include "content/public/browser/navigation_entry.h" | 54 #include "content/public/browser/navigation_entry.h" |
| 55 #include "content/public/browser/navigation_handle.h" | 55 #include "content/public/browser/navigation_handle.h" |
| 56 #include "content/public/browser/render_view_host.h" | 56 #include "content/public/browser/render_view_host.h" |
| 57 #include "content/public/browser/ssl_status.h" | 57 #include "content/public/browser/ssl_status.h" |
| 58 #include "content/public/browser/web_contents.h" | 58 #include "content/public/browser/web_contents.h" |
| 59 #include "content/public/common/origin_util.h" | 59 #include "content/public/common/origin_util.h" |
| 60 #include "extensions/features/features.h" | 60 #include "extensions/features/features.h" |
| 61 #include "google_apis/gaia/gaia_urls.h" | 61 #include "google_apis/gaia/gaia_urls.h" |
| 62 #include "net/base/url_util.h" | 62 #include "net/base/url_util.h" |
| 63 #include "net/http/transport_security_state.h" |
| 64 #include "net/url_request/url_request_context.h" |
| 63 #include "third_party/re2/src/re2/re2.h" | 65 #include "third_party/re2/src/re2/re2.h" |
| 64 | 66 |
| 65 #if defined(OS_ANDROID) | 67 #if defined(OS_ANDROID) |
| 66 #include "chrome/browser/android/tab_android.h" | 68 #include "chrome/browser/android/tab_android.h" |
| 67 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" | 69 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" |
| 68 #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h
" | 70 #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h
" |
| 69 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" | 71 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" |
| 70 #include "chrome/browser/password_manager/save_password_infobar_delegate_android
.h" | 72 #include "chrome/browser/password_manager/save_password_infobar_delegate_android
.h" |
| 71 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" | 73 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" |
| 72 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" | 74 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // here once we decide to switch to new settings behavior for everyone. | 218 // here once we decide to switch to new settings behavior for everyone. |
| 217 return *saving_and_filling_passwords_enabled_ && !IsOffTheRecord() && | 219 return *saving_and_filling_passwords_enabled_ && !IsOffTheRecord() && |
| 218 IsFillingEnabledForCurrentPage(); | 220 IsFillingEnabledForCurrentPage(); |
| 219 } | 221 } |
| 220 | 222 |
| 221 bool ChromePasswordManagerClient::IsFillingEnabledForCurrentPage() const { | 223 bool ChromePasswordManagerClient::IsFillingEnabledForCurrentPage() const { |
| 222 return !DidLastPageLoadEncounterSSLErrors() && | 224 return !DidLastPageLoadEncounterSSLErrors() && |
| 223 IsPasswordManagementEnabledForCurrentPage(); | 225 IsPasswordManagementEnabledForCurrentPage(); |
| 224 } | 226 } |
| 225 | 227 |
| 228 bool ChromePasswordManagerClient::IsHSTSActiveForHost( |
| 229 const GURL& origin) const { |
| 230 if (!origin.is_valid()) |
| 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 } |
| 243 |
| 226 bool ChromePasswordManagerClient::OnCredentialManagerUsed() { | 244 bool ChromePasswordManagerClient::OnCredentialManagerUsed() { |
| 227 prerender::PrerenderContents* prerender_contents = | 245 prerender::PrerenderContents* prerender_contents = |
| 228 prerender::PrerenderContents::FromWebContents(web_contents()); | 246 prerender::PrerenderContents::FromWebContents(web_contents()); |
| 229 if (prerender_contents) { | 247 if (prerender_contents) { |
| 230 prerender_contents->Destroy(prerender::FINAL_STATUS_CREDENTIAL_MANAGER_API); | 248 prerender_contents->Destroy(prerender::FINAL_STATUS_CREDENTIAL_MANAGER_API); |
| 231 return false; | 249 return false; |
| 232 } | 250 } |
| 233 return true; | 251 return true; |
| 234 } | 252 } |
| 235 | 253 |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 // static | 676 // static |
| 659 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { | 677 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { |
| 660 std::string scheme = url.scheme(); | 678 std::string scheme = url.scheme(); |
| 661 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 679 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
| 662 scheme) && | 680 scheme) && |
| 663 #if BUILDFLAG(ENABLE_EXTENSIONS) | 681 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 664 scheme != extensions::kExtensionScheme && | 682 scheme != extensions::kExtensionScheme && |
| 665 #endif | 683 #endif |
| 666 scheme != content::kChromeDevToolsScheme); | 684 scheme != content::kChromeDevToolsScheme); |
| 667 } | 685 } |
| OLD | NEW |