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

Side by Side Diff: chrome/browser/metrics/variations/chrome_variations_service_client.cc

Issue 1363243004: Allow embedders to share code to override UI strings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment to test and class and fix typo Created 5 years, 2 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 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"
10 #include "chrome/common/channel_info.h" 9 #include "chrome/common/channel_info.h"
11 #include "components/version_info/version_info.h" 10 #include "components/version_info/version_info.h"
12 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
13 #include "ui/base/resource/resource_bundle.h"
14 12
15 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS) 13 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
16 #include "chrome/browser/upgrade_detector_impl.h" 14 #include "chrome/browser/upgrade_detector_impl.h"
17 #endif 15 #endif
18 16
19 #if defined(OS_CHROMEOS) 17 #if defined(OS_CHROMEOS)
20 #include "chrome/browser/chromeos/settings/cros_settings.h" 18 #include "chrome/browser/chromeos/settings/cros_settings.h"
21 #endif 19 #endif
22 20
23 namespace { 21 namespace {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 std::string* parameter) { 72 std::string* parameter) {
75 #if defined(OS_CHROMEOS) 73 #if defined(OS_CHROMEOS)
76 chromeos::CrosSettings::Get()->GetString( 74 chromeos::CrosSettings::Get()->GetString(
77 chromeos::kVariationsRestrictParameter, parameter); 75 chromeos::kVariationsRestrictParameter, parameter);
78 return true; 76 return true;
79 #else 77 #else
80 return false; 78 return false;
81 #endif 79 #endif
82 } 80 }
83 81
84 void ChromeVariationsServiceClient::OverrideUIString(
85 uint32_t hash,
86 const base::string16& string) {
87 int resource_id = chrome_variations::GetResourceIndex(hash);
88 if (resource_id == -1)
89 return;
90
91 ui::ResourceBundle::GetSharedInstance().OverrideLocaleStringResource(
92 resource_id, string);
93 }
94
95 void ChromeVariationsServiceClient::OnInitialStartup() { 82 void ChromeVariationsServiceClient::OnInitialStartup() {
96 #if defined(OS_WIN) 83 #if defined(OS_WIN)
97 StartGoogleUpdateRegistrySync(); 84 StartGoogleUpdateRegistrySync();
98 #endif 85 #endif
99 } 86 }
100 87
101 #if defined(OS_WIN) 88 #if defined(OS_WIN)
102 void ChromeVariationsServiceClient::StartGoogleUpdateRegistrySync() { 89 void ChromeVariationsServiceClient::StartGoogleUpdateRegistrySync() {
103 registry_syncer_.RequestRegistrySync(); 90 registry_syncer_.RequestRegistrySync();
104 } 91 }
105 #endif 92 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698