Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: chrome/browser/password_manager/chrome_password_manager_client.cc

Issue 2656453002: Remove password manager's dependency of BrowsingDataHelper (Closed)
Patch Set: s/spec/possibly_invalid_spec/ Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/chrome_password_manager_client.cc
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc
index 26b54a8a2ea28078405fc64b2f3fa1d5a3037341..c2b67ed44739b7463c7466529220f9ed7f8cd32f 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
@@ -50,10 +50,12 @@
#include "components/sessions/content/content_record_password_state.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/version_info/version_info.h"
+#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/ssl_status.h"
#include "content/public/browser/web_contents.h"
+#include "extensions/features/features.h"
#include "google_apis/gaia/gaia_urls.h"
#include "net/base/url_util.h"
#include "third_party/re2/src/re2/re2.h"
@@ -68,6 +70,10 @@
#include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h"
#endif
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+#include "extensions/common/constants.h"
+#endif
+
using password_manager::ContentPasswordManagerDriverFactory;
using password_manager::PasswordManagerInternalsService;
using sessions::SerializedNavigationEntry;
@@ -231,10 +237,8 @@ bool ChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword(
bool update_password) {
// Save password infobar and the password bubble prompts in case of
// "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://).
- if (!BrowsingDataHelper::IsWebScheme(
- web_contents()->GetLastCommittedURL().scheme())) {
+ if (!CanShowBubbleOnURL(web_contents()->GetLastCommittedURL()))
return false;
- }
#if !defined(OS_ANDROID)
PasswordsClientUIDelegate* manage_passwords_ui_controller =
@@ -642,3 +646,14 @@ void ChromePasswordManagerClient::BindCredentialManager(
instance->credential_manager_impl_.BindRequest(std::move(request));
}
+
+// static
+bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) {
+ std::string scheme = url.scheme();
+ return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme(
+ scheme) &&
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ scheme != extensions::kExtensionScheme &&
+#endif
+ scheme != content::kChromeDevToolsScheme);
+}

Powered by Google App Engine
This is Rietveld 408576698