OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/extensions/first_run_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/first_run_private_api.h" |
6 | 6 |
| 7 #include <memory> |
| 8 #include <utility> |
| 9 |
7 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
8 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/chromeos/first_run/first_run.h" | 12 #include "chrome/browser/chromeos/first_run/first_run.h" |
10 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 13 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
11 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
12 #include "chrome/grit/chromium_strings.h" | 15 #include "chrome/grit/chromium_strings.h" |
13 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
14 #include "components/user_manager/user.h" | 17 #include "components/user_manager/user.h" |
15 #include "grit/components_strings.h" | 18 #include "grit/components_strings.h" |
16 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
17 #include "ui/base/webui/web_ui_util.h" | 20 #include "ui/base/webui/web_ui_util.h" |
18 | 21 |
19 bool FirstRunPrivateGetLocalizedStringsFunction::RunSync() { | 22 bool FirstRunPrivateGetLocalizedStringsFunction::RunSync() { |
20 UMA_HISTOGRAM_COUNTS("CrosFirstRun.DialogShown", 1); | 23 UMA_HISTOGRAM_COUNTS("CrosFirstRun.DialogShown", 1); |
21 base::DictionaryValue* localized_strings = new base::DictionaryValue(); | 24 std::unique_ptr<base::DictionaryValue> localized_strings( |
| 25 new base::DictionaryValue()); |
22 const user_manager::User* user = | 26 const user_manager::User* user = |
23 chromeos::ProfileHelper::Get()->GetUserByProfile(GetProfile()); | 27 chromeos::ProfileHelper::Get()->GetUserByProfile(GetProfile()); |
24 if (!user->GetGivenName().empty()) { | 28 if (!user->GetGivenName().empty()) { |
25 localized_strings->SetString( | 29 localized_strings->SetString( |
26 "greetingHeader", | 30 "greetingHeader", |
27 l10n_util::GetStringFUTF16(IDS_FIRST_RUN_GREETING_STEP_HEADER, | 31 l10n_util::GetStringFUTF16(IDS_FIRST_RUN_GREETING_STEP_HEADER, |
28 user->GetGivenName())); | 32 user->GetGivenName())); |
29 } else { | 33 } else { |
30 localized_strings->SetString( | 34 localized_strings->SetString( |
31 "greetingHeader", | 35 "greetingHeader", |
(...skipping 10 matching lines...) Expand all Loading... |
42 l10n_util::GetStringFUTF16(IDS_FIRST_RUN_GREETING_STEP_TEXT_2, | 46 l10n_util::GetStringFUTF16(IDS_FIRST_RUN_GREETING_STEP_TEXT_2, |
43 product_name)); | 47 product_name)); |
44 localized_strings->SetString( | 48 localized_strings->SetString( |
45 "greetingButton", | 49 "greetingButton", |
46 l10n_util::GetStringUTF16(IDS_FIRST_RUN_GREETING_STEP_BUTTON)); | 50 l10n_util::GetStringUTF16(IDS_FIRST_RUN_GREETING_STEP_BUTTON)); |
47 localized_strings->SetString( | 51 localized_strings->SetString( |
48 "closeButton", | 52 "closeButton", |
49 l10n_util::GetStringUTF16(IDS_CLOSE)); | 53 l10n_util::GetStringUTF16(IDS_CLOSE)); |
50 | 54 |
51 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 55 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
52 webui::SetLoadTimeDataDefaults(app_locale, localized_strings); | 56 webui::SetLoadTimeDataDefaults(app_locale, localized_strings.get()); |
53 | 57 |
54 SetResult(localized_strings); | 58 SetResult(std::move(localized_strings)); |
55 return true; | 59 return true; |
56 } | 60 } |
57 | 61 |
58 bool FirstRunPrivateLaunchTutorialFunction::RunSync() { | 62 bool FirstRunPrivateLaunchTutorialFunction::RunSync() { |
59 chromeos::first_run::LaunchTutorial(); | 63 chromeos::first_run::LaunchTutorial(); |
60 return true; | 64 return true; |
61 } | 65 } |
OLD | NEW |