OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/chrome_variations_service_client.h" | 5 #include "chrome/browser/metrics/variations/chrome_variations_service_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/metrics/variations/generated_resources_map.h" |
9 #include "chrome/common/channel_info.h" | 10 #include "chrome/common/channel_info.h" |
10 #include "components/version_info/version_info.h" | 11 #include "components/version_info/version_info.h" |
11 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "ui/base/resource/resource_bundle.h" |
12 | 14 |
13 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS) | 15 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS) |
14 #include "chrome/browser/upgrade_detector_impl.h" | 16 #include "chrome/browser/upgrade_detector_impl.h" |
15 #endif | 17 #endif |
16 | 18 |
17 namespace { | 19 namespace { |
18 | 20 |
19 // Gets the version number to use for variations seed simulation. Must be called | 21 // Gets the version number to use for variations seed simulation. Must be called |
20 // on a thread where IO is allowed. | 22 // on a thread where IO is allowed. |
21 base::Version GetVersionForSimulation() { | 23 base::Version GetVersionForSimulation() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 59 |
58 network_time::NetworkTimeTracker* | 60 network_time::NetworkTimeTracker* |
59 ChromeVariationsServiceClient::GetNetworkTimeTracker() { | 61 ChromeVariationsServiceClient::GetNetworkTimeTracker() { |
60 return g_browser_process->network_time_tracker(); | 62 return g_browser_process->network_time_tracker(); |
61 } | 63 } |
62 | 64 |
63 version_info::Channel ChromeVariationsServiceClient::GetChannel() { | 65 version_info::Channel ChromeVariationsServiceClient::GetChannel() { |
64 return chrome::GetChannel(); | 66 return chrome::GetChannel(); |
65 } | 67 } |
66 | 68 |
| 69 void ChromeVariationsServiceClient::OverrideUIString( |
| 70 uint32_t hash, |
| 71 const base::string16& string) { |
| 72 int resource_id = chrome_variations::GetResourceIndex(hash); |
| 73 if (resource_id == -1) |
| 74 return; |
| 75 |
| 76 ui::ResourceBundle::GetSharedInstance().OverrideLocaleStringResource( |
| 77 resource_id, string); |
| 78 } |
| 79 |
67 void ChromeVariationsServiceClient::OnInitialStartup() { | 80 void ChromeVariationsServiceClient::OnInitialStartup() { |
68 #if defined(OS_WIN) | 81 #if defined(OS_WIN) |
69 StartGoogleUpdateRegistrySync(); | 82 StartGoogleUpdateRegistrySync(); |
70 #endif | 83 #endif |
71 } | 84 } |
72 | 85 |
73 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
74 void ChromeVariationsServiceClient::StartGoogleUpdateRegistrySync() { | 87 void ChromeVariationsServiceClient::StartGoogleUpdateRegistrySync() { |
75 registry_syncer_.RequestRegistrySync(); | 88 registry_syncer_.RequestRegistrySync(); |
76 } | 89 } |
77 #endif | 90 #endif |
OLD | NEW |