Commit 26d5f1f5 authored by Olivier Robin's avatar Olivier Robin Committed by Commit Bot

Move FormActivityParams to components/autofill

The Form activity observer is now isolated from ios/web.
Move the FormActivityParams to the component.

Bug: 823285
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: I4a8b9184587214a4c57839440e5ef812557b917a
Reviewed-on: https://chromium-review.googlesource.com/1193880Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarMike Dougherty <michaeldo@chromium.org>
Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589123}
parent a294826b
...@@ -36,11 +36,11 @@ ...@@ -36,11 +36,11 @@
#import "components/autofill/ios/browser/form_suggestion.h" #import "components/autofill/ios/browser/form_suggestion.h"
#import "components/autofill/ios/browser/js_autofill_manager.h" #import "components/autofill/ios/browser/js_autofill_manager.h"
#import "components/autofill/ios/form_util/form_activity_observer_bridge.h" #import "components/autofill/ios/form_util/form_activity_observer_bridge.h"
#include "components/autofill/ios/form_util/form_activity_params.h"
#import "components/prefs/ios/pref_observer_bridge.h" #import "components/prefs/ios/pref_observer_bridge.h"
#include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "ios/web/public/url_scheme_util.h" #include "ios/web/public/url_scheme_util.h"
#include "ios/web/public/web_state/form_activity_params.h"
#import "ios/web/public/web_state/js/crw_js_injection_receiver.h" #import "ios/web/public/web_state/js/crw_js_injection_receiver.h"
#import "ios/web/public/web_state/navigation_context.h" #import "ios/web/public/web_state/navigation_context.h"
#include "ios/web/public/web_state/url_verification_constants.h" #include "ios/web/public/web_state/url_verification_constants.h"
...@@ -583,7 +583,7 @@ void GetFormAndField(autofill::FormData* form, ...@@ -583,7 +583,7 @@ void GetFormAndField(autofill::FormData* form,
#pragma mark FormActivityObserver #pragma mark FormActivityObserver
- (void)webState:(web::WebState*)webState - (void)webState:(web::WebState*)webState
didRegisterFormActivity:(const web::FormActivityParams&)params { didRegisterFormActivity:(const autofill::FormActivityParams&)params {
if (![self isAutofillEnabled]) if (![self isAutofillEnabled])
return; return;
......
...@@ -11,6 +11,8 @@ source_set("form_util") { ...@@ -11,6 +11,8 @@ source_set("form_util") {
"form_activity_observer.h", "form_activity_observer.h",
"form_activity_observer_bridge.h", "form_activity_observer_bridge.h",
"form_activity_observer_bridge.mm", "form_activity_observer_bridge.mm",
"form_activity_params.cc",
"form_activity_params.h",
"form_activity_tab_helper.h", "form_activity_tab_helper.h",
"form_activity_tab_helper.mm", "form_activity_tab_helper.mm",
] ]
......
...@@ -11,11 +11,12 @@ ...@@ -11,11 +11,12 @@
namespace web { namespace web {
class WebState; class WebState;
struct FormActivityParams;
} // namespace web } // namespace web
namespace autofill { namespace autofill {
struct FormActivityParams;
// Interface for observing form activity. // Interface for observing form activity.
// It is the responsibility of the observer to unregister if the web_state // It is the responsibility of the observer to unregister if the web_state
// becomes invalid. // becomes invalid.
...@@ -27,8 +28,9 @@ class FormActivityObserver { ...@@ -27,8 +28,9 @@ class FormActivityObserver {
// Called when the user is typing on a form field in the main frame or in a // Called when the user is typing on a form field in the main frame or in a
// same-origin iframe. |params.input_missing| is indicating if there is any // same-origin iframe. |params.input_missing| is indicating if there is any
// error when parsing the form field information. // error when parsing the form field information.
virtual void FormActivityRegistered(web::WebState* web_state, virtual void FormActivityRegistered(
const web::FormActivityParams& params) {} web::WebState* web_state,
const FormActivityParams& params) {}
// Called on form submission in the main frame or in a same-origin iframe. // Called on form submission in the main frame or in a same-origin iframe.
// |has_user_gesture| is true if the user interacted with the page. // |has_user_gesture| is true if the user interacted with the page.
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
@optional @optional
// Invoked by WebStateObserverBridge::FormActivity. // Invoked by WebStateObserverBridge::FormActivity.
- (void)webState:(web::WebState*)webState - (void)webState:(web::WebState*)webState
didRegisterFormActivity:(const web::FormActivityParams&)params; didRegisterFormActivity:(const autofill::FormActivityParams&)params;
// Invoked by WebStateObserverBridge::DidSubmitDocument. // Invoked by WebStateObserverBridge::DidSubmitDocument.
- (void)webState:(web::WebState*)webState - (void)webState:(web::WebState*)webState
...@@ -41,8 +41,9 @@ class FormActivityObserverBridge : public FormActivityObserver { ...@@ -41,8 +41,9 @@ class FormActivityObserverBridge : public FormActivityObserver {
~FormActivityObserverBridge() override; ~FormActivityObserverBridge() override;
// FormActivityObserver overrides: // FormActivityObserver overrides:
void FormActivityRegistered(web::WebState* web_state, void FormActivityRegistered(
const web::FormActivityParams& params) override; web::WebState* web_state,
const FormActivityParams& params) override;
void DocumentSubmitted(web::WebState* web_state, void DocumentSubmitted(web::WebState* web_state,
const std::string& form_name, const std::string& form_name,
......
...@@ -26,7 +26,7 @@ FormActivityObserverBridge::~FormActivityObserverBridge() { ...@@ -26,7 +26,7 @@ FormActivityObserverBridge::~FormActivityObserverBridge() {
void FormActivityObserverBridge::FormActivityRegistered( void FormActivityObserverBridge::FormActivityRegistered(
web::WebState* web_state, web::WebState* web_state,
const web::FormActivityParams& params) { const FormActivityParams& params) {
DCHECK_EQ(web_state, web_state_); DCHECK_EQ(web_state, web_state_);
if ([owner_ if ([owner_
respondsToSelector:@selector(webState:didRegisterFormActivity:)]) { respondsToSelector:@selector(webState:didRegisterFormActivity:)]) {
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
} }
- (void)webState:(web::WebState*)webState - (void)webState:(web::WebState*)webState
didRegisterFormActivity:(const web::FormActivityParams&)params { didRegisterFormActivity:(const autofill::FormActivityParams&)params {
_formActivityInfo = std::make_unique<autofill::TestFormActivityInfo>(); _formActivityInfo = std::make_unique<autofill::TestFormActivityInfo>();
_formActivityInfo->web_state = webState; _formActivityInfo->web_state = webState;
_formActivityInfo->form_activity = params; _formActivityInfo->form_activity = params;
...@@ -91,7 +91,7 @@ TEST_F(FormActivityObserverBridgeTest, DocumentSubmitted) { ...@@ -91,7 +91,7 @@ TEST_F(FormActivityObserverBridgeTest, DocumentSubmitted) {
TEST_F(FormActivityObserverBridgeTest, FormActivityRegistered) { TEST_F(FormActivityObserverBridgeTest, FormActivityRegistered) {
ASSERT_FALSE([observer_ formActivityInfo]); ASSERT_FALSE([observer_ formActivityInfo]);
web::FormActivityParams params; autofill::FormActivityParams params;
params.form_name = "form-name"; params.form_name = "form-name";
params.field_name = "field-name"; params.field_name = "field-name";
params.field_type = "field-type"; params.field_type = "field-type";
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
// 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.
#include "ios/web/public/web_state/form_activity_params.h" #include "components/autofill/ios/form_util/form_activity_params.h"
namespace web { namespace autofill {
FormActivityParams::FormActivityParams() = default; FormActivityParams::FormActivityParams() = default;
FormActivityParams::FormActivityParams(const FormActivityParams& other) = FormActivityParams::FormActivityParams(const FormActivityParams& other) =
default; default;
FormActivityParams::~FormActivityParams() = default; FormActivityParams::~FormActivityParams() = default;
} // namespace web } // namespace autofill
// Copyright 2017 The Chromium Authors. All rights reserved. // Copyright 2017 The Chromium Authors. All rights reserved.
// 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.
#ifndef IOS_WEB_PUBLIC_WEB_STATE_FORM_ACTIVITY_PARAMS_H_ #ifndef COMPONENTS_AUTOFILL_IOS_FORM_UTIL_FORM_ACTIVITY_PARAMS_H_
#define IOS_WEB_PUBLIC_WEB_STATE_FORM_ACTIVITY_PARAMS_H_ #define COMPONENTS_AUTOFILL_IOS_FORM_UTIL_FORM_ACTIVITY_PARAMS_H_
#include <string> #include <string>
namespace web { namespace autofill {
// Wraps information about event happening in a form. // Wraps information about event happening in a form.
// Example HTML // Example HTML
...@@ -48,6 +48,6 @@ struct FormActivityParams { ...@@ -48,6 +48,6 @@ struct FormActivityParams {
bool has_user_gesture = false; bool has_user_gesture = false;
}; };
} // namespace web } // namespace autofill
#endif // IOS_WEB_PUBLIC_WEB_STATE_FORM_ACTIVITY_PARAMS_H_ #endif // COMPONENTS_AUTOFILL_IOS_FORM_UTIL_FORM_ACTIVITY_PARAMS_H_
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "base/values.h" #include "base/values.h"
#include "components/autofill/ios/form_util/form_activity_observer.h" #include "components/autofill/ios/form_util/form_activity_observer.h"
#include "ios/web/public/web_state/form_activity_params.h" #include "components/autofill/ios/form_util/form_activity_params.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
...@@ -83,7 +83,7 @@ bool FormActivityTabHelper::HandleFormActivity( ...@@ -83,7 +83,7 @@ bool FormActivityTabHelper::HandleFormActivity(
const base::DictionaryValue& message, const base::DictionaryValue& message,
bool has_user_gesture, bool has_user_gesture,
bool form_in_main_frame) { bool form_in_main_frame) {
web::FormActivityParams params; FormActivityParams params;
if (!message.GetString("formName", &params.form_name) || if (!message.GetString("formName", &params.form_name) ||
!message.GetString("fieldName", &params.field_name) || !message.GetString("fieldName", &params.field_name) ||
!message.GetString("fieldIdentifier", &params.field_identifier) || !message.GetString("fieldIdentifier", &params.field_identifier) ||
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define COMPONENTS_AUTOFILL_IOS_FORM_UTIL_TEST_FORM_ACTIVITY_OBSERVER_H_ #define COMPONENTS_AUTOFILL_IOS_FORM_UTIL_TEST_FORM_ACTIVITY_OBSERVER_H_
#include "components/autofill/ios/form_util/form_activity_observer.h" #include "components/autofill/ios/form_util/form_activity_observer.h"
#include "ios/web/public/web_state/form_activity_params.h" #include "components/autofill/ios/form_util/form_activity_params.h"
namespace web { namespace web {
class WebState; class WebState;
...@@ -24,7 +24,7 @@ struct TestSubmitDocumentInfo { ...@@ -24,7 +24,7 @@ struct TestSubmitDocumentInfo {
// Arguments passed to |FormActivityRegistered|. // Arguments passed to |FormActivityRegistered|.
struct TestFormActivityInfo { struct TestFormActivityInfo {
web::WebState* web_state; web::WebState* web_state;
web::FormActivityParams form_activity; FormActivityParams form_activity;
}; };
class TestFormActivityObserver : public autofill::FormActivityObserver { class TestFormActivityObserver : public autofill::FormActivityObserver {
...@@ -44,7 +44,7 @@ class TestFormActivityObserver : public autofill::FormActivityObserver { ...@@ -44,7 +44,7 @@ class TestFormActivityObserver : public autofill::FormActivityObserver {
bool form_in_main_frame) override; bool form_in_main_frame) override;
void FormActivityRegistered(web::WebState* web_state, void FormActivityRegistered(web::WebState* web_state,
const web::FormActivityParams& params) override; const FormActivityParams& params) override;
private: private:
web::WebState* web_state_ = nullptr; web::WebState* web_state_ = nullptr;
......
...@@ -38,7 +38,7 @@ void TestFormActivityObserver::DocumentSubmitted(web::WebState* web_state, ...@@ -38,7 +38,7 @@ void TestFormActivityObserver::DocumentSubmitted(web::WebState* web_state,
void TestFormActivityObserver::FormActivityRegistered( void TestFormActivityObserver::FormActivityRegistered(
web::WebState* web_state, web::WebState* web_state,
const web::FormActivityParams& params) { const FormActivityParams& params) {
ASSERT_EQ(web_state_, web_state); ASSERT_EQ(web_state_, web_state);
form_activity_info_ = std::make_unique<TestFormActivityInfo>(); form_activity_info_ = std::make_unique<TestFormActivityInfo>();
form_activity_info_->web_state = web_state; form_activity_info_->web_state = web_state;
......
...@@ -10,18 +10,19 @@ ...@@ -10,18 +10,19 @@
#include "base/macros.h" #include "base/macros.h"
namespace web { namespace web {
struct FormActivityParams;
class WebState; class WebState;
} // namespace web } // namespace web
namespace autofill { namespace autofill {
struct FormActivityParams;
class TestFormActivityTabHelper { class TestFormActivityTabHelper {
public: public:
explicit TestFormActivityTabHelper(web::WebState* web_state); explicit TestFormActivityTabHelper(web::WebState* web_state);
~TestFormActivityTabHelper(); ~TestFormActivityTabHelper();
void FormActivityRegistered(const web::FormActivityParams& params); void FormActivityRegistered(const FormActivityParams& params);
void DocumentSubmitted(const std::string& form_name, void DocumentSubmitted(const std::string& form_name,
bool has_user_gesture, bool has_user_gesture,
bool form_in_main_frame); bool form_in_main_frame);
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#include "base/observer_list.h" #include "base/observer_list.h"
#include "components/autofill/ios/form_util/form_activity_observer.h" #include "components/autofill/ios/form_util/form_activity_observer.h"
#include "components/autofill/ios/form_util/form_activity_params.h"
#include "components/autofill/ios/form_util/form_activity_tab_helper.h" #include "components/autofill/ios/form_util/form_activity_tab_helper.h"
#include "ios/web/public/web_state/form_activity_params.h"
#include "ios/web/public/web_state/web_state.h" #include "ios/web/public/web_state/web_state.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
...@@ -21,7 +21,7 @@ TestFormActivityTabHelper::TestFormActivityTabHelper(web::WebState* web_state) ...@@ -21,7 +21,7 @@ TestFormActivityTabHelper::TestFormActivityTabHelper(web::WebState* web_state)
TestFormActivityTabHelper::~TestFormActivityTabHelper() {} TestFormActivityTabHelper::~TestFormActivityTabHelper() {}
void TestFormActivityTabHelper::FormActivityRegistered( void TestFormActivityTabHelper::FormActivityRegistered(
web::FormActivityParams const& params) { FormActivityParams const& params) {
autofill::FormActivityTabHelper* form_activity_tab_helper = autofill::FormActivityTabHelper* form_activity_tab_helper =
autofill::FormActivityTabHelper::GetOrCreateForWebState(web_state_); autofill::FormActivityTabHelper::GetOrCreateForWebState(web_state_);
for (auto& observer : form_activity_tab_helper->observers_) { for (auto& observer : form_activity_tab_helper->observers_) {
......
...@@ -52,6 +52,7 @@ source_set("autofill") { ...@@ -52,6 +52,7 @@ source_set("autofill") {
"//base:i18n", "//base:i18n",
"//components/autofill/core/browser", "//components/autofill/core/browser",
"//components/autofill/ios/browser", "//components/autofill/ios/browser",
"//components/autofill/ios/form_util",
"//components/keyed_service/core", "//components/keyed_service/core",
"//components/keyed_service/ios", "//components/keyed_service/ios",
"//components/prefs", "//components/prefs",
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
@synthesize suggestions = _suggestions; @synthesize suggestions = _suggestions;
@synthesize suggestionRetrievalComplete = _suggestionRetrievalComplete; @synthesize suggestionRetrievalComplete = _suggestionRetrievalComplete;
- (void)retrieveSuggestionsForForm:(const web::FormActivityParams&)params - (void)retrieveSuggestionsForForm:(const autofill::FormActivityParams&)params
webState:(web::WebState*)webState { webState:(web::WebState*)webState {
self.suggestionRetrievalComplete = NO; self.suggestionRetrievalComplete = NO;
[super retrieveSuggestionsForForm:params webState:webState]; [super retrieveSuggestionsForForm:params webState:webState];
......
...@@ -30,7 +30,7 @@ typedef void (^AccessoryViewReadyCompletion)( ...@@ -30,7 +30,7 @@ typedef void (^AccessoryViewReadyCompletion)(
// Asynchronously retrieves an accessory view from this provider for the // Asynchronously retrieves an accessory view from this provider for the
// specified form/field and returns it via |accessoryViewUpdateBlock|. View // specified form/field and returns it via |accessoryViewUpdateBlock|. View
// will be nil if no accessories are available from this provider. // will be nil if no accessories are available from this provider.
- (void)retrieveAccessoryViewForForm:(const web::FormActivityParams&)params - (void)retrieveAccessoryViewForForm:(const autofill::FormActivityParams&)params
webState:(web::WebState*)webState webState:(web::WebState*)webState
accessoryViewUpdateBlock: accessoryViewUpdateBlock:
(AccessoryViewReadyCompletion)accessoryViewUpdateBlock; (AccessoryViewReadyCompletion)accessoryViewUpdateBlock;
......
...@@ -14,9 +14,12 @@ ...@@ -14,9 +14,12 @@
#import "ios/chrome/browser/autofill/form_suggestion_view_client.h" #import "ios/chrome/browser/autofill/form_suggestion_view_client.h"
#import "ios/web/public/web_state/web_state_observer_bridge.h" #import "ios/web/public/web_state/web_state_observer_bridge.h"
namespace autofill {
struct FormActivityParams;
}
namespace web { namespace web {
class WebState; class WebState;
struct FormActivityParams;
} }
@protocol CRWWebViewProxy; @protocol CRWWebViewProxy;
...@@ -38,7 +41,7 @@ struct FormActivityParams; ...@@ -38,7 +41,7 @@ struct FormActivityParams;
// Finds a FormSuggestionProvider that can supply suggestions for the specified // Finds a FormSuggestionProvider that can supply suggestions for the specified
// form, requests them, and updates the view accordingly. // form, requests them, and updates the view accordingly.
- (void)retrieveSuggestionsForForm:(const web::FormActivityParams&)params - (void)retrieveSuggestionsForForm:(const autofill::FormActivityParams&)params
webState:(web::WebState*)webState; webState:(web::WebState*)webState;
// Instructs the controller to detach itself from the WebState. // Instructs the controller to detach itself from the WebState.
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "components/autofill/core/common/autofill_features.h" #include "components/autofill/core/common/autofill_features.h"
#import "components/autofill/ios/browser/form_suggestion.h" #import "components/autofill/ios/browser/form_suggestion.h"
#import "components/autofill/ios/browser/form_suggestion_provider.h" #import "components/autofill/ios/browser/form_suggestion_provider.h"
#include "components/autofill/ios/form_util/form_activity_params.h"
#import "ios/chrome/browser/autofill/form_input_accessory_view_controller.h" #import "ios/chrome/browser/autofill/form_input_accessory_view_controller.h"
#import "ios/chrome/browser/autofill/form_input_accessory_view_delegate.h" #import "ios/chrome/browser/autofill/form_input_accessory_view_delegate.h"
#import "ios/chrome/browser/autofill/form_input_accessory_view_provider.h" #import "ios/chrome/browser/autofill/form_input_accessory_view_provider.h"
...@@ -22,7 +23,6 @@ ...@@ -22,7 +23,6 @@
#import "ios/chrome/browser/passwords/password_generation_utils.h" #import "ios/chrome/browser/passwords/password_generation_utils.h"
#include "ios/chrome/browser/ui/ui_util.h" #include "ios/chrome/browser/ui/ui_util.h"
#import "ios/web/public/url_scheme_util.h" #import "ios/web/public/url_scheme_util.h"
#include "ios/web/public/web_state/form_activity_params.h"
#import "ios/web/public/web_state/js/crw_js_injection_receiver.h" #import "ios/web/public/web_state/js/crw_js_injection_receiver.h"
#import "ios/web/public/web_state/ui/crw_web_view_proxy.h" #import "ios/web/public/web_state/ui/crw_web_view_proxy.h"
#import "ios/web/public/web_state/web_state.h" #import "ios/web/public/web_state/web_state.h"
...@@ -186,7 +186,7 @@ AutofillSuggestionState::AutofillSuggestionState( ...@@ -186,7 +186,7 @@ AutofillSuggestionState::AutofillSuggestionState(
_webViewProxy = webViewProxy; _webViewProxy = webViewProxy;
} }
- (void)retrieveSuggestionsForForm:(const web::FormActivityParams&)params - (void)retrieveSuggestionsForForm:(const autofill::FormActivityParams&)params
webState:(web::WebState*)webState { webState:(web::WebState*)webState {
__weak FormSuggestionController* weakSelf = self; __weak FormSuggestionController* weakSelf = self;
NSString* strongFormName = base::SysUTF8ToNSString(params.form_name); NSString* strongFormName = base::SysUTF8ToNSString(params.form_name);
...@@ -370,7 +370,7 @@ AutofillSuggestionState::AutofillSuggestionState( ...@@ -370,7 +370,7 @@ AutofillSuggestionState::AutofillSuggestionState(
_delegate = delegate; _delegate = delegate;
} }
- (void)retrieveAccessoryViewForForm:(const web::FormActivityParams&)params - (void)retrieveAccessoryViewForForm:(const autofill::FormActivityParams&)params
webState:(web::WebState*)webState webState:(web::WebState*)webState
accessoryViewUpdateBlock: accessoryViewUpdateBlock:
(AccessoryViewReadyCompletion)accessoryViewUpdateBlock { (AccessoryViewReadyCompletion)accessoryViewUpdateBlock {
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#import "components/autofill/ios/browser/form_suggestion.h" #import "components/autofill/ios/browser/form_suggestion.h"
#import "components/autofill/ios/browser/form_suggestion_provider.h" #import "components/autofill/ios/browser/form_suggestion_provider.h"
#import "components/autofill/ios/form_util/form_activity_observer_bridge.h" #import "components/autofill/ios/form_util/form_activity_observer_bridge.h"
#include "components/autofill/ios/form_util/form_activity_params.h"
#include "components/autofill/ios/form_util/test_form_activity_tab_helper.h" #include "components/autofill/ios/form_util/test_form_activity_tab_helper.h"
#import "ios/chrome/browser/autofill/form_input_accessory_consumer.h" #import "ios/chrome/browser/autofill/form_input_accessory_consumer.h"
#import "ios/chrome/browser/autofill/form_suggestion_view.h" #import "ios/chrome/browser/autofill/form_suggestion_view.h"
...@@ -20,7 +21,6 @@ ...@@ -20,7 +21,6 @@
#include "ios/chrome/browser/ui/ui_util.h" #include "ios/chrome/browser/ui/ui_util.h"
#import "ios/web/public/navigation_manager.h" #import "ios/web/public/navigation_manager.h"
#import "ios/web/public/test/fakes/test_web_state.h" #import "ios/web/public/test/fakes/test_web_state.h"
#include "ios/web/public/web_state/form_activity_params.h"
#import "ios/web/public/web_state/ui/crw_web_view_proxy.h" #import "ios/web/public/web_state/ui/crw_web_view_proxy.h"
#import "ios/web/public/web_state/web_state.h" #import "ios/web/public/web_state/web_state.h"
#import "testing/gtest_mac.h" #import "testing/gtest_mac.h"
...@@ -259,7 +259,7 @@ TEST_F(FormSuggestionControllerTest, ...@@ -259,7 +259,7 @@ TEST_F(FormSuggestionControllerTest,
test_web_state_.SetCurrentURL(GURL("http://foo.com")); test_web_state_.SetCurrentURL(GURL("http://foo.com"));
// Trigger form activity, which should set up the suggestions view. // Trigger form activity, which should set up the suggestions view.
web::FormActivityParams params; autofill::FormActivityParams params;
params.form_name = "form"; params.form_name = "form";
params.field_name = "field"; params.field_name = "field";
params.field_identifier = "field_id"; params.field_identifier = "field_id";
...@@ -278,7 +278,7 @@ TEST_F(FormSuggestionControllerTest, ...@@ -278,7 +278,7 @@ TEST_F(FormSuggestionControllerTest,
// Tests that "blur" events are ignored. // Tests that "blur" events are ignored.
TEST_F(FormSuggestionControllerTest, FormActivityBlurShouldBeIgnored) { TEST_F(FormSuggestionControllerTest, FormActivityBlurShouldBeIgnored) {
web::FormActivityParams params; autofill::FormActivityParams params;
params.form_name = "form"; params.form_name = "form";
params.field_name = "field"; params.field_name = "field";
params.field_identifier = "field_id"; params.field_identifier = "field_id";
...@@ -296,7 +296,7 @@ TEST_F(FormSuggestionControllerTest, ...@@ -296,7 +296,7 @@ TEST_F(FormSuggestionControllerTest,
// Set up the controller without any providers. // Set up the controller without any providers.
SetUpController(@[]); SetUpController(@[]);
test_web_state_.SetCurrentURL(GURL("http://foo.com")); test_web_state_.SetCurrentURL(GURL("http://foo.com"));
web::FormActivityParams params; autofill::FormActivityParams params;
params.form_name = "form"; params.form_name = "form";
params.field_name = "field"; params.field_name = "field";
params.field_identifier = "field_id"; params.field_identifier = "field_id";
...@@ -325,7 +325,7 @@ TEST_F(FormSuggestionControllerTest, ...@@ -325,7 +325,7 @@ TEST_F(FormSuggestionControllerTest,
SetUpController(@[ provider1, provider2 ]); SetUpController(@[ provider1, provider2 ]);
test_web_state_.SetCurrentURL(GURL("http://foo.com")); test_web_state_.SetCurrentURL(GURL("http://foo.com"));
web::FormActivityParams params; autofill::FormActivityParams params;
params.form_name = "form"; params.form_name = "form";
params.field_name = "field"; params.field_name = "field";
params.field_identifier = "field_id"; params.field_identifier = "field_id";
...@@ -375,7 +375,7 @@ TEST_F(FormSuggestionControllerTest, ...@@ -375,7 +375,7 @@ TEST_F(FormSuggestionControllerTest,
SetUpController(@[ provider1, provider2 ]); SetUpController(@[ provider1, provider2 ]);
test_web_state_.SetCurrentURL(GURL("http://foo.com")); test_web_state_.SetCurrentURL(GURL("http://foo.com"));
web::FormActivityParams params; autofill::FormActivityParams params;
params.form_name = "form"; params.form_name = "form";
params.field_name = "field"; params.field_name = "field";
params.field_identifier = "field_id"; params.field_identifier = "field_id";
...@@ -415,7 +415,7 @@ TEST_F(FormSuggestionControllerTest, SelectingSuggestionShouldNotifyDelegate) { ...@@ -415,7 +415,7 @@ TEST_F(FormSuggestionControllerTest, SelectingSuggestionShouldNotifyDelegate) {
[[TestSuggestionProvider alloc] initWithSuggestions:suggestions]; [[TestSuggestionProvider alloc] initWithSuggestions:suggestions];
SetUpController(@[ provider ]); SetUpController(@[ provider ]);
test_web_state_.SetCurrentURL(GURL("http://foo.com")); test_web_state_.SetCurrentURL(GURL("http://foo.com"));
web::FormActivityParams params; autofill::FormActivityParams params;
params.form_name = "form"; params.form_name = "form";
params.field_name = "field"; params.field_name = "field";
params.field_identifier = "field_id"; params.field_identifier = "field_id";
......
...@@ -42,8 +42,9 @@ class InsecureInputTabHelper ...@@ -42,8 +42,9 @@ class InsecureInputTabHelper
explicit InsecureInputTabHelper(web::WebState* web_state); explicit InsecureInputTabHelper(web::WebState* web_state);
// FormActivityObserver implementation. // FormActivityObserver implementation.
void FormActivityRegistered(web::WebState* web_state, void FormActivityRegistered(
const web::FormActivityParams& params) override; web::WebState* web_state,
const autofill::FormActivityParams& params) override;
// WebStateObserver implementation. // WebStateObserver implementation.
void WebStateDestroyed(web::WebState* web_state) override; void WebStateDestroyed(web::WebState* web_state) override;
......
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
#include <memory> #include <memory>
#include "base/logging.h" #include "base/logging.h"
#include "components/autofill/ios/form_util/form_activity_params.h"
#include "components/autofill/ios/form_util/form_activity_tab_helper.h" #include "components/autofill/ios/form_util/form_activity_tab_helper.h"
#include "components/security_state/ios/ssl_status_input_event_data.h" #include "components/security_state/ios/ssl_status_input_event_data.h"
#import "ios/web/public/navigation_item.h" #import "ios/web/public/navigation_item.h"
#import "ios/web/public/navigation_manager.h" #import "ios/web/public/navigation_manager.h"
#import "ios/web/public/origin_util.h" #import "ios/web/public/origin_util.h"
#include "ios/web/public/web_state/form_activity_params.h"
#import "ios/web/public/web_state/web_state.h" #import "ios/web/public/web_state/web_state.h"
#import "ios/web/public/web_state/web_state_user_data.h" #import "ios/web/public/web_state/web_state_user_data.h"
...@@ -122,7 +122,7 @@ InsecureInputTabHelper::InsecureInputTabHelper(web::WebState* web_state) ...@@ -122,7 +122,7 @@ InsecureInputTabHelper::InsecureInputTabHelper(web::WebState* web_state)
void InsecureInputTabHelper::FormActivityRegistered( void InsecureInputTabHelper::FormActivityRegistered(
web::WebState* web_state, web::WebState* web_state,
const web::FormActivityParams& params) { const autofill::FormActivityParams& params) {
DCHECK_EQ(web_state_, web_state); DCHECK_EQ(web_state_, web_state);
if (params.type == "input" && if (params.type == "input" &&
!web::IsOriginSecure(web_state->GetLastCommittedURL())) { !web::IsOriginSecure(web_state->GetLastCommittedURL())) {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/mac/scoped_block.h" #include "base/mac/scoped_block.h"
#import "components/autofill/ios/browser/js_suggestion_manager.h" #import "components/autofill/ios/browser/js_suggestion_manager.h"
#import "components/autofill/ios/form_util/form_activity_observer_bridge.h" #import "components/autofill/ios/form_util/form_activity_observer_bridge.h"
#include "components/autofill/ios/form_util/form_activity_params.h"
#import "ios/chrome/browser/autofill/form_input_accessory_consumer.h" #import "ios/chrome/browser/autofill/form_input_accessory_consumer.h"
#import "ios/chrome/browser/autofill/form_input_accessory_view_handler.h" #import "ios/chrome/browser/autofill/form_input_accessory_view_handler.h"
#import "ios/chrome/browser/autofill/form_input_accessory_view_provider.h" #import "ios/chrome/browser/autofill/form_input_accessory_view_provider.h"
...@@ -17,7 +18,6 @@ ...@@ -17,7 +18,6 @@
#include "ios/chrome/browser/ui/ui_util.h" #include "ios/chrome/browser/ui/ui_util.h"
#import "ios/chrome/browser/web_state_list/web_state_list.h" #import "ios/chrome/browser/web_state_list/web_state_list.h"
#import "ios/web/public/url_scheme_util.h" #import "ios/web/public/url_scheme_util.h"
#include "ios/web/public/web_state/form_activity_params.h"
#import "ios/web/public/web_state/js/crw_js_injection_receiver.h" #import "ios/web/public/web_state/js/crw_js_injection_receiver.h"
#include "ios/web/public/web_state/web_state.h" #include "ios/web/public/web_state/web_state.h"
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
#pragma mark - FormActivityObserver #pragma mark - FormActivityObserver
- (void)webState:(web::WebState*)webState - (void)webState:(web::WebState*)webState
didRegisterFormActivity:(const web::FormActivityParams&)params { didRegisterFormActivity:(const autofill::FormActivityParams&)params {
DCHECK_EQ(_webState, webState); DCHECK_EQ(_webState, webState);
web::URLVerificationTrustLevel trustLevel; web::URLVerificationTrustLevel trustLevel;
const GURL pageURL(webState->GetCurrentURL(&trustLevel)); const GURL pageURL(webState->GetCurrentURL(&trustLevel));
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
// Asynchronously queries the providers for an accessory view. Sends it to // Asynchronously queries the providers for an accessory view. Sends it to
// the consumer if found. // the consumer if found.
- (void)retrieveAccessoryViewForForm:(const web::FormActivityParams&)params - (void)retrieveAccessoryViewForForm:(const autofill::FormActivityParams&)params
webState:(web::WebState*)webState { webState:(web::WebState*)webState {
DCHECK_EQ(webState, self.webState); DCHECK_EQ(webState, self.webState);
// Build a block for each provider that will invoke its completion with YES // Build a block for each provider that will invoke its completion with YES
...@@ -267,7 +267,7 @@ ...@@ -267,7 +267,7 @@
// params. // params.
- (passwords::PipelineBlock) - (passwords::PipelineBlock)
queryViewBlockForProvider:(id<FormInputAccessoryViewProvider>)provider queryViewBlockForProvider:(id<FormInputAccessoryViewProvider>)provider
params:(web::FormActivityParams)params { params:(autofill::FormActivityParams)params {
__weak __typeof(self) weakSelf = self; __weak __typeof(self) weakSelf = self;
return ^(void (^completion)(BOOL success)) { return ^(void (^completion)(BOOL success)) {
FormInputAccessoryMediator* strongSelf = weakSelf; FormInputAccessoryMediator* strongSelf = weakSelf;
......
...@@ -65,7 +65,6 @@ source_set("public") { ...@@ -65,7 +65,6 @@ source_set("public") {
"web_client.h", "web_client.h",
"web_kit_constants.h", "web_kit_constants.h",
"web_state/context_menu_params.h", "web_state/context_menu_params.h",
"web_state/form_activity_params.h",
"web_state/global_web_state_observer.h", "web_state/global_web_state_observer.h",
"web_state/js/crw_js_injection_evaluator.h", "web_state/js/crw_js_injection_evaluator.h",
"web_state/js/crw_js_injection_manager.h", "web_state/js/crw_js_injection_manager.h",
......
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
#endif #endif
namespace web { namespace web {
TestFormActivityInfo::TestFormActivityInfo() {}
TestFormActivityInfo::~TestFormActivityInfo() = default;
TestUpdateFaviconUrlCandidatesInfo::TestUpdateFaviconUrlCandidatesInfo() {} TestUpdateFaviconUrlCandidatesInfo::TestUpdateFaviconUrlCandidatesInfo() {}
TestUpdateFaviconUrlCandidatesInfo::~TestUpdateFaviconUrlCandidatesInfo() = TestUpdateFaviconUrlCandidatesInfo::~TestUpdateFaviconUrlCandidatesInfo() =
default; default;
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "ios/web/public/favicon_url.h" #include "ios/web/public/favicon_url.h"
#include "ios/web/public/load_committed_details.h" #include "ios/web/public/load_committed_details.h"
#include "ios/web/public/web_state/form_activity_params.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace web { namespace web {
...@@ -87,22 +86,6 @@ struct TestDidSuppressDialogInfo { ...@@ -87,22 +86,6 @@ struct TestDidSuppressDialogInfo {
WebState* web_state; WebState* web_state;
}; };
// Arguments passed to |DocumentSubmitted|.
struct TestSubmitDocumentInfo {
WebState* web_state;
std::string form_name;
bool user_initiated;
bool is_main_frame;
};
// Arguments passed to |FormActivityRegistered|.
struct TestFormActivityInfo {
TestFormActivityInfo();
~TestFormActivityInfo();
WebState* web_state;
FormActivityParams form_activity;
};
// Arguments passed to |FaviconUrlUpdated|. // Arguments passed to |FaviconUrlUpdated|.
struct TestUpdateFaviconUrlCandidatesInfo { struct TestUpdateFaviconUrlCandidatesInfo {
TestUpdateFaviconUrlCandidatesInfo(); TestUpdateFaviconUrlCandidatesInfo();
......
...@@ -158,7 +158,6 @@ source_set("context_menu") { ...@@ -158,7 +158,6 @@ source_set("context_menu") {
"context_menu_params.mm", "context_menu_params.mm",
"context_menu_params_utils.h", "context_menu_params_utils.h",
"context_menu_params_utils.mm", "context_menu_params_utils.mm",
"form_activity_params.cc",
] ]
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
#import "components/autofill/ios/browser/js_autofill_manager.h" #import "components/autofill/ios/browser/js_autofill_manager.h"
#import "components/autofill/ios/browser/js_suggestion_manager.h" #import "components/autofill/ios/browser/js_suggestion_manager.h"
#import "components/autofill/ios/form_util/form_activity_observer_bridge.h" #import "components/autofill/ios/form_util/form_activity_observer_bridge.h"
#include "components/autofill/ios/form_util/form_activity_params.h"
#include "components/browser_sync/profile_sync_service.h" #include "components/browser_sync/profile_sync_service.h"
#include "components/keyed_service/core/service_access_type.h" #include "components/keyed_service/core/service_access_type.h"
#include "ios/web/public/web_state/form_activity_params.h"
#import "ios/web/public/web_state/js/crw_js_injection_receiver.h" #import "ios/web/public/web_state/js/crw_js_injection_receiver.h"
#import "ios/web/public/web_state/web_state_observer_bridge.h" #import "ios/web/public/web_state/web_state_observer_bridge.h"
#include "ios/web_view/internal/app/application_context.h" #include "ios/web_view/internal/app/application_context.h"
...@@ -345,7 +345,7 @@ showUnmaskPromptForCard:(const autofill::CreditCard&)creditCard ...@@ -345,7 +345,7 @@ showUnmaskPromptForCard:(const autofill::CreditCard&)creditCard
#pragma mark - CRWWebStateObserver #pragma mark - CRWWebStateObserver
- (void)webState:(web::WebState*)webState - (void)webState:(web::WebState*)webState
didRegisterFormActivity:(const web::FormActivityParams&)params { didRegisterFormActivity:(const autofill::FormActivityParams&)params {
DCHECK_EQ(_webState, webState); DCHECK_EQ(_webState, webState);
[_JSSuggestionManager inject]; [_JSSuggestionManager inject];
......
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
#import "components/autofill/ios/browser/fake_js_autofill_manager.h" #import "components/autofill/ios/browser/fake_js_autofill_manager.h"
#import "components/autofill/ios/browser/form_suggestion.h" #import "components/autofill/ios/browser/form_suggestion.h"
#import "components/autofill/ios/browser/js_suggestion_manager.h" #import "components/autofill/ios/browser/js_suggestion_manager.h"
#include "components/autofill/ios/form_util/form_activity_params.h"
#import "components/autofill/ios/form_util/form_activity_tab_helper.h" #import "components/autofill/ios/form_util/form_activity_tab_helper.h"
#import "components/autofill/ios/form_util/test_form_activity_tab_helper.h" #import "components/autofill/ios/form_util/test_form_activity_tab_helper.h"
#import "ios/web/public/test/fakes/crw_test_js_injection_receiver.h" #import "ios/web/public/test/fakes/crw_test_js_injection_receiver.h"
#import "ios/web/public/test/fakes/test_web_state.h" #import "ios/web/public/test/fakes/test_web_state.h"
#include "ios/web/public/test/test_web_thread_bundle.h" #include "ios/web/public/test/test_web_thread_bundle.h"
#include "ios/web/public/web_client.h" #include "ios/web/public/web_client.h"
#include "ios/web/public/web_state/form_activity_params.h"
#import "ios/web_view/internal/autofill/cwv_autofill_suggestion_internal.h" #import "ios/web_view/internal/autofill/cwv_autofill_suggestion_internal.h"
#include "ios/web_view/internal/web_view_browser_state.h" #include "ios/web_view/internal/web_view_browser_state.h"
#import "ios/web_view/public/cwv_autofill_controller_delegate.h" #import "ios/web_view/public/cwv_autofill_controller_delegate.h"
...@@ -208,7 +208,7 @@ TEST_F(CWVAutofillControllerTest, FocusCallback) { ...@@ -208,7 +208,7 @@ TEST_F(CWVAutofillControllerTest, FocusCallback) {
formName:kTestFormName formName:kTestFormName
value:kTestFieldValue]; value:kTestFieldValue];
web::FormActivityParams params; autofill::FormActivityParams params;
params.form_name = base::SysNSStringToUTF8(kTestFormName); params.form_name = base::SysNSStringToUTF8(kTestFormName);
params.field_name = base::SysNSStringToUTF8(kTestFieldName); params.field_name = base::SysNSStringToUTF8(kTestFieldName);
params.field_identifier = base::SysNSStringToUTF8(kTestFieldIdentifier); params.field_identifier = base::SysNSStringToUTF8(kTestFieldIdentifier);
...@@ -235,7 +235,7 @@ TEST_F(CWVAutofillControllerTest, InputCallback) { ...@@ -235,7 +235,7 @@ TEST_F(CWVAutofillControllerTest, InputCallback) {
formName:kTestFormName formName:kTestFormName
value:kTestFieldValue]; value:kTestFieldValue];
web::FormActivityParams params; autofill::FormActivityParams params;
params.form_name = base::SysNSStringToUTF8(kTestFormName); params.form_name = base::SysNSStringToUTF8(kTestFormName);
params.field_name = base::SysNSStringToUTF8(kTestFieldName); params.field_name = base::SysNSStringToUTF8(kTestFieldName);
params.field_identifier = base::SysNSStringToUTF8(kTestFieldIdentifier); params.field_identifier = base::SysNSStringToUTF8(kTestFieldIdentifier);
...@@ -261,7 +261,7 @@ TEST_F(CWVAutofillControllerTest, BlurCallback) { ...@@ -261,7 +261,7 @@ TEST_F(CWVAutofillControllerTest, BlurCallback) {
formName:kTestFormName formName:kTestFormName
value:kTestFieldValue]; value:kTestFieldValue];
web::FormActivityParams params; autofill::FormActivityParams params;
params.form_name = base::SysNSStringToUTF8(kTestFormName); params.form_name = base::SysNSStringToUTF8(kTestFormName);
params.field_name = base::SysNSStringToUTF8(kTestFieldName); params.field_name = base::SysNSStringToUTF8(kTestFieldName);
params.field_identifier = base::SysNSStringToUTF8(kTestFieldIdentifier); params.field_identifier = base::SysNSStringToUTF8(kTestFieldIdentifier);
......
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