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/predictors/predictors_ui.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/webui/predictors/predictors_handler.h"
9 #include "chrome/common/url_constants.h"
10 #include "content/public/browser/web_contents.h"
11 #include "content/public/browser/web_ui.h"
12 #include "content/public/browser/web_ui_data_source.h"
13 #include "grit/browser_resources.h"
17 content::WebUIDataSource
* CreatePredictorsUIHTMLSource() {
18 content::WebUIDataSource
* source
=
19 content::WebUIDataSource::Create(chrome::kChromeUIPredictorsHost
);
20 source
->AddResourcePath("predictors.js", IDR_PREDICTORS_JS
);
21 source
->SetDefaultResource(IDR_PREDICTORS_HTML
);
27 PredictorsUI::PredictorsUI(content::WebUI
* web_ui
) : WebUIController(web_ui
) {
28 Profile
* profile
= Profile::FromWebUI(web_ui
);
29 web_ui
->AddMessageHandler(new PredictorsHandler(profile
));
30 content::WebUIDataSource::Add(profile
, CreatePredictorsUIHTMLSource());