| OLD | NEW |
| 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 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 // indicate that the service should not be used. | 495 // indicate that the service should not be used. |
| 496 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 496 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 497 switches::kVariationsServerURL)) { | 497 switches::kVariationsServerURL)) { |
| 498 DVLOG(1) << "Not creating VariationsService in unofficial build without --" | 498 DVLOG(1) << "Not creating VariationsService in unofficial build without --" |
| 499 << switches::kVariationsServerURL << " specified."; | 499 << switches::kVariationsServerURL << " specified."; |
| 500 return result; | 500 return result; |
| 501 } | 501 } |
| 502 #endif | 502 #endif |
| 503 result.reset(new VariationsService( | 503 result.reset(new VariationsService( |
| 504 std::move(client), | 504 std::move(client), |
| 505 base::WrapUnique(new web_resource::ResourceRequestAllowedNotifier( | 505 base::MakeUnique<web_resource::ResourceRequestAllowedNotifier>( |
| 506 local_state, disable_network_switch)), | 506 local_state, disable_network_switch), |
| 507 local_state, state_manager, ui_string_overrider)); | 507 local_state, state_manager, ui_string_overrider)); |
| 508 return result; | 508 return result; |
| 509 } | 509 } |
| 510 | 510 |
| 511 // static | 511 // static |
| 512 std::unique_ptr<VariationsService> VariationsService::CreateForTesting( | 512 std::unique_ptr<VariationsService> VariationsService::CreateForTesting( |
| 513 std::unique_ptr<VariationsServiceClient> client, | 513 std::unique_ptr<VariationsServiceClient> client, |
| 514 PrefService* local_state) { | 514 PrefService* local_state) { |
| 515 return base::WrapUnique(new VariationsService( | 515 return base::WrapUnique(new VariationsService( |
| 516 std::move(client), | 516 std::move(client), |
| 517 base::WrapUnique(new web_resource::ResourceRequestAllowedNotifier( | 517 base::MakeUnique<web_resource::ResourceRequestAllowedNotifier>( |
| 518 local_state, nullptr)), | 518 local_state, nullptr), |
| 519 local_state, nullptr, UIStringOverrider())); | 519 local_state, nullptr, UIStringOverrider())); |
| 520 } | 520 } |
| 521 | 521 |
| 522 void VariationsService::DoActualFetch() { | 522 void VariationsService::DoActualFetch() { |
| 523 DCHECK(thread_checker_.CalledOnValidThread()); | 523 DCHECK(thread_checker_.CalledOnValidThread()); |
| 524 DCHECK(!pending_seed_request_); | 524 DCHECK(!pending_seed_request_); |
| 525 | 525 |
| 526 pending_seed_request_ = net::URLFetcher::Create(0, variations_server_url_, | 526 pending_seed_request_ = net::URLFetcher::Create(0, variations_server_url_, |
| 527 net::URLFetcher::GET, this); | 527 net::URLFetcher::GET, this); |
| 528 data_use_measurement::DataUseUserData::AttachToFetcher( | 528 data_use_measurement::DataUseUserData::AttachToFetcher( |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 | 897 |
| 898 if (got_stored_country && stored_country == country_override) | 898 if (got_stored_country && stored_country == country_override) |
| 899 return false; | 899 return false; |
| 900 | 900 |
| 901 base::Version version(version_info::GetVersionNumber()); | 901 base::Version version(version_info::GetVersionNumber()); |
| 902 StorePermanentCountry(version, country_override); | 902 StorePermanentCountry(version, country_override); |
| 903 return true; | 903 return true; |
| 904 } | 904 } |
| 905 | 905 |
| 906 } // namespace variations | 906 } // namespace variations |
| OLD | NEW |