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

Side by Side Diff: components/search_engines/keyword_web_data_service.cc

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/search_engines/keyword_web_data_service.h" 5 #include "components/search_engines/keyword_web_data_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
8 #include "components/search_engines/keyword_table.h" 10 #include "components/search_engines/keyword_table.h"
9 #include "components/search_engines/template_url_data.h" 11 #include "components/search_engines/template_url_data.h"
10 #include "components/webdata/common/web_data_results.h" 12 #include "components/webdata/common/web_data_results.h"
11 #include "components/webdata/common/web_database_service.h" 13 #include "components/webdata/common/web_database_service.h"
12 14
13 using base::Bind; 15 using base::Bind;
14 16
15 WDKeywordsResult::WDKeywordsResult() 17 WDKeywordsResult::WDKeywordsResult()
16 : default_search_provider_id(0), 18 : default_search_provider_id(0),
17 builtin_keyword_version(0) { 19 builtin_keyword_version(0) {
18 } 20 }
19 21
20 WDKeywordsResult::~WDKeywordsResult() {} 22 WDKeywordsResult::~WDKeywordsResult() {}
21 23
22 KeywordWebDataService::BatchModeScoper::BatchModeScoper( 24 KeywordWebDataService::BatchModeScoper::BatchModeScoper(
23 KeywordWebDataService* service) 25 KeywordWebDataService* service)
24 : service_(service) { 26 : service_(service) {
25 if (service_) 27 if (service_)
26 service_->AdjustBatchModeLevel(true); 28 service_->AdjustBatchModeLevel(true);
27 } 29 }
28 30
29 KeywordWebDataService::BatchModeScoper::~BatchModeScoper() { 31 KeywordWebDataService::BatchModeScoper::~BatchModeScoper() {
30 if (service_) 32 if (service_)
31 service_->AdjustBatchModeLevel(false); 33 service_->AdjustBatchModeLevel(false);
32 } 34 }
33 35
34 KeywordWebDataService::KeywordWebDataService( 36 KeywordWebDataService::KeywordWebDataService(
35 scoped_refptr<WebDatabaseService> wdbs, 37 scoped_refptr<WebDatabaseService> wdbs,
36 scoped_refptr<base::MessageLoopProxy> ui_thread, 38 scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
37 const ProfileErrorCallback& callback) 39 const ProfileErrorCallback& callback)
38 : WebDataServiceBase(wdbs, callback, ui_thread), 40 : WebDataServiceBase(wdbs, callback, ui_thread), batch_mode_level_(0) {
39 batch_mode_level_(0) {
40 } 41 }
41 42
42 void KeywordWebDataService::AddKeyword(const TemplateURLData& data) { 43 void KeywordWebDataService::AddKeyword(const TemplateURLData& data) {
43 if (batch_mode_level_) { 44 if (batch_mode_level_) {
44 queued_keyword_operations_.push_back( 45 queued_keyword_operations_.push_back(
45 KeywordTable::Operation(KeywordTable::ADD, data)); 46 KeywordTable::Operation(KeywordTable::ADD, data));
46 } else { 47 } else {
47 AdjustBatchModeLevel(true); 48 AdjustBatchModeLevel(true);
48 AddKeyword(data); 49 AddKeyword(data);
49 AdjustBatchModeLevel(false); 50 AdjustBatchModeLevel(false);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 return KeywordTable::FromWebDatabase(db)->SetDefaultSearchProviderID(id) ? 141 return KeywordTable::FromWebDatabase(db)->SetDefaultSearchProviderID(id) ?
141 WebDatabase::COMMIT_NEEDED : WebDatabase::COMMIT_NOT_NEEDED; 142 WebDatabase::COMMIT_NEEDED : WebDatabase::COMMIT_NOT_NEEDED;
142 } 143 }
143 144
144 WebDatabase::State KeywordWebDataService::SetBuiltinKeywordVersionImpl( 145 WebDatabase::State KeywordWebDataService::SetBuiltinKeywordVersionImpl(
145 int version, 146 int version,
146 WebDatabase* db) { 147 WebDatabase* db) {
147 return KeywordTable::FromWebDatabase(db)->SetBuiltinKeywordVersion(version) ? 148 return KeywordTable::FromWebDatabase(db)->SetBuiltinKeywordVersion(version) ?
148 WebDatabase::COMMIT_NEEDED : WebDatabase::COMMIT_NOT_NEEDED; 149 WebDatabase::COMMIT_NEEDED : WebDatabase::COMMIT_NOT_NEEDED;
149 } 150 }
OLDNEW
« no previous file with comments | « components/search_engines/keyword_web_data_service.h ('k') | components/search_provider_logos/logo_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698