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

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

Issue 11316163: Remove the last usages of PrefObserver outside of Prefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 8 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 | Annotate | Revision Log
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 #include "chrome/browser/autofill/autocomplete_history_manager.h" 5 #include "chrome/browser/autofill/autocomplete_history_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/prefs/public/pref_service_base.h" 9 #include "base/prefs/public/pref_service_base.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 AutocompleteHistoryManager::AutocompleteHistoryManager( 109 AutocompleteHistoryManager::AutocompleteHistoryManager(
110 WebContents* web_contents) 110 WebContents* web_contents)
111 : content::WebContentsObserver(web_contents), 111 : content::WebContentsObserver(web_contents),
112 pending_query_handle_(0), 112 pending_query_handle_(0),
113 query_id_(0), 113 query_id_(0),
114 external_delegate_(NULL) { 114 external_delegate_(NULL) {
115 browser_context_ = web_contents->GetBrowserContext(); 115 browser_context_ = web_contents->GetBrowserContext();
116 // May be NULL in unit tests. 116 // May be NULL in unit tests.
117 autofill_data_ = AutofillWebDataService::FromBrowserContext(browser_context_); 117 autofill_data_ = AutofillWebDataService::FromBrowserContext(browser_context_);
118 autofill_enabled_.Init(prefs::kAutofillEnabled, 118 autofill_enabled_.Init(prefs::kAutofillEnabled,
119 PrefServiceBase::FromBrowserContext(browser_context_), 119 PrefServiceBase::FromBrowserContext(browser_context_));
120 NULL);
121 } 120 }
122 121
123 AutocompleteHistoryManager::~AutocompleteHistoryManager() { 122 AutocompleteHistoryManager::~AutocompleteHistoryManager() {
124 CancelPendingQuery(); 123 CancelPendingQuery();
125 } 124 }
126 125
127 bool AutocompleteHistoryManager::OnMessageReceived( 126 bool AutocompleteHistoryManager::OnMessageReceived(
128 const IPC::Message& message) { 127 const IPC::Message& message) {
129 bool handled = true; 128 bool handled = true;
130 IPC_BEGIN_MESSAGE_MAP(AutocompleteHistoryManager, message) 129 IPC_BEGIN_MESSAGE_MAP(AutocompleteHistoryManager, message)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 WebContents* web_contents, 236 WebContents* web_contents,
238 BrowserContext* browser_context, 237 BrowserContext* browser_context,
239 scoped_ptr<AutofillWebDataService> awd) 238 scoped_ptr<AutofillWebDataService> awd)
240 : content::WebContentsObserver(web_contents), 239 : content::WebContentsObserver(web_contents),
241 browser_context_(browser_context), 240 browser_context_(browser_context),
242 autofill_data_(awd.Pass()), 241 autofill_data_(awd.Pass()),
243 pending_query_handle_(0), 242 pending_query_handle_(0),
244 query_id_(0), 243 query_id_(0),
245 external_delegate_(NULL) { 244 external_delegate_(NULL) {
246 autofill_enabled_.Init(prefs::kAutofillEnabled, 245 autofill_enabled_.Init(prefs::kAutofillEnabled,
247 PrefServiceBase::FromBrowserContext(browser_context_), 246 PrefServiceBase::FromBrowserContext(browser_context_));
248 NULL);
249 } 247 }
250 248
251 void AutocompleteHistoryManager::CancelPendingQuery() { 249 void AutocompleteHistoryManager::CancelPendingQuery() {
252 if (pending_query_handle_) { 250 if (pending_query_handle_) {
253 SendSuggestions(NULL); 251 SendSuggestions(NULL);
254 if (autofill_data_.get()) 252 if (autofill_data_.get())
255 autofill_data_->CancelRequest(pending_query_handle_); 253 autofill_data_->CancelRequest(pending_query_handle_);
256 pending_query_handle_ = 0; 254 pending_query_handle_ = 0;
257 } 255 }
258 } 256 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 autofill_icons_, 293 autofill_icons_,
296 autofill_unique_ids_)); 294 autofill_unique_ids_));
297 } 295 }
298 296
299 query_id_ = 0; 297 query_id_ = 0;
300 autofill_values_.clear(); 298 autofill_values_.clear();
301 autofill_labels_.clear(); 299 autofill_labels_.clear();
302 autofill_icons_.clear(); 300 autofill_icons_.clear();
303 autofill_unique_ids_.clear(); 301 autofill_unique_ids_.clear();
304 } 302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698