| 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 "ios/web/webui/web_ui_ios_impl.h" | 5 #include "ios/web/webui/web_ui_ios_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 message_callbacks_.find(message); | 136 message_callbacks_.find(message); |
| 137 if (callback != message_callbacks_.end()) { | 137 if (callback != message_callbacks_.end()) { |
| 138 // Forward this message and content on. | 138 // Forward this message and content on. |
| 139 callback->second.Run(&args); | 139 callback->second.Run(&args); |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 // WebUIIOSImpl, protected: | 143 // WebUIIOSImpl, protected: |
| 144 // ------------------------------------------------------- | 144 // ------------------------------------------------------- |
| 145 | 145 |
| 146 void WebUIIOSImpl::AddMessageHandler(WebUIIOSMessageHandler* handler) { | 146 void WebUIIOSImpl::AddMessageHandler( |
| 147 std::unique_ptr<WebUIIOSMessageHandler> handler) { |
| 147 DCHECK(!handler->web_ui()); | 148 DCHECK(!handler->web_ui()); |
| 148 handler->set_web_ui(this); | 149 handler->set_web_ui(this); |
| 149 handler->RegisterMessages(); | 150 handler->RegisterMessages(); |
| 150 handlers_.push_back(handler); | 151 handlers_.push_back(std::move(handler)); |
| 151 } | 152 } |
| 152 | 153 |
| 153 void WebUIIOSImpl::ExecuteJavascript(const base::string16& javascript) { | 154 void WebUIIOSImpl::ExecuteJavascript(const base::string16& javascript) { |
| 154 web_state_->ExecuteJavaScript(javascript); | 155 web_state_->ExecuteJavaScript(javascript); |
| 155 } | 156 } |
| 156 | 157 |
| 157 } // namespace web | 158 } // namespace web |
| OLD | NEW |