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 "chrome/browser/metrics/variations/variations_service.h" | 5 #include "chrome/browser/metrics/variations/variations_service.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/build_time.h" | 9 #include "base/build_time.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 } else { | 314 } else { |
315 UMA_HISTOGRAM_COUNTS_100("Variations.SeedDateSkew.BuildTimeAheadBy", | 315 UMA_HISTOGRAM_COUNTS_100("Variations.SeedDateSkew.BuildTimeAheadBy", |
316 build_time_delta_days); | 316 build_time_delta_days); |
317 } | 317 } |
318 } | 318 } |
319 | 319 |
320 return true; | 320 return true; |
321 } | 321 } |
322 | 322 |
323 void VariationsService::StartRepeatedVariationsSeedFetch() { | 323 void VariationsService::StartRepeatedVariationsSeedFetch() { |
324 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 324 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
325 | 325 |
326 // Initialize the Variations server URL. | 326 // Initialize the Variations server URL. |
327 variations_server_url_ = | 327 variations_server_url_ = |
328 GetVariationsServerURL(policy_pref_service_, restrict_mode_); | 328 GetVariationsServerURL(policy_pref_service_, restrict_mode_); |
329 | 329 |
330 // Check that |CreateTrialsFromSeed| was called, which is necessary to | 330 // Check that |CreateTrialsFromSeed| was called, which is necessary to |
331 // retrieve the serial number that will be sent to the server. | 331 // retrieve the serial number that will be sent to the server. |
332 DCHECK(create_trials_from_seed_called_); | 332 DCHECK(create_trials_from_seed_called_); |
333 | 333 |
334 DCHECK(!request_scheduler_.get()); | 334 DCHECK(!request_scheduler_.get()); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 487 |
488 base::PostTaskAndReplyWithResult( | 488 base::PostTaskAndReplyWithResult( |
489 content::BrowserThread::GetBlockingPool(), | 489 content::BrowserThread::GetBlockingPool(), |
490 FROM_HERE, | 490 FROM_HERE, |
491 base::Bind(&GetVersionForSimulation), | 491 base::Bind(&GetVersionForSimulation), |
492 base::Bind(&VariationsService::PerformSimulationWithVersion, | 492 base::Bind(&VariationsService::PerformSimulationWithVersion, |
493 weak_ptr_factory_.GetWeakPtr(), base::Passed(&seed))); | 493 weak_ptr_factory_.GetWeakPtr(), base::Passed(&seed))); |
494 } | 494 } |
495 | 495 |
496 void VariationsService::FetchVariationsSeed() { | 496 void VariationsService::FetchVariationsSeed() { |
497 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 497 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
498 | 498 |
499 const web_resource::ResourceRequestAllowedNotifier::State state = | 499 const web_resource::ResourceRequestAllowedNotifier::State state = |
500 resource_request_allowed_notifier_->GetResourceRequestsAllowedState(); | 500 resource_request_allowed_notifier_->GetResourceRequestsAllowedState(); |
501 RecordRequestsAllowedHistogram(ResourceRequestStateToHistogramValue(state)); | 501 RecordRequestsAllowedHistogram(ResourceRequestStateToHistogramValue(state)); |
502 if (state != web_resource::ResourceRequestAllowedNotifier::ALLOWED) { | 502 if (state != web_resource::ResourceRequestAllowedNotifier::ALLOWED) { |
503 DVLOG(1) << "Resource requests were not allowed. Waiting for notification."; | 503 DVLOG(1) << "Resource requests were not allowed. Waiting for notification."; |
504 return; | 504 return; |
505 } | 505 } |
506 | 506 |
507 DoActualFetch(); | 507 DoActualFetch(); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 local_state_->SetInt64(prefs::kVariationsLastFetchTime, | 640 local_state_->SetInt64(prefs::kVariationsLastFetchTime, |
641 base::Time::Now().ToInternalValue()); | 641 base::Time::Now().ToInternalValue()); |
642 } | 642 } |
643 } | 643 } |
644 | 644 |
645 std::string VariationsService::GetInvalidVariationsSeedSignature() const { | 645 std::string VariationsService::GetInvalidVariationsSeedSignature() const { |
646 return seed_store_.GetInvalidSignature(); | 646 return seed_store_.GetInvalidSignature(); |
647 } | 647 } |
648 | 648 |
649 } // namespace chrome_variations | 649 } // namespace chrome_variations |
OLD | NEW |