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

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

Issue 2958533003: Disable Credential management API dialog in VR mode (Closed)
Patch Set: cr feedback Created 3 years, 6 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 19e3d7e39e71d8f6abe01bd81df5fc9b6e961bd2..25a2eecfee1ff7aea2293d6b90aea78da2cebb39 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
@@ -88,6 +88,11 @@
#include "extensions/common/constants.h"
#endif
+#include "device/vr/features/features.h"
vasilii 2017/06/30 11:52:15 unused?
vabr (Chromium) 2017/06/30 12:14:43 It's used for ENABLE_VR. Theoretically, this shou
+#if BUILDFLAG(ENABLE_VR)
+#include "chrome/browser/android/vr_shell/vr_tab_helper.h"
+#endif // BUILDFLAG(ENABLE_VR)
+
using password_manager::ContentPasswordManagerDriverFactory;
using password_manager::PasswordManagerInternalsService;
using sessions::SerializedNavigationEntry;
@@ -209,6 +214,9 @@ bool ChromePasswordManagerClient::IsPasswordManagementEnabledForCurrentPage()
is_enabled =
entry->GetURL().host_piece() != chrome::kChromeUIChromeSigninHost;
}
+ if (IsInVr()) {
vabr (Chromium) 2017/06/30 10:06:07 Given that this is the only necessary use of IsInV
billorr 2017/06/30 17:54:18 Done.
+ is_enabled = false;
+ }
if (log_manager_->IsLoggingActive()) {
password_manager::BrowserSavePasswordProgressLogger logger(
log_manager_.get());
@@ -252,7 +260,9 @@ bool ChromePasswordManagerClient::OnCredentialManagerUsed() {
prerender_contents->Destroy(prerender::FINAL_STATUS_CREDENTIAL_MANAGER_API);
return false;
}
- return true;
+
+ // The credential manager is not used while in VR.
+ return !IsInVr();
vabr (Chromium) 2017/06/30 10:06:07 No need to check this again, the IsPasswordManagem
billorr 2017/06/30 17:54:18 Done.
}
bool ChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword(
@@ -292,6 +302,10 @@ bool ChromePasswordManagerClient::PromptUserToChooseCredentials(
std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms,
const GURL& origin,
const CredentialsCallback& callback) {
+ // Do not show popup dialogs while in VR.
+ if (IsInVr())
vabr (Chromium) 2017/06/30 10:06:07 This is also covered by IsPasswordManagementEnable
billorr 2017/06/30 17:54:18 Done.
+ return false;
+
// Set up an intercept callback if the prompt is zero-clickable (e.g. just one
// form provided).
CredentialsCallback intercept =
@@ -551,6 +565,14 @@ bool ChromePasswordManagerClient::IsIncognito() const {
return web_contents()->GetBrowserContext()->IsOffTheRecord();
}
+bool ChromePasswordManagerClient::IsInVr() const {
+#if BUILDFLAG(ENABLE_VR)
+ return vr_shell::VrTabHelper::IsInVr(web_contents());
+#else
+ return false;
+#endif // BUILDFLAG(ENABLE_VR)
+}
+
const password_manager::PasswordManager*
ChromePasswordManagerClient::GetPasswordManager() const {
return &password_manager_;
@@ -625,7 +647,7 @@ void ChromePasswordManagerClient::PromptUserToEnableAutosigninIfNecessary() {
GetPrefs()) ||
!GetPrefs()->GetBoolean(
password_manager::prefs::kCredentialsEnableAutosignin) ||
- IsIncognito())
+ IsIncognito() || IsInVr())
vabr (Chromium) 2017/06/30 10:06:07 This is also unnecessary. The two codepaths leadin
billorr 2017/06/30 17:54:18 Done.
return;
#if defined(OS_ANDROID)

Powered by Google App Engine
This is Rietveld 408576698