Commit 3c3fc4c7 authored by Mathias Carlen's avatar Mathias Carlen Committed by Commit Bot

[AA] Fix extension api build and test.

The autofill assistant api is behind a compile time flag pending
a build bot to actually exercise some of this code. Password
manager is a newer dependency and was restricted to Android only,
which does not work for the desktop only extension API.

R=arbesser@google.com

Bug: b/143736397
Change-Id: If37cd31e7ba839881d3625ea91e3723236db5a17
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2117751Reviewed-by: default avatarMaxim Kolosovskiy <kolos@chromium.org>
Reviewed-by: default avatarClemens Arbesser <arbesser@google.com>
Commit-Queue: Mathias Carlen <mcarlen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752806}
parent 566afaff
...@@ -41,6 +41,7 @@ AutofillAssistantPrivateCreateFunction:: ...@@ -41,6 +41,7 @@ AutofillAssistantPrivateCreateFunction::
ExtensionFunction::ResponseAction ExtensionFunction::ResponseAction
AutofillAssistantPrivateCreateFunction::Run() { AutofillAssistantPrivateCreateFunction::Run() {
auto* web_contents = GetActiveWebContents(this); auto* web_contents = GetActiveWebContents(this);
CHECK(web_contents);
AutofillAssistantPrivateAPI::GetFactoryInstance() AutofillAssistantPrivateAPI::GetFactoryInstance()
->Get(browser_context()) ->Get(browser_context())
->CreateAutofillAssistantController(web_contents); ->CreateAutofillAssistantController(web_contents);
...@@ -205,11 +206,15 @@ void AutofillAssistantPrivateEventRouter::OnOverlayColorsChanged( ...@@ -205,11 +206,15 @@ void AutofillAssistantPrivateEventRouter::OnOverlayColorsChanged(
const autofill_assistant::UiDelegate::OverlayColors& colors) {} const autofill_assistant::UiDelegate::OverlayColors& colors) {}
void AutofillAssistantPrivateEventRouter::OnFormChanged( void AutofillAssistantPrivateEventRouter::OnFormChanged(
const autofill_assistant::FormProto* form) {} const autofill_assistant::FormProto* form,
const autofill_assistant::FormProto::Result* result) {}
void AutofillAssistantPrivateEventRouter::OnClientSettingsChanged( void AutofillAssistantPrivateEventRouter::OnClientSettingsChanged(
const autofill_assistant::ClientSettings& settings) {} const autofill_assistant::ClientSettings& settings) {}
void AutofillAssistantPrivateEventRouter::OnGenericUserInterfaceChanged(
const autofill_assistant::GenericUserInterfaceProto* generic_ui) {}
void AutofillAssistantPrivateEventRouter::OnExpandBottomSheet() {} void AutofillAssistantPrivateEventRouter::OnExpandBottomSheet() {}
void AutofillAssistantPrivateEventRouter::OnCollapseBottomSheet() {} void AutofillAssistantPrivateEventRouter::OnCollapseBottomSheet() {}
...@@ -309,13 +314,13 @@ void AutofillAssistantPrivateAPI::AttachUI() {} ...@@ -309,13 +314,13 @@ void AutofillAssistantPrivateAPI::AttachUI() {}
void AutofillAssistantPrivateAPI::DestroyUI() {} void AutofillAssistantPrivateAPI::DestroyUI() {}
std::string AutofillAssistantPrivateAPI::GetApiKey() { std::string AutofillAssistantPrivateAPI::GetApiKey() const {
// TODO(crbug.com/1015753): Use chromium's keys and also consider the // TODO(crbug.com/1015753): Use chromium's keys and also consider the
// autofill-assistant-key here to override that particular key. // autofill-assistant-key here to override that particular key.
return "invalid"; return "invalid";
} }
std::string AutofillAssistantPrivateAPI::GetAccountEmailAddress() { std::string AutofillAssistantPrivateAPI::GetAccountEmailAddress() const {
return "joe@example.com"; return "joe@example.com";
} }
...@@ -325,33 +330,39 @@ AutofillAssistantPrivateAPI::GetAccessTokenFetcher() { ...@@ -325,33 +330,39 @@ AutofillAssistantPrivateAPI::GetAccessTokenFetcher() {
} }
autofill::PersonalDataManager* autofill::PersonalDataManager*
AutofillAssistantPrivateAPI::GetPersonalDataManager() { AutofillAssistantPrivateAPI::GetPersonalDataManager() const {
return autofill::PersonalDataManagerFactory::GetForProfile( return autofill::PersonalDataManagerFactory::GetForProfile(
Profile::FromBrowserContext(browser_context_)); Profile::FromBrowserContext(browser_context_));
} }
password_manager::PasswordManagerClient*
AutofillAssistantPrivateAPI::GetPasswordManagerClient() const {
// TODO(crbug.com/1015753): Support credential leak flows.
return nullptr;
}
autofill_assistant::WebsiteLoginFetcher* autofill_assistant::WebsiteLoginFetcher*
AutofillAssistantPrivateAPI::GetWebsiteLoginFetcher() { AutofillAssistantPrivateAPI::GetWebsiteLoginFetcher() const {
return nullptr; return nullptr;
} }
std::string AutofillAssistantPrivateAPI::GetServerUrl() { std::string AutofillAssistantPrivateAPI::GetServerUrl() const {
// TODO(crbug.com/1015753): Consider the autofill-assistant-url for endpoint // TODO(crbug.com/1015753): Consider the autofill-assistant-url for endpoint
// overrides and share the kDefaultAutofillAssistantServerUrl to expose it // overrides and share the kDefaultAutofillAssistantServerUrl to expose it
// here. // here.
return "https://automate-pa.googleapis.com"; return "https://automate-pa.googleapis.com";
} }
std::string AutofillAssistantPrivateAPI::GetLocale() { std::string AutofillAssistantPrivateAPI::GetLocale() const {
return "en-us"; return "en-us";
} }
std::string AutofillAssistantPrivateAPI::GetCountryCode() { std::string AutofillAssistantPrivateAPI::GetCountryCode() const {
return "us"; return "us";
} }
autofill_assistant::DeviceContext autofill_assistant::DeviceContext
AutofillAssistantPrivateAPI::GetDeviceContext() { AutofillAssistantPrivateAPI::GetDeviceContext() const {
return autofill_assistant::DeviceContext(); return autofill_assistant::DeviceContext();
} }
...@@ -363,7 +374,7 @@ void AutofillAssistantPrivateAPI::Shutdown( ...@@ -363,7 +374,7 @@ void AutofillAssistantPrivateAPI::Shutdown(
// to use this method in this context. // to use this method in this context.
// TODO(crbug.com/1015753): Revisit the interfaces used for this extension API // TODO(crbug.com/1015753): Revisit the interfaces used for this extension API
// and introduce new, more concise ones if needed. // and introduce new, more concise ones if needed.
content::WebContents* AutofillAssistantPrivateAPI::GetWebContents() { content::WebContents* AutofillAssistantPrivateAPI::GetWebContents() const {
if (!active_autofill_assistant_) if (!active_autofill_assistant_)
return nullptr; return nullptr;
return active_autofill_assistant_->controller->GetWebContents(); return active_autofill_assistant_->controller->GetWebContents();
......
...@@ -149,9 +149,14 @@ class AutofillAssistantPrivateEventRouter ...@@ -149,9 +149,14 @@ class AutofillAssistantPrivateEventRouter
peek_mode) override; peek_mode) override;
void OnOverlayColorsChanged( void OnOverlayColorsChanged(
const autofill_assistant::UiDelegate::OverlayColors& colors) override; const autofill_assistant::UiDelegate::OverlayColors& colors) override;
void OnFormChanged(const autofill_assistant::FormProto* form) override; void OnFormChanged(
const autofill_assistant::FormProto* form,
const autofill_assistant::FormProto::Result* result) override;
void OnClientSettingsChanged( void OnClientSettingsChanged(
const autofill_assistant::ClientSettings& settings) override; const autofill_assistant::ClientSettings& settings) override;
void OnGenericUserInterfaceChanged(
const autofill_assistant::GenericUserInterfaceProto* generic_ui) override;
void OnExpandBottomSheet() override; void OnExpandBottomSheet() override;
void OnCollapseBottomSheet() override; void OnCollapseBottomSheet() override;
...@@ -191,17 +196,20 @@ class AutofillAssistantPrivateAPI : public BrowserContextKeyedAPI, ...@@ -191,17 +196,20 @@ class AutofillAssistantPrivateAPI : public BrowserContextKeyedAPI,
// autofill_assistant::Client: // autofill_assistant::Client:
void AttachUI() override; void AttachUI() override;
void DestroyUI() override; void DestroyUI() override;
std::string GetApiKey() override; std::string GetApiKey() const override;
std::string GetAccountEmailAddress() override; std::string GetAccountEmailAddress() const override;
autofill_assistant::AccessTokenFetcher* GetAccessTokenFetcher() override; autofill_assistant::AccessTokenFetcher* GetAccessTokenFetcher() override;
autofill::PersonalDataManager* GetPersonalDataManager() override; autofill::PersonalDataManager* GetPersonalDataManager() const override;
autofill_assistant::WebsiteLoginFetcher* GetWebsiteLoginFetcher() override; password_manager::PasswordManagerClient* GetPasswordManagerClient()
std::string GetServerUrl() override; const override;
std::string GetLocale() override; autofill_assistant::WebsiteLoginFetcher* GetWebsiteLoginFetcher()
std::string GetCountryCode() override; const override;
autofill_assistant::DeviceContext GetDeviceContext() override; std::string GetServerUrl() const override;
std::string GetLocale() const override;
std::string GetCountryCode() const override;
autofill_assistant::DeviceContext GetDeviceContext() const override;
void Shutdown(autofill_assistant::Metrics::DropOutReason reason) override; void Shutdown(autofill_assistant::Metrics::DropOutReason reason) override;
content::WebContents* GetWebContents() override; content::WebContents* GetWebContents() const override;
// BrowserContextKeyedAPI: // BrowserContextKeyedAPI:
void Shutdown() override; void Shutdown() override;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
const expectedMessages = ['Opening localhost', 'This is a test status.']; const expectedMessages = ['Opening version', 'This is a test status.'];
function actionsChangedListener(actions) { function actionsChangedListener(actions) {
chrome.test.assertEq(2, actions.length); chrome.test.assertEq(2, actions.length);
......
...@@ -73,11 +73,9 @@ bool PasswordManagerClient::WasLastNavigationHTTPError() const { ...@@ -73,11 +73,9 @@ bool PasswordManagerClient::WasLastNavigationHTTPError() const {
return false; return false;
} }
#if defined(OS_ANDROID)
bool PasswordManagerClient::WasCredentialLeakDialogShown() const { bool PasswordManagerClient::WasCredentialLeakDialogShown() const {
return false; return false;
} }
#endif
net::CertStatus PasswordManagerClient::GetMainFrameCertStatus() const { net::CertStatus PasswordManagerClient::GetMainFrameCertStatus() const {
return 0; return 0;
......
...@@ -258,12 +258,10 @@ class PasswordManagerClient { ...@@ -258,12 +258,10 @@ class PasswordManagerClient {
// Returns true if last navigation page had HTTP error i.e 5XX or 4XX // Returns true if last navigation page had HTTP error i.e 5XX or 4XX
virtual bool WasLastNavigationHTTPError() const; virtual bool WasLastNavigationHTTPError() const;
#if defined(OS_ANDROID)
// Returns true if a credential leak dialog was shown. Used by Autofill // Returns true if a credential leak dialog was shown. Used by Autofill
// Assistance to verify a password change intent. TODO(b/151391231): Remove // Assistance to verify a password change intent. TODO(b/151391231): Remove
// when proper intent signing is implemented. // when proper intent signing is implemented.
virtual bool WasCredentialLeakDialogShown() const; virtual bool WasCredentialLeakDialogShown() const;
#endif
// Obtains the cert status for the main frame. // Obtains the cert status for the main frame.
virtual net::CertStatus GetMainFrameCertStatus() const; virtual net::CertStatus GetMainFrameCertStatus() const;
......
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