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

Side by Side Diff: components/variations/service/variations_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, 11 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 (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 "components/variations/service/variations_service.h" 5 #include "components/variations/service/variations_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility>
9 10
10 #include "base/build_time.h" 11 #include "base/build_time.h"
11 #include "base/command_line.h" 12 #include "base/command_line.h"
12 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
13 #include "base/metrics/sparse_histogram.h" 14 #include "base/metrics/sparse_histogram.h"
14 #include "base/prefs/pref_registry_simple.h" 15 #include "base/prefs/pref_registry_simple.h"
15 #include "base/prefs/pref_service.h" 16 #include "base/prefs/pref_service.h"
16 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
17 #include "base/sys_info.h" 18 #include "base/sys_info.h"
18 #include "base/task_runner_util.h" 19 #include "base/task_runner_util.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 270 }
270 271
271 } // namespace 272 } // namespace
272 273
273 VariationsService::VariationsService( 274 VariationsService::VariationsService(
274 scoped_ptr<VariationsServiceClient> client, 275 scoped_ptr<VariationsServiceClient> client,
275 scoped_ptr<web_resource::ResourceRequestAllowedNotifier> notifier, 276 scoped_ptr<web_resource::ResourceRequestAllowedNotifier> notifier,
276 PrefService* local_state, 277 PrefService* local_state,
277 metrics::MetricsStateManager* state_manager, 278 metrics::MetricsStateManager* state_manager,
278 const UIStringOverrider& ui_string_overrider) 279 const UIStringOverrider& ui_string_overrider)
279 : client_(client.Pass()), 280 : client_(std::move(client)),
280 ui_string_overrider_(ui_string_overrider), 281 ui_string_overrider_(ui_string_overrider),
281 local_state_(local_state), 282 local_state_(local_state),
282 state_manager_(state_manager), 283 state_manager_(state_manager),
283 policy_pref_service_(local_state), 284 policy_pref_service_(local_state),
284 seed_store_(local_state), 285 seed_store_(local_state),
285 create_trials_from_seed_called_(false), 286 create_trials_from_seed_called_(false),
286 initial_request_completed_(false), 287 initial_request_completed_(false),
287 disable_deltas_for_next_request_(false), 288 disable_deltas_for_next_request_(false),
288 resource_request_allowed_notifier_(notifier.Pass()), 289 resource_request_allowed_notifier_(std::move(notifier)),
289 request_count_(0), 290 request_count_(0),
290 weak_ptr_factory_(this) { 291 weak_ptr_factory_(this) {
291 DCHECK(client_.get()); 292 DCHECK(client_.get());
292 DCHECK(resource_request_allowed_notifier_.get()); 293 DCHECK(resource_request_allowed_notifier_.get());
293 294
294 resource_request_allowed_notifier_->Init(this); 295 resource_request_allowed_notifier_->Init(this);
295 } 296 }
296 297
297 VariationsService::~VariationsService() { 298 VariationsService::~VariationsService() {
298 } 299 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 const char* disable_network_switch, 487 const char* disable_network_switch,
487 const UIStringOverrider& ui_string_overrider) { 488 const UIStringOverrider& ui_string_overrider) {
488 scoped_ptr<VariationsService> result; 489 scoped_ptr<VariationsService> result;
489 #if !defined(GOOGLE_CHROME_BUILD) 490 #if !defined(GOOGLE_CHROME_BUILD)
490 // Unless the URL was provided, unsupported builds should return NULL to 491 // Unless the URL was provided, unsupported builds should return NULL to
491 // indicate that the service should not be used. 492 // indicate that the service should not be used.
492 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 493 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
493 switches::kVariationsServerURL)) { 494 switches::kVariationsServerURL)) {
494 DVLOG(1) << "Not creating VariationsService in unofficial build without --" 495 DVLOG(1) << "Not creating VariationsService in unofficial build without --"
495 << switches::kVariationsServerURL << " specified."; 496 << switches::kVariationsServerURL << " specified.";
496 return result.Pass(); 497 return result;
497 } 498 }
498 #endif 499 #endif
499 result.reset(new VariationsService( 500 result.reset(new VariationsService(
500 client.Pass(), 501 std::move(client),
501 make_scoped_ptr(new web_resource::ResourceRequestAllowedNotifier( 502 make_scoped_ptr(new web_resource::ResourceRequestAllowedNotifier(
502 local_state, disable_network_switch)), 503 local_state, disable_network_switch)),
503 local_state, state_manager, ui_string_overrider)); 504 local_state, state_manager, ui_string_overrider));
504 return result.Pass(); 505 return result;
505 } 506 }
506 507
507 // static 508 // static
508 scoped_ptr<VariationsService> VariationsService::CreateForTesting( 509 scoped_ptr<VariationsService> VariationsService::CreateForTesting(
509 scoped_ptr<VariationsServiceClient> client, 510 scoped_ptr<VariationsServiceClient> client,
510 PrefService* local_state) { 511 PrefService* local_state) {
511 return make_scoped_ptr(new VariationsService( 512 return make_scoped_ptr(new VariationsService(
512 client.Pass(), 513 std::move(client),
513 make_scoped_ptr(new web_resource::ResourceRequestAllowedNotifier( 514 make_scoped_ptr(new web_resource::ResourceRequestAllowedNotifier(
514 local_state, nullptr)), 515 local_state, nullptr)),
515 local_state, nullptr, UIStringOverrider())); 516 local_state, nullptr, UIStringOverrider()));
516 } 517 }
517 518
518 void VariationsService::DoActualFetch() { 519 void VariationsService::DoActualFetch() {
519 DCHECK(thread_checker_.CalledOnValidThread()); 520 DCHECK(thread_checker_.CalledOnValidThread());
520 DCHECK(!pending_seed_request_); 521 DCHECK(!pending_seed_request_);
521 522
522 pending_seed_request_ = net::URLFetcher::Create(0, variations_server_url_, 523 pending_seed_request_ = net::URLFetcher::Create(0, variations_server_url_,
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 std::string stored_country; 858 std::string stored_country;
858 859
859 if (list_value->GetSize() == 2) { 860 if (list_value->GetSize() == 2) {
860 list_value->GetString(1, &stored_country); 861 list_value->GetString(1, &stored_country);
861 } 862 }
862 863
863 return stored_country; 864 return stored_country;
864 } 865 }
865 866
866 } // namespace variations 867 } // namespace variations
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698