OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "chrome/browser/ui/webui/predictors/autocomplete_action_predictor_ui.h" | |
6 | |
7 #include "chrome/browser/profiles/profile.h" | |
8 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | |
9 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | |
10 #include "chrome/browser/ui/webui/predictors/autocomplete_action_predictor_dom_h
andler.h" | |
11 #include "chrome/common/url_constants.h" | |
12 #include "content/public/browser/web_contents.h" | |
13 #include "content/public/browser/web_ui.h" | |
14 #include "grit/browser_resources.h" | |
15 | |
16 namespace { | |
17 | |
18 ChromeWebUIDataSource* CreateAutocompleteActionPredictorUIHTMLSource() { | |
19 ChromeWebUIDataSource* source = | |
20 new ChromeWebUIDataSource(chrome::kChromeUIPredictorsHost); | |
21 source->add_resource_path("autocomplete_action_predictor.js", | |
22 IDR_AUTOCOMPLETE_ACTION_PREDICTOR_JS); | |
23 source->set_default_resource(IDR_AUTOCOMPLETE_ACTION_PREDICTOR_HTML); | |
24 return source; | |
25 } | |
26 | |
27 } // namespace | |
28 | |
29 AutocompleteActionPredictorUI::AutocompleteActionPredictorUI( | |
30 content::WebUI* web_ui) : WebUIController(web_ui) { | |
31 Profile* profile = Profile::FromWebUI(web_ui); | |
32 web_ui->AddMessageHandler(new AutocompleteActionPredictorDOMHandler(profile)); | |
33 ChromeURLDataManager::AddDataSource(profile, | |
34 CreateAutocompleteActionPredictorUIHTMLSource()); | |
35 } | |
OLD | NEW |