| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "ios/web/webui/mojo_facade.h" | 5 #import "ios/web/webui/mojo_facade.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #import "base/ios/block_types.h" | 9 #import "base/ios/block_types.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 const base::DictionaryValue* args) { | 108 const base::DictionaryValue* args) { |
| 109 const base::Value* interface_name_as_value = nullptr; | 109 const base::Value* interface_name_as_value = nullptr; |
| 110 CHECK(args->Get("interfaceName", &interface_name_as_value)); | 110 CHECK(args->Get("interfaceName", &interface_name_as_value)); |
| 111 | 111 |
| 112 // By design interface_provider.getInterface either succeeds or crashes, so | 112 // By design interface_provider.getInterface either succeeds or crashes, so |
| 113 // check if interface name is a valid string is intentionally omitted. | 113 // check if interface name is a valid string is intentionally omitted. |
| 114 std::string interface_name_as_string; | 114 std::string interface_name_as_string; |
| 115 interface_name_as_value->GetAsString(&interface_name_as_string); | 115 interface_name_as_value->GetAsString(&interface_name_as_string); |
| 116 | 116 |
| 117 mojo::MessagePipe pipe; | 117 mojo::MessagePipe pipe; |
| 118 interface_provider_->GetInterface( | 118 interface_provider_->GetInterface(interface_name_as_string, |
| 119 mojo::String::From(interface_name_as_string), std::move(pipe.handle0)); | 119 std::move(pipe.handle0)); |
| 120 | 120 |
| 121 return ValueFromInteger(pipe.handle1.release().value()); | 121 return ValueFromInteger(pipe.handle1.release().value()); |
| 122 } | 122 } |
| 123 | 123 |
| 124 std::unique_ptr<base::Value> MojoFacade::HandleCoreClose( | 124 std::unique_ptr<base::Value> MojoFacade::HandleCoreClose( |
| 125 const base::DictionaryValue* args) { | 125 const base::DictionaryValue* args) { |
| 126 int handle = 0; | 126 int handle = 0; |
| 127 CHECK(args->GetInteger("handle", &handle)); | 127 CHECK(args->GetInteger("handle", &handle)); |
| 128 | 128 |
| 129 mojo::Handle(handle).Close(); | 129 mojo::Handle(handle).Close(); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 264 |
| 265 std::unique_ptr<base::Value> MojoFacade::HandleSupportCancelWatch( | 265 std::unique_ptr<base::Value> MojoFacade::HandleSupportCancelWatch( |
| 266 const base::DictionaryValue* args) { | 266 const base::DictionaryValue* args) { |
| 267 int watch_id = 0; | 267 int watch_id = 0; |
| 268 CHECK(args->GetInteger("watchId", &watch_id)); | 268 CHECK(args->GetInteger("watchId", &watch_id)); |
| 269 watchers_.erase(watch_id); | 269 watchers_.erase(watch_id); |
| 270 return nullptr; | 270 return nullptr; |
| 271 } | 271 } |
| 272 | 272 |
| 273 } // namespace web | 273 } // namespace web |
| OLD | NEW |