Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3205)

Unified Diff: chrome/browser/ui/webui/mojo_web_ui_controller.cc

Issue 222543004: Makes chrome://omnibox use mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: get working with mojo changes Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/mojo_web_ui_controller.h ('k') | chrome/browser/ui/webui/mojo_web_ui_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/mojo_web_ui_controller.cc
diff --git a/chrome/browser/ui/webui/mojo_web_ui_controller.cc b/chrome/browser/ui/webui/mojo_web_ui_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..099efaf7a0332355dde6438075372eda6f5b1284
--- /dev/null
+++ b/chrome/browser/ui/webui/mojo_web_ui_controller.cc
@@ -0,0 +1,38 @@
+// Copyright 2014 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/mojo_web_ui_controller.h"
+
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/mojo_web_ui_handler.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/web_ui_data_source.h"
+#include "content/public/common/bindings_policy.h"
+#include "mojo/public/cpp/bindings/interface.h"
+
+MojoWebUIController::MojoWebUIController(content::WebUI* contents)
+ : WebUIController(contents),
+ mojo_data_source_(NULL) {
+}
+
+MojoWebUIController::~MojoWebUIController() {
+}
+
+void MojoWebUIController::RenderViewCreated(
+ content::RenderViewHost* render_view_host) {
+ render_view_host->AllowBindings(content::BINDINGS_POLICY_WEB_UI);
+
+ mojo::InterfacePipe<mojo::AnyInterface, mojo::AnyInterface> pipe;
+ ui_handler_ = CreateUIHandler(pipe.handle_to_peer.Pass());
+ render_view_host->SetWebUIHandle(pipe.handle_to_self.Pass());
+}
+
+void MojoWebUIController::AddMojoResourcePath(const std::string& path,
+ int resource_id) {
+ if (!mojo_data_source_) {
+ mojo_data_source_ = content::WebUIDataSource::AddMojoDataSource(
+ Profile::FromWebUI(web_ui()));
+ }
+ mojo_data_source_->AddResourcePath(path, resource_id);
+}
« no previous file with comments | « chrome/browser/ui/webui/mojo_web_ui_controller.h ('k') | chrome/browser/ui/webui/mojo_web_ui_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698