blob: 84b71491c987c74a8cd42dd22b022c6c5c65a18b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/webui/omnibox/omnibox_ui.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
#include "chrome/browser/ui/webui/omnibox/omnibox_ui_handler.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller.h"
#include "grit/browser_resources.h"
OmniboxUI::OmniboxUI(content::WebUI* web_ui)
: content::WebUIController(web_ui) {
// Set up the chrome://omnibox/ source.
ChromeWebUIDataSource* html_source =
new ChromeWebUIDataSource(chrome::kChromeUIOmniboxHost);
html_source->add_resource_path("omnibox.css", IDR_OMNIBOX_CSS);
html_source->add_resource_path("omnibox.js", IDR_OMNIBOX_JS);
html_source->set_default_resource(IDR_OMNIBOX_HTML);
Profile* profile = Profile::FromWebUI(web_ui);
ChromeURLDataManager::AddDataSource(profile, html_source);
// AddMessageHandler takes ownership of OmniboxUIHandler
web_ui->AddMessageHandler(new OmniboxUIHandler(profile));
}
OmniboxUI::~OmniboxUI() { }
|