Chromium Code Reviews| Index: chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc |
| diff --git a/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc b/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8819bc16934bbad863f1ff7e9b5ad0fa95ce287c |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc |
| @@ -0,0 +1,41 @@ |
| +// Copyright (c) 2013 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/translate_internals/translate_internals_ui.h" |
| + |
| +#include <string> |
| + |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/ui/webui/translate_internals/translate_internals_handler.h" |
| +#include "chrome/common/url_constants.h" |
| +#include "content/public/browser/web_contents.h" |
| +#include "content/public/browser/web_ui.h" |
| +#include "content/public/browser/web_ui_data_source.h" |
| +#include "grit/browser_resources.h" |
| +#include "grit/translate_internals_resources.h" |
| +#include "ui/base/l10n/l10n_util.h" |
| +#include "ui/base/resource/resource_bundle.h" |
| + |
| +using content::WebContents; |
| + |
| +namespace { |
| + |
| +content::WebUIDataSource* CreateTranslateInternalsHTMLSource() { |
| + content::WebUIDataSource* source = |
| + content::WebUIDataSource::Create(chrome::kChromeUITranslateInternalsHost); |
| + source->SetDefaultResource(IDR_TRANSLATE_INTERNALS_INDEX_HTML); |
| + source->AddResourcePath("index.js", IDR_TRANSLATE_INTERNALS_INDEX_JS); |
| + 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
|
| + return source; |
| +} |
| + |
| +} // namespace |
| + |
| +TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui) |
| + : WebUIController(web_ui) { |
| + web_ui->AddMessageHandler(new TranslateInternalsHandler); |
| + |
| + Profile* profile = Profile::FromWebUI(web_ui); |
| + content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource()); |
| +} |