OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/autocomplete_history_manager.h" | 5 #include "chrome/browser/autocomplete_history_manager.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 field.form_control_type == ASCIIToUTF16("text"); | 96 field.form_control_type == ASCIIToUTF16("text"); |
97 } | 97 } |
98 | 98 |
99 } // namespace | 99 } // namespace |
100 | 100 |
101 AutocompleteHistoryManager::AutocompleteHistoryManager( | 101 AutocompleteHistoryManager::AutocompleteHistoryManager( |
102 TabContents* tab_contents) | 102 TabContents* tab_contents) |
103 : TabContentsObserver(tab_contents), | 103 : TabContentsObserver(tab_contents), |
104 pending_query_handle_(0), | 104 pending_query_handle_(0), |
105 query_id_(0) { | 105 query_id_(0) { |
106 profile_ = tab_contents->profile(); | 106 profile_ = static_cast<Profile*>(tab_contents->browser_context()); |
107 // May be NULL in unit tests. | 107 // May be NULL in unit tests. |
108 web_data_service_ = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); | 108 web_data_service_ = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
109 autofill_enabled_.Init(prefs::kAutofillEnabled, profile_->GetPrefs(), NULL); | 109 autofill_enabled_.Init(prefs::kAutofillEnabled, profile_->GetPrefs(), NULL); |
110 } | 110 } |
111 | 111 |
112 AutocompleteHistoryManager::~AutocompleteHistoryManager() { | 112 AutocompleteHistoryManager::~AutocompleteHistoryManager() { |
113 CancelPendingQuery(); | 113 CancelPendingQuery(); |
114 } | 114 } |
115 | 115 |
116 bool AutocompleteHistoryManager::OnMessageReceived( | 116 bool AutocompleteHistoryManager::OnMessageReceived( |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 autofill_labels_, | 268 autofill_labels_, |
269 autofill_icons_, | 269 autofill_icons_, |
270 autofill_unique_ids_)); | 270 autofill_unique_ids_)); |
271 | 271 |
272 query_id_ = 0; | 272 query_id_ = 0; |
273 autofill_values_.clear(); | 273 autofill_values_.clear(); |
274 autofill_labels_.clear(); | 274 autofill_labels_.clear(); |
275 autofill_icons_.clear(); | 275 autofill_icons_.clear(); |
276 autofill_unique_ids_.clear(); | 276 autofill_unique_ids_.clear(); |
277 } | 277 } |
OLD | NEW |