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/predictors/predictors_ui.h" | 5 #include "chrome/browser/ui/webui/predictors/predictors_ui.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 8 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
9 #include "chrome/browser/ui/webui/predictors/predictors_handler.h" | 9 #include "chrome/browser/ui/webui/predictors/predictors_handler.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
12 #include "content/public/browser/web_ui.h" | 12 #include "content/public/browser/web_ui.h" |
13 #include "grit/browser_resources.h" | 13 #include "grit/browser_resources.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 ChromeWebUIDataSource* CreatePredictorsUIHTMLSource() { | 17 ChromeWebUIDataSource* CreatePredictorsUIHTMLSource() { |
18 ChromeWebUIDataSource* source = | 18 ChromeWebUIDataSource* source = |
19 new ChromeWebUIDataSource(chrome::kChromeUIPredictorsHost); | 19 new ChromeWebUIDataSource(chrome::kChromeUIPredictorsHost); |
20 source->add_resource_path("predictors.js", IDR_PREDICTORS_JS); | 20 source->add_resource_path("predictors.js", IDR_PREDICTORS_JS); |
21 source->set_default_resource(IDR_PREDICTORS_HTML); | 21 source->set_default_resource(IDR_PREDICTORS_HTML); |
22 return source; | 22 return source; |
23 } | 23 } |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 PredictorsUI::PredictorsUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 27 PredictorsUI::PredictorsUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
28 Profile* profile = Profile::FromWebUI(web_ui); | 28 Profile* profile = Profile::FromWebUI(web_ui); |
29 web_ui->AddMessageHandler(new PredictorsHandler(profile)); | 29 web_ui->AddMessageHandler(new PredictorsHandler(profile)); |
30 ChromeURLDataManager::AddDataSource(profile, CreatePredictorsUIHTMLSource()); | 30 ChromeURLDataManager::AddDataSourceImpl(profile, |
| 31 CreatePredictorsUIHTMLSource()); |
31 } | 32 } |
OLD | NEW |