Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / webui / omnibox / omnibox_ui.cc
index d677beb..2ff94ac 100644 (file)
@@ -12,8 +12,7 @@
 #include "content/public/browser/web_ui_data_source.h"
 #include "grit/browser_resources.h"
 
-OmniboxUI::OmniboxUI(content::WebUI* web_ui)
-    : content::WebUIController(web_ui) {
+OmniboxUI::OmniboxUI(content::WebUI* web_ui) : MojoWebUIController(web_ui) {
   // Set up the chrome://omnibox/ source.
   content::WebUIDataSource* html_source =
       content::WebUIDataSource::Create(chrome::kChromeUIOmniboxHost);
@@ -21,11 +20,17 @@ OmniboxUI::OmniboxUI(content::WebUI* web_ui)
   html_source->AddResourcePath("omnibox.js", IDR_OMNIBOX_JS);
   html_source->SetDefaultResource(IDR_OMNIBOX_HTML);
 
-  Profile* profile = Profile::FromWebUI(web_ui);
-  content::WebUIDataSource::Add(profile, html_source);
+  content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source);
 
-  // AddMessageHandler takes ownership of OmniboxUIHandler
-  web_ui->AddMessageHandler(new OmniboxUIHandler(profile));
+  AddMojoResourcePath("chrome/browser/ui/webui/omnibox/omnibox.mojom",
+                      IDR_OMNIBOX_MOJO_JS);
 }
 
-OmniboxUI::~OmniboxUI() { }
+OmniboxUI::~OmniboxUI() {}
+
+scoped_ptr<MojoWebUIHandler> OmniboxUI::CreateUIHandler(
+    mojo::ScopedMessagePipeHandle handle_to_page) {
+  return scoped_ptr<MojoWebUIHandler>(
+      mojo::BindToPipe(new OmniboxUIHandler(Profile::FromWebUI(web_ui())),
+                       handle_to_page.Pass()));
+}