NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / webui / suggestions_internals / suggestions_internals_ui.cc
blobd55e8a76da877d3dec44aa397f6c77d0aed60d5e
1 // Copyright (c) 2012 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.
5 #include "chrome/browser/ui/webui/suggestions_internals/suggestions_internals_ui.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/webui/favicon_source.h"
9 #include "chrome/browser/ui/webui/suggestions_internals/suggestions_internals_ui_handler.h"
10 #include "chrome/common/url_constants.h"
11 #include "content/public/browser/url_data_source.h"
12 #include "content/public/browser/web_ui.h"
13 #include "content/public/browser/web_ui_controller.h"
14 #include "content/public/browser/web_ui_data_source.h"
15 #include "grit/browser_resources.h"
17 SuggestionsInternalsUI::SuggestionsInternalsUI(content::WebUI* web_ui)
18 : content::WebUIController(web_ui) {
19 // Set up the chrome://suggestions-internals/ source.
20 content::WebUIDataSource* html_source = content::WebUIDataSource::Create(
21 chrome::kChromeUISuggestionsInternalsHost);
22 html_source->AddResourcePath("suggestions_internals.css",
23 IDR_SUGGESTIONS_INTERNALS_CSS);
24 html_source->AddResourcePath("suggestions_internals.js",
25 IDR_SUGGESTIONS_INTERNALS_JS);
26 html_source->SetDefaultResource(IDR_SUGGESTIONS_INTERNALS_HTML);
28 Profile* profile = Profile::FromWebUI(web_ui);
29 content::WebUIDataSource::Add(profile, html_source);
30 content::URLDataSource::Add(
31 profile, new FaviconSource(profile, FaviconSource::FAVICON));
33 // AddMessageHandler takes ownership of SuggestionsInternalsUIHandler
34 web_ui->AddMessageHandler(new SuggestionsInternalsUIHandler(profile));
37 SuggestionsInternalsUI::~SuggestionsInternalsUI() { }