first_run_private_api.cc revision effb81e5f8246d0db0270817048dc992db66e9fb
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. 4 5#include "chrome/browser/chromeos/extensions/first_run_private_api.h" 6 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/login/user_manager.h" 11#include "chrome/browser/profiles/profile_manager.h" 12#include "grit/chromium_strings.h" 13#include "grit/generated_resources.h" 14#include "ui/base/l10n/l10n_util.h" 15#include "ui/base/webui/web_ui_util.h" 16 17bool FirstRunPrivateGetLocalizedStringsFunction::RunImpl() { 18 UMA_HISTOGRAM_COUNTS("CrosFirstRun.DialogShown", 1); 19 base::DictionaryValue* localized_strings = new base::DictionaryValue(); 20 chromeos::User* user = 21 chromeos::UserManager::Get()->GetUserByProfile(GetProfile()); 22 if (!user->given_name().empty()) { 23 localized_strings->SetString( 24 "greetingHeader", 25 l10n_util::GetStringFUTF16(IDS_FIRST_RUN_GREETING_STEP_HEADER, 26 user->given_name())); 27 } else { 28 localized_strings->SetString( 29 "greetingHeader", 30 l10n_util::GetStringUTF16(IDS_FIRST_RUN_GREETING_STEP_HEADER_GENERAL)); 31 } 32 base::string16 product_name = 33 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME); 34 localized_strings->SetString( 35 "greetingText1", 36 l10n_util::GetStringFUTF16(IDS_FIRST_RUN_GREETING_STEP_TEXT_1, 37 product_name)); 38 localized_strings->SetString( 39 "greetingText2", 40 l10n_util::GetStringFUTF16(IDS_FIRST_RUN_GREETING_STEP_TEXT_2, 41 product_name)); 42 localized_strings->SetString( 43 "greetingButton", 44 l10n_util::GetStringUTF16(IDS_FIRST_RUN_GREETING_STEP_BUTTON)); 45 localized_strings->SetString( 46 "closeButton", 47 l10n_util::GetStringUTF16(IDS_CLOSE)); 48 webui::SetFontAndTextDirection(localized_strings); 49 SetResult(localized_strings); 50 return true; 51} 52 53bool FirstRunPrivateLaunchTutorialFunction::RunImpl() { 54 chromeos::first_run::LaunchTutorial(); 55 return true; 56} 57