Commit 334ebbb6 authored by Tibor Goldschwendt's avatar Tibor Goldschwendt Committed by Commit Bot

[vr] Suppress autofill popups in VR.

Bug: 727955
Change-Id: Ib68a97b0ff6a548155b9fa3db1c44a4ba24c7a94
Reviewed-on: https://chromium-review.googlesource.com/566318
Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org>
Reviewed-by: default avatarTobias Sargeant <tobiasjs@chromium.org>
Reviewed-by: default avatarmahmadi <mahmadi@chromium.org>
Reviewed-by: default avatarMathieu Perreault <mathp@chromium.org>
Reviewed-by: default avatarAmirhossein Simjour <asimjour@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486798}
parent d1fee60d
...@@ -217,6 +217,10 @@ void AwAutofillClient::StartSigninFlow() {} ...@@ -217,6 +217,10 @@ void AwAutofillClient::StartSigninFlow() {}
void AwAutofillClient::ShowHttpNotSecureExplanation() {} void AwAutofillClient::ShowHttpNotSecureExplanation() {}
bool AwAutofillClient::IsAutofillSupported() {
return true;
}
void AwAutofillClient::Dismissed(JNIEnv* env, void AwAutofillClient::Dismissed(JNIEnv* env,
const JavaParamRef<jobject>& obj) { const JavaParamRef<jobject>& obj) {
anchor_view_.Reset(); anchor_view_.Reset();
......
...@@ -107,6 +107,7 @@ class AwAutofillClient : public autofill::AutofillClient, ...@@ -107,6 +107,7 @@ class AwAutofillClient : public autofill::AutofillClient,
bool ShouldShowSigninPromo() override; bool ShouldShowSigninPromo() override;
void StartSigninFlow() override; void StartSigninFlow() override;
void ShowHttpNotSecureExplanation() override; void ShowHttpNotSecureExplanation() override;
bool IsAutofillSupported() override;
void Dismissed(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); void Dismissed(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
void SuggestionSelected(JNIEnv* env, void SuggestionSelected(JNIEnv* env,
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "chrome/browser/web_data_service_factory.h" #include "chrome/browser/web_data_service_factory.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "components/autofill/content/browser/content_autofill_driver.h" #include "components/autofill/content/browser/content_autofill_driver.h"
...@@ -405,4 +406,12 @@ void ChromeAutofillClient::ShowHttpNotSecureExplanation() { ...@@ -405,4 +406,12 @@ void ChromeAutofillClient::ShowHttpNotSecureExplanation() {
false /* is_renderer_initiated */)); false /* is_renderer_initiated */));
} }
bool ChromeAutofillClient::IsAutofillSupported() {
// VR browsing does not support popups at the moment.
if (vr::VrTabHelper::IsInVr(web_contents()))
return false;
return true;
}
} // namespace autofill } // namespace autofill
...@@ -90,6 +90,7 @@ class ChromeAutofillClient ...@@ -90,6 +90,7 @@ class ChromeAutofillClient
bool ShouldShowSigninPromo() override; bool ShouldShowSigninPromo() override;
void StartSigninFlow() override; void StartSigninFlow() override;
void ShowHttpNotSecureExplanation() override; void ShowHttpNotSecureExplanation() override;
bool IsAutofillSupported() override;
// content::WebContentsObserver implementation. // content::WebContentsObserver implementation.
void MainFrameWasResized(bool width_changed) override; void MainFrameWasResized(bool width_changed) override;
......
...@@ -199,6 +199,10 @@ class AutofillClient : public RiskDataLoader { ...@@ -199,6 +199,10 @@ class AutofillClient : public RiskDataLoader {
// Shows the explanation of http not secure warning message. // Shows the explanation of http not secure warning message.
virtual void ShowHttpNotSecureExplanation() = 0; virtual void ShowHttpNotSecureExplanation() = 0;
// Whether Autofill is currently supported by the client. If false, all
// features of Autofill are disabled, including Autocomplete.
virtual bool IsAutofillSupported() = 0;
}; };
} // namespace autofill } // namespace autofill
......
...@@ -1165,7 +1165,8 @@ void AutofillManager::OnDidEndTextFieldEditing() { ...@@ -1165,7 +1165,8 @@ void AutofillManager::OnDidEndTextFieldEditing() {
} }
bool AutofillManager::IsAutofillEnabled() const { bool AutofillManager::IsAutofillEnabled() const {
return ::autofill::IsAutofillEnabled(client_->GetPrefs()); return ::autofill::IsAutofillEnabled(client_->GetPrefs()) &&
client_->IsAutofillSupported();
} }
bool AutofillManager::IsCreditCardUploadEnabled() { bool AutofillManager::IsCreditCardUploadEnabled() {
......
...@@ -190,7 +190,8 @@ class AutofillManager : public AutofillHandler, ...@@ -190,7 +190,8 @@ class AutofillManager : public AutofillHandler,
const std::vector<base::string16>& labels) override; const std::vector<base::string16>& labels) override;
void Reset() override; void Reset() override;
// Returns the value of the AutofillEnabled pref. // Returns true if the value of the AutofillEnabled pref is true and the
// client supports Autofill.
virtual bool IsAutofillEnabled() const; virtual bool IsAutofillEnabled() const;
// Returns true if all the conditions for enabling the upload of credit card // Returns true if all the conditions for enabling the upload of credit card
......
...@@ -145,4 +145,8 @@ void TestAutofillClient::StartSigninFlow() {} ...@@ -145,4 +145,8 @@ void TestAutofillClient::StartSigninFlow() {}
void TestAutofillClient::ShowHttpNotSecureExplanation() {} void TestAutofillClient::ShowHttpNotSecureExplanation() {}
bool TestAutofillClient::IsAutofillSupported() {
return true;
}
} // namespace autofill } // namespace autofill
...@@ -77,6 +77,7 @@ class TestAutofillClient : public AutofillClient { ...@@ -77,6 +77,7 @@ class TestAutofillClient : public AutofillClient {
bool ShouldShowSigninPromo() override; bool ShouldShowSigninPromo() override;
void StartSigninFlow() override; void StartSigninFlow() override;
void ShowHttpNotSecureExplanation() override; void ShowHttpNotSecureExplanation() override;
bool IsAutofillSupported() override;
void SetPrefs(std::unique_ptr<PrefService> prefs) { void SetPrefs(std::unique_ptr<PrefService> prefs) {
prefs_ = std::move(prefs); prefs_ = std::move(prefs);
......
...@@ -99,6 +99,7 @@ class AutofillClientIOS : public AutofillClient { ...@@ -99,6 +99,7 @@ class AutofillClientIOS : public AutofillClient {
bool ShouldShowSigninPromo() override; bool ShouldShowSigninPromo() override;
void StartSigninFlow() override; void StartSigninFlow() override;
void ShowHttpNotSecureExplanation() override; void ShowHttpNotSecureExplanation() override;
bool IsAutofillSupported() override;
private: private:
ios::ChromeBrowserState* browser_state_; ios::ChromeBrowserState* browser_state_;
......
...@@ -226,4 +226,8 @@ void AutofillClientIOS::ShowHttpNotSecureExplanation() { ...@@ -226,4 +226,8 @@ void AutofillClientIOS::ShowHttpNotSecureExplanation() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
bool AutofillClientIOS::IsAutofillSupported() {
return true;
}
} // namespace autofill } // namespace autofill
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment