OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/autofill/ios/browser/autofill_driver_ios.h" |
| 6 |
| 7 #include "components/autofill/ios/browser/autofill_driver_ios_bridge.h" |
| 8 #include "ios/web/public/browser_state.h" |
| 9 #include "ios/web/public/web_state/web_state.h" |
| 10 #include "ios/web/public/web_thread.h" |
| 11 |
| 12 DEFINE_WEB_STATE_USER_DATA_KEY(autofill::AutofillDriverIOS); |
| 13 |
| 14 namespace autofill { |
| 15 |
| 16 // static |
| 17 void AutofillDriverIOS::CreateForWebStateAndDelegate( |
| 18 web::WebState* web_state, |
| 19 AutofillClient* client, |
| 20 id<AutofillDriverIOSBridge> bridge, |
| 21 const std::string& app_locale, |
| 22 AutofillManager::AutofillDownloadManagerState enable_download_manager) { |
| 23 if (FromWebState(web_state)) |
| 24 return; |
| 25 |
| 26 web_state->SetUserData( |
| 27 UserDataKey(), |
| 28 new AutofillDriverIOS(web_state, client, bridge, app_locale, |
| 29 enable_download_manager)); |
| 30 } |
| 31 |
| 32 AutofillDriverIOS::AutofillDriverIOS( |
| 33 web::WebState* web_state, |
| 34 AutofillClient* client, |
| 35 id<AutofillDriverIOSBridge> bridge, |
| 36 const std::string& app_locale, |
| 37 AutofillManager::AutofillDownloadManagerState enable_download_manager) |
| 38 : web_state_(web_state), |
| 39 bridge_(bridge), |
| 40 autofill_manager_(this, client, app_locale, enable_download_manager), |
| 41 autofill_external_delegate_(&autofill_manager_, this) { |
| 42 autofill_manager_.SetExternalDelegate(&autofill_external_delegate_); |
| 43 } |
| 44 |
| 45 AutofillDriverIOS::~AutofillDriverIOS() {} |
| 46 |
| 47 bool AutofillDriverIOS::IsOffTheRecord() const { |
| 48 return web_state_->GetBrowserState()->IsOffTheRecord(); |
| 49 } |
| 50 |
| 51 net::URLRequestContextGetter* AutofillDriverIOS::GetURLRequestContext() { |
| 52 return web_state_->GetBrowserState()->GetRequestContext(); |
| 53 } |
| 54 |
| 55 base::SequencedWorkerPool* AutofillDriverIOS::GetBlockingPool() { |
| 56 return web::WebThread::GetBlockingPool(); |
| 57 } |
| 58 |
| 59 bool AutofillDriverIOS::RendererIsAvailable() { |
| 60 return true; |
| 61 } |
| 62 |
| 63 void AutofillDriverIOS::SendFormDataToRenderer( |
| 64 int query_id, |
| 65 RendererFormDataAction action, |
| 66 const FormData& data) { |
| 67 [bridge_ onFormDataFilled:query_id result:data]; |
| 68 } |
| 69 |
| 70 void AutofillDriverIOS::PingRenderer() { |
| 71 } |
| 72 |
| 73 void AutofillDriverIOS::DetectAccountCreationForms( |
| 74 const std::vector<autofill::FormStructure*>& forms) { |
| 75 autofill_manager_.client()->DetectAccountCreationForms(nullptr, forms); |
| 76 }; |
| 77 |
| 78 void AutofillDriverIOS::SendAutofillTypePredictionsToRenderer( |
| 79 const std::vector<FormStructure*>& forms) { |
| 80 [bridge_ sendAutofillTypePredictionsToRenderer:forms]; |
| 81 } |
| 82 |
| 83 void AutofillDriverIOS::RendererShouldAcceptDataListSuggestion( |
| 84 const base::string16& value) { |
| 85 } |
| 86 |
| 87 void AutofillDriverIOS::RendererShouldClearFilledForm() { |
| 88 } |
| 89 |
| 90 void AutofillDriverIOS::RendererShouldClearPreviewedForm() { |
| 91 } |
| 92 |
| 93 void AutofillDriverIOS::RendererShouldFillFieldWithValue( |
| 94 const base::string16& value) { |
| 95 } |
| 96 |
| 97 void AutofillDriverIOS::RendererShouldPreviewFieldWithValue( |
| 98 const base::string16& value) { |
| 99 } |
| 100 |
| 101 void AutofillDriverIOS::PopupHidden() { |
| 102 } |
| 103 |
| 104 } // namespace autofill |
OLD | NEW |