| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/mojo_web_ui_controller.h" | 5 #include "chrome/browser/ui/webui/mojo_web_ui_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/webui/mojo_web_ui_handler.h" | 8 #include "chrome/browser/ui/webui/mojo_web_ui_handler.h" |
| 9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
| 10 #include "content/public/browser/web_ui_data_source.h" | 10 #include "content/public/browser/web_ui_data_source.h" |
| 11 #include "content/public/common/bindings_policy.h" | 11 #include "content/public/common/bindings_policy.h" |
| 12 #include "third_party/mojo/src/mojo/public/cpp/system/core.h" | 12 #include "mojo/public/cpp/system/core.h" |
| 13 | 13 |
| 14 MojoWebUIControllerBase::MojoWebUIControllerBase(content::WebUI* contents) | 14 MojoWebUIControllerBase::MojoWebUIControllerBase(content::WebUI* contents) |
| 15 : WebUIController(contents), mojo_data_source_(NULL) { | 15 : WebUIController(contents), mojo_data_source_(NULL) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 MojoWebUIControllerBase::~MojoWebUIControllerBase() { | 18 MojoWebUIControllerBase::~MojoWebUIControllerBase() { |
| 19 } | 19 } |
| 20 | 20 |
| 21 void MojoWebUIControllerBase::RenderViewCreated( | 21 void MojoWebUIControllerBase::RenderViewCreated( |
| 22 content::RenderViewHost* render_view_host) { | 22 content::RenderViewHost* render_view_host) { |
| 23 render_view_host->AllowBindings(content::BINDINGS_POLICY_WEB_UI); | 23 render_view_host->AllowBindings(content::BINDINGS_POLICY_WEB_UI); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void MojoWebUIControllerBase::AddMojoResourcePath(const std::string& path, | 26 void MojoWebUIControllerBase::AddMojoResourcePath(const std::string& path, |
| 27 int resource_id) { | 27 int resource_id) { |
| 28 if (!mojo_data_source_) { | 28 if (!mojo_data_source_) { |
| 29 mojo_data_source_ = content::WebUIDataSource::AddMojoDataSource( | 29 mojo_data_source_ = content::WebUIDataSource::AddMojoDataSource( |
| 30 Profile::FromWebUI(web_ui())); | 30 Profile::FromWebUI(web_ui())); |
| 31 } | 31 } |
| 32 mojo_data_source_->AddResourcePath(path, resource_id); | 32 mojo_data_source_->AddResourcePath(path, resource_id); |
| 33 } | 33 } |
| OLD | NEW |