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/ui/webui/chromeos/first_run/first_run_ui.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_handler.h"
9 #include "chrome/common/url_constants.h"
10 #include "content/public/browser/web_ui.h"
11 #include "content/public/browser/web_ui_data_source.h"
12 #include "grit/browser_resources.h"
13 #include "ui/base/webui/web_ui_util.h"
17 const char kFirstRunJSPath[] = "first_run.js";
19 content::WebUIDataSource* CreateDataSource() {
20 content::WebUIDataSource* source =
21 content::WebUIDataSource::Create(chrome::kChromeUIFirstRunHost);
22 source->SetUseJsonJSFormatV2();
23 source->SetJsonPath("strings.js");
24 source->SetDefaultResource(IDR_FIRST_RUN_HTML);
25 source->AddResourcePath(kFirstRunJSPath, IDR_FIRST_RUN_JS);
26 base::DictionaryValue localized_strings;
27 webui::SetFontAndTextDirection(&localized_strings);
28 source->AddLocalizedStrings(localized_strings);
32 } // anonymous namespace
36 FirstRunUI::FirstRunUI(content::WebUI* web_ui)
37 : WebUIController(web_ui),
39 FirstRunHandler* handler = new FirstRunHandler();
41 web_ui->AddMessageHandler(handler);
42 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), CreateDataSource());
45 } // namespace chromeos