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

Side by Side Diff: chrome/browser/search_engines/search_provider_install_data.cc

Issue 10185008: Taking over issue 10006037: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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
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/search_engines/search_provider_install_data.h" 5 #include "chrome/browser/search_engines/search_provider_install_data.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/message_loop_helpers.h" 15 #include "base/message_loop_helpers.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/search_engines/search_host_to_urls_map.h" 17 #include "chrome/browser/search_engines/search_host_to_urls_map.h"
18 #include "chrome/browser/search_engines/search_terms_data.h" 18 #include "chrome/browser/search_engines/search_terms_data.h"
19 #include "chrome/browser/search_engines/template_url.h" 19 #include "chrome/browser/search_engines/template_url.h"
20 #include "chrome/browser/search_engines/template_url_service.h" 20 #include "chrome/browser/search_engines/template_url_service.h"
21 #include "chrome/browser/search_engines/util.h" 21 #include "chrome/browser/search_engines/util.h"
22 #include "chrome/browser/webdata/web_data_service.h" 22 #include "chrome/browser/webdata/web_data_service.h"
23 #include "chrome/browser/webdata/web_data_service_factory.h"
23 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
24 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/notification_observer.h" 26 #include "content/public/browser/notification_observer.h"
26 #include "content/public/browser/notification_registrar.h" 27 #include "content/public/browser/notification_registrar.h"
27 #include "content/public/browser/notification_service.h" 28 #include "content/public/browser/notification_service.h"
28 #include "content/public/browser/notification_source.h" 29 #include "content/public/browser/notification_source.h"
29 30
30 using content::BrowserThread; 31 using content::BrowserThread;
31 32
32 typedef SearchHostToURLsMap::TemplateURLSet TemplateURLSet; 33 typedef SearchHostToURLsMap::TemplateURLSet TemplateURLSet;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 TemplateURLService::GenerateSearchURLUsingTermsData(template_url, 152 TemplateURLService::GenerateSearchURLUsingTermsData(template_url,
152 search_terms_data).GetOrigin(); 153 search_terms_data).GetOrigin();
153 } 154 }
154 155
155 } // namespace 156 } // namespace
156 157
157 SearchProviderInstallData::SearchProviderInstallData( 158 SearchProviderInstallData::SearchProviderInstallData(
158 Profile* profile, 159 Profile* profile,
159 int ui_death_notification, 160 int ui_death_notification,
160 const content::NotificationSource& ui_death_source) 161 const content::NotificationSource& ui_death_source)
161 : web_service_(profile->GetWebDataService(Profile::EXPLICIT_ACCESS)), 162 : web_service_(WebDataServiceFactory::GetForProfile(profile,
163 Profile::EXPLICIT_ACCESS)),
162 load_handle_(0), 164 load_handle_(0),
163 google_base_url_(UIThreadSearchTermsData(profile).GoogleBaseURLValue()) { 165 google_base_url_(UIThreadSearchTermsData(profile).GoogleBaseURLValue()) {
164 // GoogleURLObserver is responsible for killing itself when 166 // GoogleURLObserver is responsible for killing itself when
165 // the given notification occurs. 167 // the given notification occurs.
166 new GoogleURLObserver(profile, new GoogleURLChangeNotifier(AsWeakPtr()), 168 new GoogleURLObserver(profile, new GoogleURLChangeNotifier(AsWeakPtr()),
167 ui_death_notification, ui_death_source); 169 ui_death_notification, ui_death_source);
168 DetachFromThread(); 170 DetachFromThread();
169 } 171 }
170 172
171 SearchProviderInstallData::~SearchProviderInstallData() { 173 SearchProviderInstallData::~SearchProviderInstallData() {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 299
298 std::for_each(closure_queue.begin(), 300 std::for_each(closure_queue.begin(),
299 closure_queue.end(), 301 closure_queue.end(),
300 std::mem_fun_ref(&base::Closure::Run)); 302 std::mem_fun_ref(&base::Closure::Run));
301 303
302 // Since we expect this request to be rare, clear out the information. This 304 // Since we expect this request to be rare, clear out the information. This
303 // also keeps the responses current as the search providers change. 305 // also keeps the responses current as the search providers change.
304 provider_map_.reset(); 306 provider_map_.reset();
305 SetDefault(NULL); 307 SetDefault(NULL);
306 } 308 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | chrome/browser/search_engines/template_url_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698