OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h" | |
6 | |
7 #include <string> | |
8 | |
9 #include "chrome/browser/profiles/profile.h" | |
10 #include "chrome/browser/ui/webui/translate_internals/translate_internals_handle r.h" | |
11 #include "chrome/common/url_constants.h" | |
12 #include "content/public/browser/web_contents.h" | |
13 #include "content/public/browser/web_ui.h" | |
14 #include "content/public/browser/web_ui_data_source.h" | |
15 #include "grit/browser_resources.h" | |
16 #include "grit/translate_internals_resources.h" | |
17 #include "ui/base/l10n/l10n_util.h" | |
18 #include "ui/base/resource/resource_bundle.h" | |
19 | |
20 using content::WebContents; | |
21 | |
22 namespace { | |
23 | |
24 content::WebUIDataSource* CreateTranslateInternalsHTMLSource() { | |
25 content::WebUIDataSource* source = | |
26 content::WebUIDataSource::Create(chrome::kChromeUITranslateInternalsHost); | |
27 source->SetDefaultResource(IDR_TRANSLATE_INTERNALS_INDEX_HTML); | |
28 source->AddResourcePath("index.js", IDR_TRANSLATE_INTERNALS_INDEX_JS); | |
29 source->SetJsonPath("strings.js"); // Why is this needed? I'm not sure. | |
Takashi Toyoshima
2013/04/12 08:43:35
If you want to ask reviewers, you should not write
| |
30 return source; | |
31 } | |
32 | |
33 } // namespace | |
34 | |
35 TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui) | |
36 : WebUIController(web_ui) { | |
37 web_ui->AddMessageHandler(new TranslateInternalsHandler); | |
38 | |
39 Profile* profile = Profile::FromWebUI(web_ui); | |
40 content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource()); | |
41 } | |
OLD | NEW |