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