OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/charger_replacement_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/charger_replacement_ui.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/webui/chromeos/charger_replacement_handler.h" | 9 #include "chrome/browser/ui/webui/chromeos/charger_replacement_handler.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
11 #include "content/public/browser/web_ui.h" | 11 #include "content/public/browser/web_ui.h" |
12 #include "content/public/browser/web_ui_data_source.h" | 12 #include "content/public/browser/web_ui_data_source.h" |
13 #include "grit/browser_resources.h" | 13 #include "grit/browser_resources.h" |
14 | 14 |
15 namespace chromeos { | 15 namespace chromeos { |
16 | 16 |
17 ChargerReplacementUI::ChargerReplacementUI(content::WebUI* web_ui) | 17 ChargerReplacementUI::ChargerReplacementUI(content::WebUI* web_ui) |
18 : WebDialogUI(web_ui) { | 18 : WebDialogUI(web_ui) { |
19 base::DictionaryValue localized_strings; | 19 base::DictionaryValue localized_strings; |
20 ChargerReplacementHandler::GetLocalizedValues(&localized_strings); | 20 ChargerReplacementHandler::GetLocalizedValues(&localized_strings); |
21 content::WebUIDataSource* source = content::WebUIDataSource::Create( | 21 content::WebUIDataSource* source = content::WebUIDataSource::Create( |
22 chrome::kChromeUIChargerReplacementHost); | 22 chrome::kChromeUIChargerReplacementHost); |
23 source->SetUseJsonJSFormatV2(); | |
24 source->AddLocalizedStrings(localized_strings); | 23 source->AddLocalizedStrings(localized_strings); |
25 source->SetJsonPath("strings.js"); | 24 source->SetJsonPath("strings.js"); |
26 source->SetDefaultResource(IDR_CHARGER_REPLACEMENT_HTML); | 25 source->SetDefaultResource(IDR_CHARGER_REPLACEMENT_HTML); |
27 source->DisableContentSecurityPolicy(); | 26 source->DisableContentSecurityPolicy(); |
28 | 27 |
29 Profile* profile = Profile::FromWebUI(web_ui); | 28 Profile* profile = Profile::FromWebUI(web_ui); |
30 content::WebUIDataSource::Add(profile, source); | 29 content::WebUIDataSource::Add(profile, source); |
31 } | 30 } |
32 | 31 |
33 ChargerReplacementUI::~ChargerReplacementUI() { | 32 ChargerReplacementUI::~ChargerReplacementUI() { |
34 } | 33 } |
35 | 34 |
36 } // namespace chromeos | 35 } // namespace chromeos |
OLD | NEW |