BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / chromeos / extensions / first_run_private_api.cc
blob088f3fc765f0f29dc21ff51d647d9c467fade46d
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
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/extensions/first_run_private_api.h"
7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chromeos/first_run/first_run.h"
10 #include "chrome/browser/chromeos/profiles/profile_helper.h"
11 #include "chrome/browser/profiles/profile_manager.h"
12 #include "chrome/grit/chromium_strings.h"
13 #include "chrome/grit/generated_resources.h"
14 #include "components/user_manager/user.h"
15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/base/webui/web_ui_util.h"
18 bool FirstRunPrivateGetLocalizedStringsFunction::RunSync() {
19 UMA_HISTOGRAM_COUNTS("CrosFirstRun.DialogShown", 1);
20 base::DictionaryValue* localized_strings = new base::DictionaryValue();
21 const user_manager::User* user =
22 chromeos::ProfileHelper::Get()->GetUserByProfile(GetProfile());
23 if (!user->GetGivenName().empty()) {
24 localized_strings->SetString(
25 "greetingHeader",
26 l10n_util::GetStringFUTF16(IDS_FIRST_RUN_GREETING_STEP_HEADER,
27 user->GetGivenName()));
28 } else {
29 localized_strings->SetString(
30 "greetingHeader",
31 l10n_util::GetStringUTF16(IDS_FIRST_RUN_GREETING_STEP_HEADER_GENERAL));
33 base::string16 product_name =
34 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME);
35 localized_strings->SetString(
36 "greetingText1",
37 l10n_util::GetStringFUTF16(IDS_FIRST_RUN_GREETING_STEP_TEXT_1,
38 product_name));
39 localized_strings->SetString(
40 "greetingText2",
41 l10n_util::GetStringFUTF16(IDS_FIRST_RUN_GREETING_STEP_TEXT_2,
42 product_name));
43 localized_strings->SetString(
44 "greetingButton",
45 l10n_util::GetStringUTF16(IDS_FIRST_RUN_GREETING_STEP_BUTTON));
46 localized_strings->SetString(
47 "closeButton",
48 l10n_util::GetStringUTF16(IDS_CLOSE));
50 const std::string& app_locale = g_browser_process->GetApplicationLocale();
51 webui::SetLoadTimeDataDefaults(app_locale, localized_strings);
53 SetResult(localized_strings);
54 return true;
57 bool FirstRunPrivateLaunchTutorialFunction::RunSync() {
58 chromeos::first_run::LaunchTutorial();
59 return true;