Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: components/autofill/content/browser/content_autofill_driver.h

Issue 707173004: Refactor Autofill for out of process iframes (OOPIF). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mem leak Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_H_ 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_H_
6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_H_ 6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/supports_user_data.h" 11 #include "base/supports_user_data.h"
12 #include "components/autofill/content/browser/request_autocomplete_manager.h" 12 #include "components/autofill/content/browser/request_autocomplete_manager.h"
13 #include "components/autofill/core/browser/autofill_driver.h" 13 #include "components/autofill/core/browser/autofill_driver.h"
14 #include "components/autofill/core/browser/autofill_external_delegate.h" 14 #include "components/autofill/core/browser/autofill_external_delegate.h"
15 #include "components/autofill/core/browser/autofill_manager.h" 15 #include "components/autofill/core/browser/autofill_manager.h"
16 #include "content/public/browser/web_contents_observer.h"
17 16
18 namespace content { 17 namespace content {
19 class WebContents; 18 class BrowserContext;
19 class RenderFrameHost;
20 struct FrameNavigateParams;
21 struct LoadCommittedDetails;
20 } 22 }
21 23
22 namespace IPC { 24 namespace IPC {
23 class Message; 25 class Message;
24 } 26 }
25 27
26 namespace autofill { 28 namespace autofill {
27 29
28 class AutofillClient; 30 class AutofillClient;
29 31
30 // Class that drives autofill flow in the browser process based on 32 // Class that drives autofill flow in the browser process based on
31 // communication from the renderer and from the external world. There is one 33 // communication from the renderer and from the external world. There is one
32 // instance per WebContents. 34 // instance per RenderFrameHost.
33 class ContentAutofillDriver : public AutofillDriver, 35 class ContentAutofillDriver : public AutofillDriver {
34 public content::WebContentsObserver,
35 public base::SupportsUserData::Data {
36 public: 36 public:
37 static void CreateForWebContentsAndDelegate( 37 ContentAutofillDriver(
38 content::WebContents* contents, 38 content::RenderFrameHost* render_frame_host,
39 AutofillClient* client, 39 AutofillClient* client,
40 const std::string& app_locale, 40 const std::string& app_locale,
41 AutofillManager::AutofillDownloadManagerState enable_download_manager); 41 AutofillManager::AutofillDownloadManagerState enable_download_manager);
42 static ContentAutofillDriver* FromWebContents(content::WebContents* contents); 42 ~ContentAutofillDriver() override;
43 43
44 // AutofillDriver: 44 // AutofillDriver:
45 bool IsOffTheRecord() const override; 45 bool IsOffTheRecord() const override;
46 net::URLRequestContextGetter* GetURLRequestContext() override; 46 net::URLRequestContextGetter* GetURLRequestContext() override;
47 base::SequencedWorkerPool* GetBlockingPool() override; 47 base::SequencedWorkerPool* GetBlockingPool() override;
48 bool RendererIsAvailable() override; 48 bool RendererIsAvailable() override;
49 void SendFormDataToRenderer(int query_id, 49 void SendFormDataToRenderer(int query_id,
50 RendererFormDataAction action, 50 RendererFormDataAction action,
51 const FormData& data) override; 51 const FormData& data) override;
52 void PingRenderer() override; 52 void PingRenderer() override;
53 void DetectAccountCreationForms(
54 const std::vector<autofill::FormStructure*>& forms) override;
53 void SendAutofillTypePredictionsToRenderer( 55 void SendAutofillTypePredictionsToRenderer(
54 const std::vector<FormStructure*>& forms) override; 56 const std::vector<FormStructure*>& forms) override;
55 void RendererShouldAcceptDataListSuggestion( 57 void RendererShouldAcceptDataListSuggestion(
56 const base::string16& value) override; 58 const base::string16& value) override;
57 void RendererShouldClearFilledForm() override; 59 void RendererShouldClearFilledForm() override;
58 void RendererShouldClearPreviewedForm() override; 60 void RendererShouldClearPreviewedForm() override;
59 void RendererShouldFillFieldWithValue(const base::string16& value) override; 61 void RendererShouldFillFieldWithValue(const base::string16& value) override;
60 void RendererShouldPreviewFieldWithValue( 62 void RendererShouldPreviewFieldWithValue(
61 const base::string16& value) override; 63 const base::string16& value) override;
62 64
65 // Handles a message that came from the associated render frame.
66 bool HandleMessage(const IPC::Message& message);
67
68 // Called when the frame has navigated.
69 void DidNavigateFrame(const content::LoadCommittedDetails& details,
70 const content::FrameNavigateParams& params);
71
63 AutofillExternalDelegate* autofill_external_delegate() { 72 AutofillExternalDelegate* autofill_external_delegate() {
64 return &autofill_external_delegate_; 73 return &autofill_external_delegate_;
65 } 74 }
66 75
67 AutofillManager* autofill_manager() { return autofill_manager_.get(); } 76 AutofillManager* autofill_manager() { return autofill_manager_.get(); }
77 content::RenderFrameHost* render_frame_host() { return render_frame_host_; }
68 78
69 protected: 79 protected:
70 ContentAutofillDriver(
71 content::WebContents* web_contents,
72 AutofillClient* client,
73 const std::string& app_locale,
74 AutofillManager::AutofillDownloadManagerState enable_download_manager);
75 ~ContentAutofillDriver() override;
76
77 // content::WebContentsObserver:
78 void DidNavigateMainFrame(
79 const content::LoadCommittedDetails& details,
80 const content::FrameNavigateParams& params) override;
81 void NavigationEntryCommitted(
82 const content::LoadCommittedDetails& load_details) override;
83 void WasHidden() override;
84 bool OnMessageReceived(const IPC::Message& message) override;
85
86 // Sets the manager to |manager| and sets |manager|'s external delegate 80 // Sets the manager to |manager| and sets |manager|'s external delegate
87 // to |autofill_external_delegate_|. Takes ownership of |manager|. 81 // to |autofill_external_delegate_|. Takes ownership of |manager|.
88 void SetAutofillManager(scoped_ptr<AutofillManager> manager); 82 void SetAutofillManager(scoped_ptr<AutofillManager> manager);
89 83
90 private: 84 private:
85 // Weak ref to the RenderFrameHost the driver is associated with. Should
86 // always be non-NULL and valid for lifetime of |this|.
87 content::RenderFrameHost* const render_frame_host_;
88
89 // The per-tab client.
90 AutofillClient* client_;
91
91 // AutofillManager instance via which this object drives the shared Autofill 92 // AutofillManager instance via which this object drives the shared Autofill
92 // code. 93 // code.
93 scoped_ptr<AutofillManager> autofill_manager_; 94 scoped_ptr<AutofillManager> autofill_manager_;
94 95
95 // AutofillExternalDelegate instance that this object instantiates in the 96 // AutofillExternalDelegate instance that this object instantiates in the
96 // case where the Autofill native UI is enabled. 97 // case where the Autofill native UI is enabled.
97 AutofillExternalDelegate autofill_external_delegate_; 98 AutofillExternalDelegate autofill_external_delegate_;
98 99
99 // Driver for the interactive autocomplete dialog. 100 // Driver for the interactive autocomplete dialog.
100 RequestAutocompleteManager request_autocomplete_manager_; 101 RequestAutocompleteManager request_autocomplete_manager_;
101 }; 102 };
102 103
103 } // namespace autofill 104 } // namespace autofill
104 105
105 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_H_ 106 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_H_
OLDNEW
« no previous file with comments | « components/autofill/content/browser/BUILD.gn ('k') | components/autofill/content/browser/content_autofill_driver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698