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

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

Issue 1272833002: Pass error messages from native messaging to web-app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests. Created 5 years, 4 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 #ifndef REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_ 5 #ifndef REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_
6 #define REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_ 6 #define REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "extensions/browser/api/messaging/native_message_host.h" 11 #include "extensions/browser/api/messaging/native_message_host.h"
12 #include "remoting/base/auto_thread_task_runner.h" 12 #include "remoting/base/auto_thread_task_runner.h"
13 #include "remoting/host/chromoting_host_context.h" 13 #include "remoting/host/chromoting_host_context.h"
14 #include "remoting/host/it2me/it2me_host.h" 14 #include "remoting/host/it2me/it2me_host.h"
15 15
16 #if !defined(OS_CHROMEOS)
17 #include "remoting/host/native_messaging/log_message_handler.h"
18 #endif
19
16 namespace base { 20 namespace base {
17 class DictionaryValue; 21 class DictionaryValue;
18 class Value; 22 class Value;
19 } // namespace base 23 } // namespace base
20 24
21 namespace remoting { 25 namespace remoting {
22 26
23 // Implementation of the native messaging host process. 27 // Implementation of the native messaging host process.
24 class It2MeNativeMessagingHost : public It2MeHost::Observer, 28 class It2MeNativeMessagingHost : public It2MeHost::Observer,
25 public extensions::NativeMessageHost { 29 public extensions::NativeMessageHost {
(...skipping 25 matching lines...) Expand all
51 // dictionary is pre-filled by ProcessMessage() with the parts of the 55 // dictionary is pre-filled by ProcessMessage() with the parts of the
52 // response already known ("id" and "type" fields). 56 // response already known ("id" and "type" fields).
53 void ProcessHello(const base::DictionaryValue& message, 57 void ProcessHello(const base::DictionaryValue& message,
54 scoped_ptr<base::DictionaryValue> response) const; 58 scoped_ptr<base::DictionaryValue> response) const;
55 void ProcessConnect(const base::DictionaryValue& message, 59 void ProcessConnect(const base::DictionaryValue& message,
56 scoped_ptr<base::DictionaryValue> response); 60 scoped_ptr<base::DictionaryValue> response);
57 void ProcessDisconnect(const base::DictionaryValue& message, 61 void ProcessDisconnect(const base::DictionaryValue& message,
58 scoped_ptr<base::DictionaryValue> response); 62 scoped_ptr<base::DictionaryValue> response);
59 void SendErrorAndExit(scoped_ptr<base::DictionaryValue> response, 63 void SendErrorAndExit(scoped_ptr<base::DictionaryValue> response,
60 const std::string& description) const; 64 const std::string& description) const;
61 void SendMessageToClient(scoped_ptr<base::DictionaryValue> message) const; 65 void SendMessageToClient(scoped_ptr<base::Value> message) const;
62 66
63 Client* client_; 67 Client* client_;
64 scoped_ptr<ChromotingHostContext> host_context_; 68 scoped_ptr<ChromotingHostContext> host_context_;
65 scoped_ptr<It2MeHostFactory> factory_; 69 scoped_ptr<It2MeHostFactory> factory_;
66 scoped_refptr<It2MeHost> it2me_host_; 70 scoped_refptr<It2MeHost> it2me_host_;
67 71
72 #if !defined(OS_CHROMEOS)
73 // Don't install a log message handler on ChromeOS because we run in the
74 // browser process and don't want to intercept all its log messages.
75 scoped_ptr<LogMessageHandler> log_message_handler_;
76 #endif
77
68 // Cached, read-only copies of |it2me_host_| session state. 78 // Cached, read-only copies of |it2me_host_| session state.
69 It2MeHostState state_; 79 It2MeHostState state_;
70 std::string access_code_; 80 std::string access_code_;
71 base::TimeDelta access_code_lifetime_; 81 base::TimeDelta access_code_lifetime_;
72 std::string client_username_; 82 std::string client_username_;
73 83
74 // IT2Me Talk server configuration used by |it2me_host_| to connect. 84 // IT2Me Talk server configuration used by |it2me_host_| to connect.
75 XmppSignalStrategy::XmppServerConfig xmpp_server_config_; 85 XmppSignalStrategy::XmppServerConfig xmpp_server_config_;
76 86
77 // Chromoting Bot JID used by |it2me_host_| to register the host. 87 // Chromoting Bot JID used by |it2me_host_| to register the host.
78 std::string directory_bot_jid_; 88 std::string directory_bot_jid_;
79 89
80 base::WeakPtr<It2MeNativeMessagingHost> weak_ptr_; 90 base::WeakPtr<It2MeNativeMessagingHost> weak_ptr_;
81 base::WeakPtrFactory<It2MeNativeMessagingHost> weak_factory_; 91 base::WeakPtrFactory<It2MeNativeMessagingHost> weak_factory_;
82 92
83 DISALLOW_COPY_AND_ASSIGN(It2MeNativeMessagingHost); 93 DISALLOW_COPY_AND_ASSIGN(It2MeNativeMessagingHost);
84 }; 94 };
85 95
86 } // namespace remoting 96 } // namespace remoting
87 97
88 #endif // REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_ 98 #endif // REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698