Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/api/messaging/message_service.h" | 5 #include "chrome/browser/extensions/api/messaging/message_service.h" |
| 6 | 6 |
| 7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 396 if (policy_permission == DISALLOW) { | 396 if (policy_permission == DISALLOW) { |
| 397 DispatchOnDisconnect(source, receiver_port_id, kProhibitedByPoliciesError); | 397 DispatchOnDisconnect(source, receiver_port_id, kProhibitedByPoliciesError); |
| 398 return; | 398 return; |
| 399 } | 399 } |
| 400 | 400 |
| 401 scoped_ptr<MessageChannel> channel(new MessageChannel()); | 401 scoped_ptr<MessageChannel> channel(new MessageChannel()); |
| 402 channel->opener.reset(new ExtensionMessagePort(source, MSG_ROUTING_CONTROL, | 402 channel->opener.reset(new ExtensionMessagePort(source, MSG_ROUTING_CONTROL, |
| 403 source_extension_id)); | 403 source_extension_id)); |
| 404 | 404 |
| 405 // Get handle of the native view and pass it to the native messaging host. | 405 // Get handle of the native view and pass it to the native messaging host. |
| 406 content::RenderWidgetHost* render_widget_host = | |
| 407 content::RenderWidgetHost::FromID(source_process_id, source_routing_id); | |
| 406 gfx::NativeView native_view = | 408 gfx::NativeView native_view = |
| 407 content::RenderWidgetHost::FromID(source_process_id, source_routing_id)-> | 409 render_widget_host ? render_widget_host->GetView()->GetNativeView() |
| 408 GetView()->GetNativeView(); | 410 : NULL; |
|
not at google - send to devlin
2014/12/11 17:24:42
Are we supposed to use nullptr these days? I'm los
Sergey Ulanov
2014/12/11 19:25:29
Yes, it should be nullptr. This is my first change
not at google - send to devlin
2014/12/11 20:19:46
Where is native_view used then?
| |
| 409 | 411 |
| 410 std::string error = kReceivingEndDoesntExistError; | 412 std::string error = kReceivingEndDoesntExistError; |
| 411 scoped_ptr<NativeMessageHost> native_host = NativeMessageHost::Create( | 413 scoped_ptr<NativeMessageHost> native_host = NativeMessageHost::Create( |
| 412 native_view, | 414 native_view, |
| 413 source_extension_id, | 415 source_extension_id, |
| 414 native_app_name, | 416 native_app_name, |
| 415 policy_permission == ALLOW_ALL, | 417 policy_permission == ALLOW_ALL, |
| 416 &error); | 418 &error); |
| 417 | 419 |
| 418 // Abandon the channel. | 420 // Abandon the channel. |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 866 int channel_id) { | 868 int channel_id) { |
| 867 MessageChannelMap::iterator channel_iter = channels_.find(channel_id); | 869 MessageChannelMap::iterator channel_iter = channels_.find(channel_id); |
| 868 if (channel_iter != channels_.end()) { | 870 if (channel_iter != channels_.end()) { |
| 869 for (const PendingMessage& message : queue) { | 871 for (const PendingMessage& message : queue) { |
| 870 DispatchMessage(message.first, channel_iter->second, message.second); | 872 DispatchMessage(message.first, channel_iter->second, message.second); |
| 871 } | 873 } |
| 872 } | 874 } |
| 873 } | 875 } |
| 874 | 876 |
| 875 } // namespace extensions | 877 } // namespace extensions |
| OLD | NEW |