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

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

Issue 2384063008: Enables delegating signal strategy for It2Me Host. (Closed)
Patch Set: Created 4 years, 2 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 <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 10 matching lines...) Expand all
21 21
22 namespace base { 22 namespace base {
23 class DictionaryValue; 23 class DictionaryValue;
24 class Value; 24 class Value;
25 class SingleThreadTaskRunner; 25 class SingleThreadTaskRunner;
26 } // namespace base 26 } // namespace base
27 27
28 namespace remoting { 28 namespace remoting {
29 29
30 class ChromotingHostContext; 30 class ChromotingHostContext;
31 class DelegatingSignalStrategy;
31 class ElevatedNativeMessagingHost; 32 class ElevatedNativeMessagingHost;
32 class PolicyWatcher; 33 class PolicyWatcher;
33 34
34 // Implementation of the native messaging host process. 35 // Implementation of the native messaging host process.
35 class It2MeNativeMessagingHost : public It2MeHost::Observer, 36 class It2MeNativeMessagingHost : public It2MeHost::Observer,
36 public extensions::NativeMessageHost { 37 public extensions::NativeMessageHost {
37 public: 38 public:
38 It2MeNativeMessagingHost(bool needs_elevation, 39 It2MeNativeMessagingHost(bool needs_elevation,
39 policy::PolicyService* policy_service, 40 policy::PolicyService* policy_service,
40 std::unique_ptr<ChromotingHostContext> host_context, 41 std::unique_ptr<ChromotingHostContext> host_context,
(...skipping 19 matching lines...) Expand all
60 private: 61 private:
61 // These "Process.." methods handle specific request types. The |response| 62 // These "Process.." methods handle specific request types. The |response|
62 // dictionary is pre-filled by ProcessMessage() with the parts of the 63 // dictionary is pre-filled by ProcessMessage() with the parts of the
63 // response already known ("id" and "type" fields). 64 // response already known ("id" and "type" fields).
64 void ProcessHello(std::unique_ptr<base::DictionaryValue> message, 65 void ProcessHello(std::unique_ptr<base::DictionaryValue> message,
65 std::unique_ptr<base::DictionaryValue> response) const; 66 std::unique_ptr<base::DictionaryValue> response) const;
66 void ProcessConnect(std::unique_ptr<base::DictionaryValue> message, 67 void ProcessConnect(std::unique_ptr<base::DictionaryValue> message,
67 std::unique_ptr<base::DictionaryValue> response); 68 std::unique_ptr<base::DictionaryValue> response);
68 void ProcessDisconnect(std::unique_ptr<base::DictionaryValue> message, 69 void ProcessDisconnect(std::unique_ptr<base::DictionaryValue> message,
69 std::unique_ptr<base::DictionaryValue> response); 70 std::unique_ptr<base::DictionaryValue> response);
71 void ProcessIncomingIq(std::unique_ptr<base::DictionaryValue> message,
72 std::unique_ptr<base::DictionaryValue> response);
70 void SendErrorAndExit(std::unique_ptr<base::DictionaryValue> response, 73 void SendErrorAndExit(std::unique_ptr<base::DictionaryValue> response,
71 const std::string& description) const; 74 const std::string& description) const;
72 void SendMessageToClient(std::unique_ptr<base::Value> message) const; 75 void SendMessageToClient(std::unique_ptr<base::Value> message) const;
73 76
77 // Callback for DelegatingSignalStrategy.
78 void SendOutgoingIq(const std::string& iq);
79
74 // Called when initial policies are read. 80 // Called when initial policies are read.
75 void OnPolicyUpdate(std::unique_ptr<base::DictionaryValue> policies); 81 void OnPolicyUpdate(std::unique_ptr<base::DictionaryValue> policies);
76 82
77 // Returns whether the request was successfully sent to the elevated host. 83 // Returns whether the request was successfully sent to the elevated host.
78 bool DelegateToElevatedHost(std::unique_ptr<base::DictionaryValue> message); 84 bool DelegateToElevatedHost(std::unique_ptr<base::DictionaryValue> message);
79 85
80 // Used to determine whether to create and pass messages to an elevated host. 86 // Used to determine whether to create and pass messages to an elevated host.
81 bool needs_elevation_ = false; 87 bool needs_elevation_ = false;
82 88
83 #if defined(OS_WIN) 89 #if defined(OS_WIN)
84 // Controls the lifetime of the elevated native messaging host process. 90 // Controls the lifetime of the elevated native messaging host process.
85 // Note: 'elevated' in this instance means having the UiAccess privilege, not 91 // Note: 'elevated' in this instance means having the UiAccess privilege, not
86 // being run as a higher privilege user. 92 // being run as a higher privilege user.
87 std::unique_ptr<ElevatedNativeMessagingHost> elevated_host_; 93 std::unique_ptr<ElevatedNativeMessagingHost> elevated_host_;
88 #endif // defined(OS_WIN) 94 #endif // defined(OS_WIN)
89 95
90 Client* client_ = nullptr; 96 Client* client_ = nullptr;
97 DelegatingSignalStrategy* delegating_signal_strategy_;
Sergey Ulanov 2016/10/05 21:49:07 = nullptr;
kelvinp 2016/10/06 00:43:05 Done.
91 std::unique_ptr<ChromotingHostContext> host_context_; 98 std::unique_ptr<ChromotingHostContext> host_context_;
92 std::unique_ptr<It2MeHostFactory> factory_; 99 std::unique_ptr<It2MeHostFactory> factory_;
93 scoped_refptr<It2MeHost> it2me_host_; 100 scoped_refptr<It2MeHost> it2me_host_;
94 101
95 #if !defined(OS_CHROMEOS) 102 #if !defined(OS_CHROMEOS)
96 // Don't install a log message handler on ChromeOS because we run in the 103 // Don't install a log message handler on ChromeOS because we run in the
97 // browser process and don't want to intercept all its log messages. 104 // browser process and don't want to intercept all its log messages.
98 std::unique_ptr<LogMessageHandler> log_message_handler_; 105 std::unique_ptr<LogMessageHandler> log_message_handler_;
99 #endif 106 #endif
100 107
(...skipping 27 matching lines...) Expand all
128 135
129 base::WeakPtr<It2MeNativeMessagingHost> weak_ptr_; 136 base::WeakPtr<It2MeNativeMessagingHost> weak_ptr_;
130 base::WeakPtrFactory<It2MeNativeMessagingHost> weak_factory_; 137 base::WeakPtrFactory<It2MeNativeMessagingHost> weak_factory_;
131 138
132 DISALLOW_COPY_AND_ASSIGN(It2MeNativeMessagingHost); 139 DISALLOW_COPY_AND_ASSIGN(It2MeNativeMessagingHost);
133 }; 140 };
134 141
135 } // namespace remoting 142 } // namespace remoting
136 143
137 #endif // REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_ 144 #endif // REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698