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

Side by Side Diff: chrome/browser/autofill/autocomplete_history_manager.h

Issue 10919066: Use BrowserContext as key in API. Switch Autofill to use BC in place of Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to parent Created 8 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/autofill/DEPS ('k') | chrome/browser/autofill/autocomplete_history_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_AUTOFILL_AUTOCOMPLETE_HISTORY_MANAGER_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOCOMPLETE_HISTORY_MANAGER_H_
6 #define CHROME_BROWSER_AUTOFILL_AUTOCOMPLETE_HISTORY_MANAGER_H_ 6 #define CHROME_BROWSER_AUTOFILL_AUTOCOMPLETE_HISTORY_MANAGER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "chrome/browser/api/prefs/pref_member.h" 11 #include "chrome/browser/api/prefs/pref_member.h"
12 #include "chrome/browser/api/webdata/autofill_web_data_service.h" 12 #include "chrome/browser/api/webdata/autofill_web_data_service.h"
13 #include "chrome/browser/api/webdata/web_data_service_consumer.h" 13 #include "chrome/browser/api/webdata/web_data_service_consumer.h"
14 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
15 15
16 namespace content {
17 class BrowserContext;
18 }
19
16 namespace webkit { 20 namespace webkit {
17 namespace forms { 21 namespace forms {
18 struct FormData; 22 struct FormData;
19 } 23 }
20 } 24 }
21 25
22 class AutofillExternalDelegate; 26 class AutofillExternalDelegate;
23 class Profile;
24 27
25 // Per-tab Autocomplete history manager. Handles receiving form data 28 // Per-tab Autocomplete history manager. Handles receiving form data
26 // from the renderer and the storing and retrieving of form data 29 // from the renderer and the storing and retrieving of form data
27 // through WebDataServiceBase. 30 // through WebDataServiceBase.
28 class AutocompleteHistoryManager : public content::WebContentsObserver, 31 class AutocompleteHistoryManager : public content::WebContentsObserver,
29 public WebDataServiceConsumer { 32 public WebDataServiceConsumer {
30 public: 33 public:
31 explicit AutocompleteHistoryManager(content::WebContents* web_contents); 34 explicit AutocompleteHistoryManager(content::WebContents* web_contents);
32 virtual ~AutocompleteHistoryManager(); 35 virtual ~AutocompleteHistoryManager();
33 36
(...skipping 25 matching lines...) Expand all
59 62
60 protected: 63 protected:
61 friend class AutocompleteHistoryManagerTest; 64 friend class AutocompleteHistoryManagerTest;
62 friend class AutofillManagerTest; 65 friend class AutofillManagerTest;
63 FRIEND_TEST_ALL_PREFIXES(AutocompleteHistoryManagerTest, ExternalDelegate); 66 FRIEND_TEST_ALL_PREFIXES(AutocompleteHistoryManagerTest, ExternalDelegate);
64 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, 67 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest,
65 TestTabContentsWithExternalDelegate); 68 TestTabContentsWithExternalDelegate);
66 69
67 // For tests. 70 // For tests.
68 AutocompleteHistoryManager(content::WebContents* web_contents, 71 AutocompleteHistoryManager(content::WebContents* web_contents,
69 Profile* profile, 72 content::BrowserContext* context,
70 scoped_ptr<AutofillWebDataService> wds); 73 scoped_ptr<AutofillWebDataService> wds);
71 74
72 void SendSuggestions(const std::vector<string16>* suggestions); 75 void SendSuggestions(const std::vector<string16>* suggestions);
73 void CancelPendingQuery(); 76 void CancelPendingQuery();
74 77
75 // Exposed for testing. 78 // Exposed for testing.
76 AutofillExternalDelegate* external_delegate() { 79 AutofillExternalDelegate* external_delegate() {
77 return external_delegate_; 80 return external_delegate_;
78 } 81 }
79 82
80 private: 83 private:
81 Profile* profile_; 84 content::BrowserContext* browser_context_;
82 scoped_ptr<AutofillWebDataService> autofill_data_; 85 scoped_ptr<AutofillWebDataService> autofill_data_;
83 86
84 BooleanPrefMember autofill_enabled_; 87 BooleanPrefMember autofill_enabled_;
85 88
86 // When the manager makes a request from WebDataServiceBase, the database is 89 // When the manager makes a request from WebDataServiceBase, the database is
87 // queried on another thread, we record the query handle until we get called 90 // queried on another thread, we record the query handle until we get called
88 // back. We also store the autofill results so we can send them together. 91 // back. We also store the autofill results so we can send them together.
89 WebDataServiceBase::Handle pending_query_handle_; 92 WebDataServiceBase::Handle pending_query_handle_;
90 int query_id_; 93 int query_id_;
91 std::vector<string16> autofill_values_; 94 std::vector<string16> autofill_values_;
92 std::vector<string16> autofill_labels_; 95 std::vector<string16> autofill_labels_;
93 std::vector<string16> autofill_icons_; 96 std::vector<string16> autofill_icons_;
94 std::vector<int> autofill_unique_ids_; 97 std::vector<int> autofill_unique_ids_;
95 98
96 // Delegate to perform external processing (display, selection) on 99 // Delegate to perform external processing (display, selection) on
97 // our behalf. Weak. 100 // our behalf. Weak.
98 AutofillExternalDelegate* external_delegate_; 101 AutofillExternalDelegate* external_delegate_;
99 102
100 DISALLOW_COPY_AND_ASSIGN(AutocompleteHistoryManager); 103 DISALLOW_COPY_AND_ASSIGN(AutocompleteHistoryManager);
101 }; 104 };
102 105
103 #endif // CHROME_BROWSER_AUTOFILL_AUTOCOMPLETE_HISTORY_MANAGER_H_ 106 #endif // CHROME_BROWSER_AUTOFILL_AUTOCOMPLETE_HISTORY_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autofill/DEPS ('k') | chrome/browser/autofill/autocomplete_history_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698