| 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/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_handler.h" | 10 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_handler.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 break; | 74 break; |
| 75 default: | 75 default: |
| 76 NOTREACHED() << "Unsupported shelf alignment"; | 76 NOTREACHED() << "Unsupported shelf alignment"; |
| 77 } | 77 } |
| 78 localized_strings->SetString("shelfAlignment", shelf_alignment); | 78 localized_strings->SetString("shelfAlignment", shelf_alignment); |
| 79 } | 79 } |
| 80 | 80 |
| 81 content::WebUIDataSource* CreateDataSource() { | 81 content::WebUIDataSource* CreateDataSource() { |
| 82 content::WebUIDataSource* source = | 82 content::WebUIDataSource* source = |
| 83 content::WebUIDataSource::Create(chrome::kChromeUIFirstRunHost); | 83 content::WebUIDataSource::Create(chrome::kChromeUIFirstRunHost); |
| 84 source->SetUseJsonJSFormatV2(); | |
| 85 source->SetJsonPath("strings.js"); | 84 source->SetJsonPath("strings.js"); |
| 86 source->SetDefaultResource(IDR_FIRST_RUN_HTML); | 85 source->SetDefaultResource(IDR_FIRST_RUN_HTML); |
| 87 source->AddResourcePath(kFirstRunJSPath, IDR_FIRST_RUN_JS); | 86 source->AddResourcePath(kFirstRunJSPath, IDR_FIRST_RUN_JS); |
| 88 base::DictionaryValue localized_strings; | 87 base::DictionaryValue localized_strings; |
| 89 webui::SetFontAndTextDirection(&localized_strings); | 88 webui::SetFontAndTextDirection(&localized_strings); |
| 90 SetLocalizedStrings(&localized_strings); | 89 SetLocalizedStrings(&localized_strings); |
| 91 source->AddLocalizedStrings(localized_strings); | 90 source->AddLocalizedStrings(localized_strings); |
| 92 return source; | 91 return source; |
| 93 } | 92 } |
| 94 | 93 |
| 95 } // anonymous namespace | 94 } // anonymous namespace |
| 96 | 95 |
| 97 namespace chromeos { | 96 namespace chromeos { |
| 98 | 97 |
| 99 FirstRunUI::FirstRunUI(content::WebUI* web_ui) | 98 FirstRunUI::FirstRunUI(content::WebUI* web_ui) |
| 100 : WebUIController(web_ui), | 99 : WebUIController(web_ui), |
| 101 actor_(NULL) { | 100 actor_(NULL) { |
| 102 FirstRunHandler* handler = new FirstRunHandler(); | 101 FirstRunHandler* handler = new FirstRunHandler(); |
| 103 actor_ = handler; | 102 actor_ = handler; |
| 104 web_ui->AddMessageHandler(handler); | 103 web_ui->AddMessageHandler(handler); |
| 105 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), CreateDataSource()); | 104 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), CreateDataSource()); |
| 106 } | 105 } |
| 107 | 106 |
| 108 } // namespace chromeos | 107 } // namespace chromeos |
| 109 | 108 |
| OLD | NEW |