blob: 88ef86418a9f4ba61980e5b5896e1dbf2c9ceb0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/webui/help/help_ui.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/help/help_handler.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
#include "chrome/browser/ui/webui/shared_resources_data_source.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "grit/browser_resources.h"
namespace {
ChromeWebUIDataSource* CreateAboutPageHTMLSource() {
ChromeWebUIDataSource* source =
new ChromeWebUIDataSource(chrome::kChromeUIHelpFrameHost);
source->set_json_path("strings.js");
source->set_use_json_js_format_v2();
source->add_resource_path("help.js", IDR_HELP_JS);
source->set_default_resource(IDR_HELP_HTML);
return source;
}
} // namespace
HelpUI::HelpUI(content::WebUI* web_ui)
: WebUIController(web_ui) {
Profile* profile = Profile::FromWebUI(web_ui);
ChromeWebUIDataSource* source = CreateAboutPageHTMLSource();
ChromeURLDataManager::AddDataSource(profile, source);
ChromeURLDataManager::AddDataSource(profile, new SharedResourcesDataSource());
HelpHandler* handler = new HelpHandler();
handler->GetLocalizedValues(source->localized_strings());
web_ui->AddMessageHandler(handler);
}
HelpUI::~HelpUI() {
}
|