| 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 "mojo/shell/shell.h" | 5 #include "mojo/shell/shell.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 } | 289 } |
| 290 return true; | 290 return true; |
| 291 } | 291 } |
| 292 | 292 |
| 293 bool ValidateClientProcessConnection( | 293 bool ValidateClientProcessConnection( |
| 294 mojom::ClientProcessConnectionPtr* client_process_connection, | 294 mojom::ClientProcessConnectionPtr* client_process_connection, |
| 295 const Identity& target, | 295 const Identity& target, |
| 296 const ConnectCallback& callback) { | 296 const ConnectCallback& callback) { |
| 297 if (!client_process_connection->is_null()) { | 297 if (!client_process_connection->is_null()) { |
| 298 if (!HasClass(capability_spec_, kCapabilityClass_ClientProcess)) { | 298 if (!HasClass(capability_spec_, kCapabilityClass_ClientProcess)) { |
| 299 LOG(WARNING) << "Instance: " << identity_.name() << " attempting " | 299 LOG(ERROR) << "Instance: " << identity_.name() << " attempting " |
| 300 << "to register an instance for a process it created for " | 300 << "to register an instance for a process it created for " |
| 301 << "target: " << target.name() << " without the " | 301 << "target: " << target.name() << " without the " |
| 302 << "mojo:shell{client_process} capability class."; | 302 << "mojo:shell{client_process} capability class."; |
| 303 callback.Run(mojom::ConnectResult::ACCESS_DENIED, | 303 callback.Run(mojom::ConnectResult::ACCESS_DENIED, |
| 304 mojom::kInheritUserID, mojom::kInvalidInstanceID); | 304 mojom::kInheritUserID, mojom::kInvalidInstanceID); |
| 305 return false; | 305 return false; |
| 306 } | 306 } |
| 307 | 307 |
| 308 if (!(*client_process_connection)->shell_client.is_valid() || | 308 if (!(*client_process_connection)->shell_client.is_valid() || |
| 309 !(*client_process_connection)->pid_receiver_request.is_valid()) { | 309 !(*client_process_connection)->pid_receiver_request.is_valid()) { |
| 310 LOG(WARNING) << "Must supply both shell_client AND " | 310 LOG(ERROR) << "Must supply both shell_client AND " |
| 311 << "pid_receiver_request when sending " | 311 << "pid_receiver_request when sending " |
| 312 << "client_process_connection."; | 312 << "client_process_connection."; |
| 313 callback.Run(mojom::ConnectResult::INVALID_ARGUMENT, | 313 callback.Run(mojom::ConnectResult::INVALID_ARGUMENT, |
| 314 mojom::kInheritUserID, mojom::kInvalidInstanceID); | 314 mojom::kInheritUserID, mojom::kInvalidInstanceID); |
| 315 return false; | 315 return false; |
| 316 } | 316 } |
| 317 if (shell_->GetExistingInstance(target)) { | 317 if (shell_->GetExistingInstance(target)) { |
| 318 LOG(WARNING) << "Cannot client process matching existing identity:" | 318 LOG(ERROR) << "Cannot client process matching existing identity:" |
| 319 << "Name: " << target.name() << " User: " | 319 << "Name: " << target.name() << " User: " |
| 320 << target.user_id() << " Instance: " << target.instance(); | 320 << target.user_id() << " Instance: " << target.instance(); |
| 321 callback.Run(mojom::ConnectResult::INVALID_ARGUMENT, | 321 callback.Run(mojom::ConnectResult::INVALID_ARGUMENT, |
| 322 mojom::kInheritUserID, mojom::kInvalidInstanceID); | 322 mojom::kInheritUserID, mojom::kInvalidInstanceID); |
| 323 return false; | 323 return false; |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 return true; | 326 return true; |
| 327 } | 327 } |
| 328 | 328 |
| 329 bool ValidateCapabilities(const Identity& target, | 329 bool ValidateCapabilities(const Identity& target, |
| 330 const ConnectCallback& callback) { | 330 const ConnectCallback& callback) { |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 for (auto it = native_runners_.begin(); it != native_runners_.end(); ++it) { | 782 for (auto it = native_runners_.begin(); it != native_runners_.end(); ++it) { |
| 783 if (it->get() == runner) { | 783 if (it->get() == runner) { |
| 784 native_runners_.erase(it); | 784 native_runners_.erase(it); |
| 785 return; | 785 return; |
| 786 } | 786 } |
| 787 } | 787 } |
| 788 } | 788 } |
| 789 | 789 |
| 790 } // namespace shell | 790 } // namespace shell |
| 791 } // namespace mojo | 791 } // namespace mojo |
| OLD | NEW |