OLD | NEW |
---|---|
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 | 16 |
17 namespace content { | 17 namespace content { |
18 class BrowserContext; | 18 class BrowserContext; |
19 class RenderFrameHost; | 19 class RenderFrameHost; |
20 class WebContents; | |
20 struct FrameNavigateParams; | 21 struct FrameNavigateParams; |
21 struct LoadCommittedDetails; | 22 struct LoadCommittedDetails; |
22 } | 23 } |
23 | 24 |
24 namespace IPC { | 25 namespace IPC { |
25 class Message; | 26 class Message; |
26 } | 27 } |
27 | 28 |
28 namespace autofill { | 29 namespace autofill { |
29 | 30 |
(...skipping 24 matching lines...) Expand all Loading... | |
54 const std::vector<autofill::FormStructure*>& forms) override; | 55 const std::vector<autofill::FormStructure*>& forms) override; |
55 void SendAutofillTypePredictionsToRenderer( | 56 void SendAutofillTypePredictionsToRenderer( |
56 const std::vector<FormStructure*>& forms) override; | 57 const std::vector<FormStructure*>& forms) override; |
57 void RendererShouldAcceptDataListSuggestion( | 58 void RendererShouldAcceptDataListSuggestion( |
58 const base::string16& value) override; | 59 const base::string16& value) override; |
59 void RendererShouldClearFilledForm() override; | 60 void RendererShouldClearFilledForm() override; |
60 void RendererShouldClearPreviewedForm() override; | 61 void RendererShouldClearPreviewedForm() override; |
61 void RendererShouldFillFieldWithValue(const base::string16& value) override; | 62 void RendererShouldFillFieldWithValue(const base::string16& value) override; |
62 void RendererShouldPreviewFieldWithValue( | 63 void RendererShouldPreviewFieldWithValue( |
63 const base::string16& value) override; | 64 const base::string16& value) override; |
65 void LinkClicked(const GURL& url, WindowOpenDisposition disposition) override; | |
64 | 66 |
65 // Handles a message that came from the associated render frame. | 67 // Handles a message that came from the associated render frame. |
66 bool HandleMessage(const IPC::Message& message); | 68 bool HandleMessage(const IPC::Message& message); |
67 | 69 |
68 // Called when the frame has navigated. | 70 // Called when the frame has navigated. |
69 void DidNavigateFrame(const content::LoadCommittedDetails& details, | 71 void DidNavigateFrame(const content::LoadCommittedDetails& details, |
70 const content::FrameNavigateParams& params); | 72 const content::FrameNavigateParams& params); |
71 | 73 |
72 AutofillExternalDelegate* autofill_external_delegate() { | 74 AutofillExternalDelegate* autofill_external_delegate() { |
73 return &autofill_external_delegate_; | 75 return &autofill_external_delegate_; |
74 } | 76 } |
75 | 77 |
76 AutofillManager* autofill_manager() { return autofill_manager_.get(); } | 78 AutofillManager* autofill_manager() { return autofill_manager_.get(); } |
77 content::RenderFrameHost* render_frame_host() { return render_frame_host_; } | 79 content::RenderFrameHost* render_frame_host() { return render_frame_host_; } |
78 | 80 |
79 protected: | 81 protected: |
80 // Sets the manager to |manager| and sets |manager|'s external delegate | 82 // Sets the manager to |manager| and sets |manager|'s external delegate |
81 // to |autofill_external_delegate_|. Takes ownership of |manager|. | 83 // to |autofill_external_delegate_|. Takes ownership of |manager|. |
82 void SetAutofillManager(scoped_ptr<AutofillManager> manager); | 84 void SetAutofillManager(scoped_ptr<AutofillManager> manager); |
83 | 85 |
84 private: | 86 private: |
87 // Gets the WebContents instance associated with the driver. | |
88 content::WebContents* web_contents(); | |
Peter Kasting
2014/12/23 21:20:34
unix_hacker()-named functions should be simple inl
Pritam Nikam
2014/12/24 11:16:57
Done.
Renamed to GetWebContents().
| |
89 | |
85 // Weak ref to the RenderFrameHost the driver is associated with. Should | 90 // Weak ref to the RenderFrameHost the driver is associated with. Should |
86 // always be non-NULL and valid for lifetime of |this|. | 91 // always be non-NULL and valid for lifetime of |this|. |
87 content::RenderFrameHost* const render_frame_host_; | 92 content::RenderFrameHost* const render_frame_host_; |
88 | 93 |
89 // The per-tab client. | 94 // The per-tab client. |
90 AutofillClient* client_; | 95 AutofillClient* client_; |
91 | 96 |
92 // AutofillManager instance via which this object drives the shared Autofill | 97 // AutofillManager instance via which this object drives the shared Autofill |
93 // code. | 98 // code. |
94 scoped_ptr<AutofillManager> autofill_manager_; | 99 scoped_ptr<AutofillManager> autofill_manager_; |
95 | 100 |
96 // AutofillExternalDelegate instance that this object instantiates in the | 101 // AutofillExternalDelegate instance that this object instantiates in the |
97 // case where the Autofill native UI is enabled. | 102 // case where the Autofill native UI is enabled. |
98 AutofillExternalDelegate autofill_external_delegate_; | 103 AutofillExternalDelegate autofill_external_delegate_; |
99 | 104 |
100 // Driver for the interactive autocomplete dialog. | 105 // Driver for the interactive autocomplete dialog. |
101 RequestAutocompleteManager request_autocomplete_manager_; | 106 RequestAutocompleteManager request_autocomplete_manager_; |
102 }; | 107 }; |
103 | 108 |
104 } // namespace autofill | 109 } // namespace autofill |
105 | 110 |
106 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_H_ | 111 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_H_ |
OLD | NEW |