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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 } | 344 } |
345 | 345 |
346 void VariationsService::AddObserver(Observer* observer) { | 346 void VariationsService::AddObserver(Observer* observer) { |
347 observer_list_.AddObserver(observer); | 347 observer_list_.AddObserver(observer); |
348 } | 348 } |
349 | 349 |
350 void VariationsService::RemoveObserver(Observer* observer) { | 350 void VariationsService::RemoveObserver(Observer* observer) { |
351 observer_list_.RemoveObserver(observer); | 351 observer_list_.RemoveObserver(observer); |
352 } | 352 } |
353 | 353 |
354 // TODO(rkaplow): Handle this and the similar event in metrics_service by | |
355 // observing an 'OnAppEnterForeground' event in RequestScheduler instead of | |
356 // requiring the frontend code to notify each service individually. Since the | |
357 // scheduler will handle it directly the VariationService shouldn't need to | |
358 // know details of this anymore. | |
359 void VariationsService::OnAppEnterForeground() { | 354 void VariationsService::OnAppEnterForeground() { |
| 355 // On mobile platforms, initialize the fetch scheduler when we receive the |
| 356 // first app foreground notification. |
| 357 if (!request_scheduler_) |
| 358 StartRepeatedVariationsSeedFetch(); |
360 request_scheduler_->OnAppEnterForeground(); | 359 request_scheduler_->OnAppEnterForeground(); |
361 } | 360 } |
362 | 361 |
363 #if defined(OS_WIN) | 362 #if defined(OS_WIN) |
364 void VariationsService::StartGoogleUpdateRegistrySync() { | 363 void VariationsService::StartGoogleUpdateRegistrySync() { |
365 registry_syncer_.RequestRegistrySync(); | 364 registry_syncer_.RequestRegistrySync(); |
366 } | 365 } |
367 #endif | 366 #endif |
368 | 367 |
369 void VariationsService::SetRestrictMode(const std::string& restrict_mode) { | 368 void VariationsService::SetRestrictMode(const std::string& restrict_mode) { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 local_state_->SetInt64(prefs::kVariationsLastFetchTime, | 644 local_state_->SetInt64(prefs::kVariationsLastFetchTime, |
646 base::Time::Now().ToInternalValue()); | 645 base::Time::Now().ToInternalValue()); |
647 } | 646 } |
648 } | 647 } |
649 | 648 |
650 std::string VariationsService::GetInvalidVariationsSeedSignature() const { | 649 std::string VariationsService::GetInvalidVariationsSeedSignature() const { |
651 return seed_store_.GetInvalidSignature(); | 650 return seed_store_.GetInvalidSignature(); |
652 } | 651 } |
653 | 652 |
654 } // namespace chrome_variations | 653 } // namespace chrome_variations |
OLD | NEW |