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

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

Issue 10828345: Extract PrefServiceBase into chrome/browser/api. Use in api and autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head Created 8 years, 4 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/autofill_common_test.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 #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/string16.h" 9 #include "base/string16.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/api/prefs/pref_service_base.h"
12 #include "chrome/browser/autofill/autofill_external_delegate.h" 13 #include "chrome/browser/autofill/autofill_external_delegate.h"
13 #include "chrome/browser/autofill/credit_card.h" 14 #include "chrome/browser/autofill/credit_card.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/webdata/web_data_service_factory.h" 16 #include "chrome/browser/webdata/web_data_service_factory.h"
16 #include "chrome/common/autofill_messages.h" 17 #include "chrome/common/autofill_messages.h"
17 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
18 #include "content/public/browser/render_view_host.h" 19 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
20 #include "webkit/forms/form_data.h" 21 #include "webkit/forms/form_data.h"
21 22
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 AutocompleteHistoryManager::AutocompleteHistoryManager( 111 AutocompleteHistoryManager::AutocompleteHistoryManager(
111 WebContents* web_contents) 112 WebContents* web_contents)
112 : content::WebContentsObserver(web_contents), 113 : content::WebContentsObserver(web_contents),
113 pending_query_handle_(0), 114 pending_query_handle_(0),
114 query_id_(0), 115 query_id_(0),
115 external_delegate_(NULL) { 116 external_delegate_(NULL) {
116 profile_ = Profile::FromBrowserContext(web_contents->GetBrowserContext()); 117 profile_ = Profile::FromBrowserContext(web_contents->GetBrowserContext());
117 // May be NULL in unit tests. 118 // May be NULL in unit tests.
118 web_data_service_ = WebDataServiceFactory::GetForProfile( 119 web_data_service_ = WebDataServiceFactory::GetForProfile(
119 profile_, Profile::EXPLICIT_ACCESS); 120 profile_, Profile::EXPLICIT_ACCESS);
120 autofill_enabled_.Init(prefs::kAutofillEnabled, profile_->GetPrefs(), NULL); 121 autofill_enabled_.Init(
122 prefs::kAutofillEnabled, PrefServiceBase::ForProfile(profile_), NULL);
121 } 123 }
122 124
123 AutocompleteHistoryManager::~AutocompleteHistoryManager() { 125 AutocompleteHistoryManager::~AutocompleteHistoryManager() {
124 CancelPendingQuery(); 126 CancelPendingQuery();
125 } 127 }
126 128
127 bool AutocompleteHistoryManager::OnMessageReceived( 129 bool AutocompleteHistoryManager::OnMessageReceived(
128 const IPC::Message& message) { 130 const IPC::Message& message) {
129 bool handled = true; 131 bool handled = true;
130 IPC_BEGIN_MESSAGE_MAP(AutocompleteHistoryManager, message) 132 IPC_BEGIN_MESSAGE_MAP(AutocompleteHistoryManager, message)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 WebContents* web_contents, 239 WebContents* web_contents,
238 Profile* profile, 240 Profile* profile,
239 WebDataService* wds) 241 WebDataService* wds)
240 : content::WebContentsObserver(web_contents), 242 : content::WebContentsObserver(web_contents),
241 profile_(profile), 243 profile_(profile),
242 web_data_service_(wds), 244 web_data_service_(wds),
243 pending_query_handle_(0), 245 pending_query_handle_(0),
244 query_id_(0), 246 query_id_(0),
245 external_delegate_(NULL) { 247 external_delegate_(NULL) {
246 autofill_enabled_.Init( 248 autofill_enabled_.Init(
247 prefs::kAutofillEnabled, profile_->GetPrefs(), NULL); 249 prefs::kAutofillEnabled, PrefServiceBase::ForProfile(profile_), NULL);
248 } 250 }
249 251
250 void AutocompleteHistoryManager::CancelPendingQuery() { 252 void AutocompleteHistoryManager::CancelPendingQuery() {
251 if (pending_query_handle_) { 253 if (pending_query_handle_) {
252 SendSuggestions(NULL); 254 SendSuggestions(NULL);
253 if (web_data_service_.get()) 255 if (web_data_service_.get())
254 web_data_service_->CancelRequest(pending_query_handle_); 256 web_data_service_->CancelRequest(pending_query_handle_);
255 pending_query_handle_ = 0; 257 pending_query_handle_ = 0;
256 } 258 }
257 } 259 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 autofill_icons_, 296 autofill_icons_,
295 autofill_unique_ids_)); 297 autofill_unique_ids_));
296 } 298 }
297 299
298 query_id_ = 0; 300 query_id_ = 0;
299 autofill_values_.clear(); 301 autofill_values_.clear();
300 autofill_labels_.clear(); 302 autofill_labels_.clear();
301 autofill_icons_.clear(); 303 autofill_icons_.clear();
302 autofill_unique_ids_.clear(); 304 autofill_unique_ids_.clear();
303 } 305 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/DEPS ('k') | chrome/browser/autofill/autofill_common_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698