Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1032)

Side by Side Diff: remoting/host/it2me/it2me_native_messaging_host.cc

Issue 558403002: Remote Assistance on Chrome OS Part II - Native Messaging renaming (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "remoting/host/it2me/it2me_native_messaging_host.h" 5 #include "remoting/host/it2me/it2me_native_messaging_host.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/callback_helpers.h" 12 #include "base/callback_helpers.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/stringize_macros.h" 16 #include "base/strings/stringize_macros.h"
17 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "chrome/browser/extensions/api/messaging/native_messaging_channel.h"
19 #include "net/base/net_util.h" 20 #include "net/base/net_util.h"
20 #include "net/url_request/url_fetcher.h" 21 #include "net/url_request/url_fetcher.h"
21 #include "remoting/base/auth_token_util.h" 22 #include "remoting/base/auth_token_util.h"
22 #include "remoting/base/service_urls.h" 23 #include "remoting/base/service_urls.h"
23 #include "remoting/host/chromoting_host_context.h" 24 #include "remoting/host/chromoting_host_context.h"
24 #include "remoting/host/host_exit_codes.h" 25 #include "remoting/host/host_exit_codes.h"
25 #include "remoting/protocol/name_value_map.h" 26 #include "remoting/protocol/name_value_map.h"
26 27
27 namespace remoting { 28 namespace remoting {
28 29
29 namespace { 30 namespace {
30 31
31 const remoting::protocol::NameMapElement<It2MeHostState> kIt2MeHostStates[] = { 32 const remoting::protocol::NameMapElement<It2MeHostState> kIt2MeHostStates[] = {
32 {kDisconnected, "DISCONNECTED"}, 33 {kDisconnected, "DISCONNECTED"},
33 {kStarting, "STARTING"}, 34 {kStarting, "STARTING"},
34 {kRequestedAccessCode, "REQUESTED_ACCESS_CODE"}, 35 {kRequestedAccessCode, "REQUESTED_ACCESS_CODE"},
35 {kReceivedAccessCode, "RECEIVED_ACCESS_CODE"}, 36 {kReceivedAccessCode, "RECEIVED_ACCESS_CODE"},
36 {kConnected, "CONNECTED"}, 37 {kConnected, "CONNECTED"},
37 {kDisconnecting, "DISCONNECTING"}, 38 {kDisconnecting, "DISCONNECTING"},
38 {kError, "ERROR"}, 39 {kError, "ERROR"},
39 {kInvalidDomainError, "INVALID_DOMAIN_ERROR"}, }; 40 {kInvalidDomainError, "INVALID_DOMAIN_ERROR"}, };
40 41
41 } // namespace 42 } // namespace
42 43
43 It2MeNativeMessagingHost::It2MeNativeMessagingHost( 44 It2MeNativeMessagingHost::It2MeNativeMessagingHost(
44 scoped_refptr<AutoThreadTaskRunner> task_runner, 45 scoped_refptr<AutoThreadTaskRunner> task_runner,
45 scoped_ptr<NativeMessagingChannel> channel, 46 scoped_ptr<extensions::NativeMessagingChannel> channel,
46 scoped_ptr<It2MeHostFactory> factory) 47 scoped_ptr<It2MeHostFactory> factory)
47 : channel_(channel.Pass()), 48 : channel_(channel.Pass()),
48 factory_(factory.Pass()), 49 factory_(factory.Pass()),
49 weak_factory_(this) { 50 weak_factory_(this) {
50 weak_ptr_ = weak_factory_.GetWeakPtr(); 51 weak_ptr_ = weak_factory_.GetWeakPtr();
51 52
52 // Initialize the host context to manage the threads for the it2me host. 53 // Initialize the host context to manage the threads for the it2me host.
53 // The native messaging host, rather than the It2MeHost object, owns and 54 // The native messaging host, rather than the It2MeHost object, owns and
54 // maintains the lifetime of the host context. 55 // maintains the lifetime of the host context.
55 56
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 297 }
297 298
298 /* static */ 299 /* static */
299 std::string It2MeNativeMessagingHost::HostStateToString( 300 std::string It2MeNativeMessagingHost::HostStateToString(
300 It2MeHostState host_state) { 301 It2MeHostState host_state) {
301 return ValueToName(kIt2MeHostStates, host_state); 302 return ValueToName(kIt2MeHostStates, host_state);
302 } 303 }
303 304
304 } // namespace remoting 305 } // namespace remoting
305 306
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698