OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/suggestions_internals/suggestions_internals_ui .h" | 5 #include "chrome/browser/ui/webui/suggestions_internals/suggestions_internals_ui .h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/webui/fallback_icon_source.h" | |
8 #include "chrome/browser/ui/webui/favicon_source.h" | 9 #include "chrome/browser/ui/webui/favicon_source.h" |
9 #include "chrome/browser/ui/webui/suggestions_internals/suggestions_internals_ui _handler.h" | 10 #include "chrome/browser/ui/webui/suggestions_internals/suggestions_internals_ui _handler.h" |
10 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
11 #include "content/public/browser/url_data_source.h" | 12 #include "content/public/browser/url_data_source.h" |
12 #include "content/public/browser/web_ui.h" | 13 #include "content/public/browser/web_ui.h" |
13 #include "content/public/browser/web_ui_controller.h" | 14 #include "content/public/browser/web_ui_controller.h" |
14 #include "content/public/browser/web_ui_data_source.h" | 15 #include "content/public/browser/web_ui_data_source.h" |
15 #include "grit/browser_resources.h" | 16 #include "grit/browser_resources.h" |
16 | 17 |
17 SuggestionsInternalsUI::SuggestionsInternalsUI(content::WebUI* web_ui) | 18 SuggestionsInternalsUI::SuggestionsInternalsUI(content::WebUI* web_ui) |
18 : content::WebUIController(web_ui) { | 19 : content::WebUIController(web_ui) { |
19 // Set up the chrome://suggestions-internals/ source. | 20 // Set up the chrome://suggestions-internals/ source. |
20 content::WebUIDataSource* html_source = content::WebUIDataSource::Create( | 21 content::WebUIDataSource* html_source = content::WebUIDataSource::Create( |
21 chrome::kChromeUISuggestionsInternalsHost); | 22 chrome::kChromeUISuggestionsInternalsHost); |
22 html_source->AddResourcePath("suggestions_internals.css", | 23 html_source->AddResourcePath("suggestions_internals.css", |
23 IDR_SUGGESTIONS_INTERNALS_CSS); | 24 IDR_SUGGESTIONS_INTERNALS_CSS); |
24 html_source->AddResourcePath("suggestions_internals.js", | 25 html_source->AddResourcePath("suggestions_internals.js", |
25 IDR_SUGGESTIONS_INTERNALS_JS); | 26 IDR_SUGGESTIONS_INTERNALS_JS); |
26 html_source->SetDefaultResource(IDR_SUGGESTIONS_INTERNALS_HTML); | 27 html_source->SetDefaultResource(IDR_SUGGESTIONS_INTERNALS_HTML); |
27 | 28 |
28 Profile* profile = Profile::FromWebUI(web_ui); | 29 Profile* profile = Profile::FromWebUI(web_ui); |
29 content::WebUIDataSource::Add(profile, html_source); | 30 content::WebUIDataSource::Add(profile, html_source); |
31 content::URLDataSource::Add(profile, new FallbackIconSource()); | |
pkotwicz
2015/01/21 19:44:15
I don't think that this class is used for the NTP.
huangs
2015/01/22 01:13:27
Done.
| |
30 content::URLDataSource::Add( | 32 content::URLDataSource::Add( |
31 profile, new FaviconSource(profile, FaviconSource::FAVICON)); | 33 profile, new FaviconSource(profile, FaviconSource::FAVICON)); |
32 | 34 |
33 // AddMessageHandler takes ownership of SuggestionsInternalsUIHandler | 35 // AddMessageHandler takes ownership of SuggestionsInternalsUIHandler |
34 web_ui->AddMessageHandler(new SuggestionsInternalsUIHandler(profile)); | 36 web_ui->AddMessageHandler(new SuggestionsInternalsUIHandler(profile)); |
35 } | 37 } |
36 | 38 |
37 SuggestionsInternalsUI::~SuggestionsInternalsUI() { } | 39 SuggestionsInternalsUI::~SuggestionsInternalsUI() { } |
OLD | NEW |