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

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

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 12 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/template_url_service.h" 5 #include "components/search_engines/template_url_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 TemplateURLService::TemplateURLService( 218 TemplateURLService::TemplateURLService(
219 PrefService* prefs, 219 PrefService* prefs,
220 scoped_ptr<SearchTermsData> search_terms_data, 220 scoped_ptr<SearchTermsData> search_terms_data,
221 const scoped_refptr<KeywordWebDataService>& web_data_service, 221 const scoped_refptr<KeywordWebDataService>& web_data_service,
222 scoped_ptr<TemplateURLServiceClient> client, 222 scoped_ptr<TemplateURLServiceClient> client,
223 GoogleURLTracker* google_url_tracker, 223 GoogleURLTracker* google_url_tracker,
224 rappor::RapporService* rappor_service, 224 rappor::RapporService* rappor_service,
225 const base::Closure& dsp_change_callback) 225 const base::Closure& dsp_change_callback)
226 : prefs_(prefs), 226 : prefs_(prefs),
227 search_terms_data_(search_terms_data.Pass()), 227 search_terms_data_(std::move(search_terms_data)),
228 web_data_service_(web_data_service), 228 web_data_service_(web_data_service),
229 client_(client.Pass()), 229 client_(std::move(client)),
230 google_url_tracker_(google_url_tracker), 230 google_url_tracker_(google_url_tracker),
231 rappor_service_(rappor_service), 231 rappor_service_(rappor_service),
232 dsp_change_callback_(dsp_change_callback), 232 dsp_change_callback_(dsp_change_callback),
233 provider_map_(new SearchHostToURLsMap), 233 provider_map_(new SearchHostToURLsMap),
234 loaded_(false), 234 loaded_(false),
235 load_failed_(false), 235 load_failed_(false),
236 disable_load_(false), 236 disable_load_(false),
237 load_handle_(0), 237 load_handle_(0),
238 default_search_provider_(NULL), 238 default_search_provider_(NULL),
239 next_id_(kInvalidTemplateURLID + 1), 239 next_id_(kInvalidTemplateURLID + 1),
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 return; 543 return;
544 544
545 TemplateURLData data; 545 TemplateURLData data;
546 data.SetShortName(base::UTF8ToUTF16(extension_name)); 546 data.SetShortName(base::UTF8ToUTF16(extension_name));
547 data.SetKeyword(base::UTF8ToUTF16(keyword)); 547 data.SetKeyword(base::UTF8ToUTF16(keyword));
548 data.SetURL(template_url_string); 548 data.SetURL(template_url_string);
549 TemplateURL* url = new TemplateURL(data); 549 TemplateURL* url = new TemplateURL(data);
550 scoped_ptr<TemplateURL::AssociatedExtensionInfo> info( 550 scoped_ptr<TemplateURL::AssociatedExtensionInfo> info(
551 new TemplateURL::AssociatedExtensionInfo( 551 new TemplateURL::AssociatedExtensionInfo(
552 TemplateURL::OMNIBOX_API_EXTENSION, extension_id)); 552 TemplateURL::OMNIBOX_API_EXTENSION, extension_id));
553 AddExtensionControlledTURL(url, info.Pass()); 553 AddExtensionControlledTURL(url, std::move(info));
554 } 554 }
555 555
556 TemplateURLService::TemplateURLVector TemplateURLService::GetTemplateURLs() { 556 TemplateURLService::TemplateURLVector TemplateURLService::GetTemplateURLs() {
557 return template_urls_; 557 return template_urls_;
558 } 558 }
559 559
560 void TemplateURLService::IncrementUsageCount(TemplateURL* url) { 560 void TemplateURLService::IncrementUsageCount(TemplateURL* url) {
561 DCHECK(url); 561 DCHECK(url);
562 // Extension-controlled search engines are not persisted. 562 // Extension-controlled search engines are not persisted.
563 if (url->GetType() != TemplateURL::NORMAL) 563 if (url->GetType() != TemplateURL::NORMAL)
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 syncer::SyncMergeResult merge_result(type); 1051 syncer::SyncMergeResult merge_result(type);
1052 1052
1053 // Disable sync if we failed to load. 1053 // Disable sync if we failed to load.
1054 if (load_failed_) { 1054 if (load_failed_) {
1055 merge_result.set_error(syncer::SyncError( 1055 merge_result.set_error(syncer::SyncError(
1056 FROM_HERE, syncer::SyncError::DATATYPE_ERROR, 1056 FROM_HERE, syncer::SyncError::DATATYPE_ERROR,
1057 "Local database load failed.", syncer::SEARCH_ENGINES)); 1057 "Local database load failed.", syncer::SEARCH_ENGINES));
1058 return merge_result; 1058 return merge_result;
1059 } 1059 }
1060 1060
1061 sync_processor_ = sync_processor.Pass(); 1061 sync_processor_ = std::move(sync_processor);
1062 sync_error_factory_ = sync_error_factory.Pass(); 1062 sync_error_factory_ = std::move(sync_error_factory);
1063 1063
1064 // We do a lot of calls to Add/Remove/ResetTemplateURL here, so ensure we 1064 // We do a lot of calls to Add/Remove/ResetTemplateURL here, so ensure we
1065 // don't step on our own toes. 1065 // don't step on our own toes.
1066 base::AutoReset<bool> processing_changes(&processing_syncer_changes_, true); 1066 base::AutoReset<bool> processing_changes(&processing_syncer_changes_, true);
1067 1067
1068 // We've started syncing, so set our origin member to the base Sync value. 1068 // We've started syncing, so set our origin member to the base Sync value.
1069 // As we move through Sync Code, we may set this to increasingly specific 1069 // As we move through Sync Code, we may set this to increasingly specific
1070 // origins so we can tell what exactly caused a DSP change. 1070 // origins so we can tell what exactly caused a DSP change.
1071 base::AutoReset<DefaultSearchChangeOrigin> change_origin(&dsp_change_origin_, 1071 base::AutoReset<DefaultSearchChangeOrigin> change_origin(&dsp_change_origin_,
1072 DSP_CHANGE_SYNC_UNINTENTIONAL); 1072 DSP_CHANGE_SYNC_UNINTENTIONAL);
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 search_terms_data)) { 1355 search_terms_data)) {
1356 // Ignore keyword changes triggered by the Google base URL changing on 1356 // Ignore keyword changes triggered by the Google base URL changing on
1357 // another client. If the base URL changes in this client as well, we'll 1357 // another client. If the base URL changes in this client as well, we'll
1358 // pick that up separately at the appropriate time. Otherwise, changing 1358 // pick that up separately at the appropriate time. Otherwise, changing
1359 // the keyword here could result in having the wrong keyword for the local 1359 // the keyword here could result in having the wrong keyword for the local
1360 // environment. 1360 // environment.
1361 turl->data_.SetKeyword(existing_turl->keyword()); 1361 turl->data_.SetKeyword(existing_turl->keyword());
1362 } 1362 }
1363 } 1363 }
1364 1364
1365 return turl.Pass(); 1365 return turl;
1366 } 1366 }
1367 1367
1368 // static 1368 // static
1369 SyncDataMap TemplateURLService::CreateGUIDToSyncDataMap( 1369 SyncDataMap TemplateURLService::CreateGUIDToSyncDataMap(
1370 const syncer::SyncDataList& sync_data) { 1370 const syncer::SyncDataList& sync_data) {
1371 SyncDataMap data_map; 1371 SyncDataMap data_map;
1372 for (syncer::SyncDataList::const_iterator i(sync_data.begin()); 1372 for (syncer::SyncDataList::const_iterator i(sync_data.begin());
1373 i != sync_data.end(); 1373 i != sync_data.end();
1374 ++i) 1374 ++i)
1375 data_map[i->GetSpecifics().search_engine().sync_guid()] = *i; 1375 data_map[i->GetSpecifics().search_engine().sync_guid()] = *i;
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
2429 2429
2430 if (most_recently_intalled_default) { 2430 if (most_recently_intalled_default) {
2431 base::AutoReset<DefaultSearchChangeOrigin> change_origin( 2431 base::AutoReset<DefaultSearchChangeOrigin> change_origin(
2432 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); 2432 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION);
2433 default_search_manager_.SetExtensionControlledDefaultSearchEngine( 2433 default_search_manager_.SetExtensionControlledDefaultSearchEngine(
2434 most_recently_intalled_default->data()); 2434 most_recently_intalled_default->data());
2435 } else { 2435 } else {
2436 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); 2436 default_search_manager_.ClearExtensionControlledDefaultSearchEngine();
2437 } 2437 }
2438 } 2438 }
OLDNEW
« no previous file with comments | « components/search_engines/template_url_service.h ('k') | components/search_engines/template_url_service_sync_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698