| 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/ui/webui/chromeos/first_run/first_run_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_ui.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_handler.h" | 11 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_handler.h" |
| 11 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
| 12 #include "chrome/grit/chromium_strings.h" | 13 #include "chrome/grit/chromium_strings.h" |
| 13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 14 #include "chromeos/chromeos_switches.h" | 15 #include "chromeos/chromeos_switches.h" |
| 15 #include "content/public/browser/web_ui.h" | 16 #include "content/public/browser/web_ui.h" |
| 16 #include "content/public/browser/web_ui_data_source.h" | 17 #include "content/public/browser/web_ui_data_source.h" |
| 17 #include "grit/browser_resources.h" | 18 #include "grit/browser_resources.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 localized_strings->SetString("shelfAlignment", shelf_alignment); | 79 localized_strings->SetString("shelfAlignment", shelf_alignment); |
| 79 } | 80 } |
| 80 | 81 |
| 81 content::WebUIDataSource* CreateDataSource() { | 82 content::WebUIDataSource* CreateDataSource() { |
| 82 content::WebUIDataSource* source = | 83 content::WebUIDataSource* source = |
| 83 content::WebUIDataSource::Create(chrome::kChromeUIFirstRunHost); | 84 content::WebUIDataSource::Create(chrome::kChromeUIFirstRunHost); |
| 84 source->SetJsonPath("strings.js"); | 85 source->SetJsonPath("strings.js"); |
| 85 source->SetDefaultResource(IDR_FIRST_RUN_HTML); | 86 source->SetDefaultResource(IDR_FIRST_RUN_HTML); |
| 86 source->AddResourcePath(kFirstRunJSPath, IDR_FIRST_RUN_JS); | 87 source->AddResourcePath(kFirstRunJSPath, IDR_FIRST_RUN_JS); |
| 87 base::DictionaryValue localized_strings; | 88 base::DictionaryValue localized_strings; |
| 88 webui::SetFontAndTextDirection(&localized_strings); | 89 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
| 90 webui::SetLoadTimeDataDefaults(app_locale, &localized_strings); |
| 89 SetLocalizedStrings(&localized_strings); | 91 SetLocalizedStrings(&localized_strings); |
| 90 source->AddLocalizedStrings(localized_strings); | 92 source->AddLocalizedStrings(localized_strings); |
| 91 return source; | 93 return source; |
| 92 } | 94 } |
| 93 | 95 |
| 94 } // anonymous namespace | 96 } // anonymous namespace |
| 95 | 97 |
| 96 namespace chromeos { | 98 namespace chromeos { |
| 97 | 99 |
| 98 FirstRunUI::FirstRunUI(content::WebUI* web_ui) | 100 FirstRunUI::FirstRunUI(content::WebUI* web_ui) |
| 99 : WebUIController(web_ui), | 101 : WebUIController(web_ui), |
| 100 actor_(NULL) { | 102 actor_(NULL) { |
| 101 FirstRunHandler* handler = new FirstRunHandler(); | 103 FirstRunHandler* handler = new FirstRunHandler(); |
| 102 actor_ = handler; | 104 actor_ = handler; |
| 103 web_ui->AddMessageHandler(handler); | 105 web_ui->AddMessageHandler(handler); |
| 104 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), CreateDataSource()); | 106 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), CreateDataSource()); |
| 105 } | 107 } |
| 106 | 108 |
| 107 } // namespace chromeos | 109 } // namespace chromeos |
| 108 | 110 |
| OLD | NEW |