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

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

Issue 1458323002: Simplify It2Me host shutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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"
(...skipping 15 matching lines...) Expand all
26 namespace remoting { 26 namespace remoting {
27 27
28 namespace { 28 namespace {
29 29
30 const remoting::protocol::NameMapElement<It2MeHostState> kIt2MeHostStates[] = { 30 const remoting::protocol::NameMapElement<It2MeHostState> kIt2MeHostStates[] = {
31 {kDisconnected, "DISCONNECTED"}, 31 {kDisconnected, "DISCONNECTED"},
32 {kStarting, "STARTING"}, 32 {kStarting, "STARTING"},
33 {kRequestedAccessCode, "REQUESTED_ACCESS_CODE"}, 33 {kRequestedAccessCode, "REQUESTED_ACCESS_CODE"},
34 {kReceivedAccessCode, "RECEIVED_ACCESS_CODE"}, 34 {kReceivedAccessCode, "RECEIVED_ACCESS_CODE"},
35 {kConnected, "CONNECTED"}, 35 {kConnected, "CONNECTED"},
36 {kDisconnecting, "DISCONNECTING"},
37 {kError, "ERROR"}, 36 {kError, "ERROR"},
38 {kInvalidDomainError, "INVALID_DOMAIN_ERROR"}, 37 {kInvalidDomainError, "INVALID_DOMAIN_ERROR"},
39 }; 38 };
40 39
41 } // namespace 40 } // namespace
42 41
43 It2MeNativeMessagingHost::It2MeNativeMessagingHost( 42 It2MeNativeMessagingHost::It2MeNativeMessagingHost(
44 scoped_ptr<ChromotingHostContext> context, 43 scoped_ptr<ChromotingHostContext> context,
45 scoped_ptr<It2MeHostFactory> factory) 44 scoped_ptr<It2MeHostFactory> factory)
46 : client_(nullptr), 45 : client_(nullptr),
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 void It2MeNativeMessagingHost::OnStateChanged( 247 void It2MeNativeMessagingHost::OnStateChanged(
249 It2MeHostState state, 248 It2MeHostState state,
250 const std::string& error_message) { 249 const std::string& error_message) {
251 DCHECK(task_runner()->BelongsToCurrentThread()); 250 DCHECK(task_runner()->BelongsToCurrentThread());
252 251
253 state_ = state; 252 state_ = state;
254 253
255 scoped_ptr<base::DictionaryValue> message(new base::DictionaryValue()); 254 scoped_ptr<base::DictionaryValue> message(new base::DictionaryValue());
256 255
257 message->SetString("type", "hostStateChanged"); 256 message->SetString("type", "hostStateChanged");
258 message->SetString("state", 257 message->SetString("state", HostStateToString(state));
259 It2MeNativeMessagingHost::HostStateToString(state));
260 258
261 switch (state_) { 259 switch (state_) {
262 case kReceivedAccessCode: 260 case kReceivedAccessCode:
263 message->SetString("accessCode", access_code_); 261 message->SetString("accessCode", access_code_);
264 message->SetInteger("accessCodeLifetime", 262 message->SetInteger("accessCodeLifetime",
265 access_code_lifetime_.InSeconds()); 263 access_code_lifetime_.InSeconds());
266 break; 264 break;
267 265
268 case kConnected: 266 case kConnected:
269 message->SetString("client", client_username_); 267 message->SetString("client", client_username_);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 return host_context_->ui_task_runner(); 319 return host_context_->ui_task_runner();
322 } 320 }
323 321
324 /* static */ 322 /* static */
325 std::string It2MeNativeMessagingHost::HostStateToString( 323 std::string It2MeNativeMessagingHost::HostStateToString(
326 It2MeHostState host_state) { 324 It2MeHostState host_state) {
327 return ValueToName(kIt2MeHostStates, host_state); 325 return ValueToName(kIt2MeHostStates, host_state);
328 } 326 }
329 327
330 } // namespace remoting 328 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/it2me/it2me_host.cc ('k') | remoting/host/it2me/it2me_native_messaging_host_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698