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

Side by Side Diff: remoting/host/setup/me2me_native_messaging_host.h

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 #ifndef REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_ 5 #ifndef REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_
6 #define REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_ 6 #define REMOTING_HOST_SETUP_ME2ME_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 "base/threading/thread_checker.h" 11 #include "base/threading/thread_checker.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "remoting/host/native_messaging/native_messaging_channel.h" 13 #include "chrome/browser/extensions/api/messaging/native_messaging_channel.h"
14
14 #include "remoting/host/setup/daemon_controller.h" 15 #include "remoting/host/setup/daemon_controller.h"
15 #include "remoting/host/setup/oauth_client.h" 16 #include "remoting/host/setup/oauth_client.h"
16 17
17 namespace base { 18 namespace base {
18 class DictionaryValue; 19 class DictionaryValue;
19 class ListValue; 20 class ListValue;
20 } // namespace base 21 } // namespace base
21 22
22 namespace gaia { 23 namespace gaia {
23 class GaiaOAuthClient; 24 class GaiaOAuthClient;
24 } // namespace gaia 25 } // namespace gaia
25 26
26 namespace remoting { 27 namespace remoting {
27 28
28 const char kElevatingSwitchName[] = "elevate"; 29 const char kElevatingSwitchName[] = "elevate";
29 const char kInputSwitchName[] = "input"; 30 const char kInputSwitchName[] = "input";
30 const char kOutputSwitchName[] = "output"; 31 const char kOutputSwitchName[] = "output";
31 32
32 namespace protocol { 33 namespace protocol {
33 class PairingRegistry; 34 class PairingRegistry;
34 } // namespace protocol 35 } // namespace protocol
35 36
36 // Implementation of the me2me native messaging host. 37 // Implementation of the me2me native messaging host.
37 class Me2MeNativeMessagingHost { 38 class Me2MeNativeMessagingHost {
38 public: 39 public:
39 typedef NativeMessagingChannel::SendMessageCallback SendMessageCallback; 40 typedef extensions::NativeMessagingChannel::SendMessageCallback
41 SendMessageCallback;
40 42
41 Me2MeNativeMessagingHost( 43 Me2MeNativeMessagingHost(
42 bool needs_elevation, 44 bool needs_elevation,
43 intptr_t parent_window_handle, 45 intptr_t parent_window_handle,
44 scoped_ptr<NativeMessagingChannel> channel, 46 scoped_ptr<extensions::NativeMessagingChannel> channel,
45 scoped_refptr<DaemonController> daemon_controller, 47 scoped_refptr<DaemonController> daemon_controller,
46 scoped_refptr<protocol::PairingRegistry> pairing_registry, 48 scoped_refptr<protocol::PairingRegistry> pairing_registry,
47 scoped_ptr<OAuthClient> oauth_client); 49 scoped_ptr<OAuthClient> oauth_client);
48 virtual ~Me2MeNativeMessagingHost(); 50 virtual ~Me2MeNativeMessagingHost();
49 51
50 void Start(const base::Closure& quit_closure); 52 void Start(const base::Closure& quit_closure);
51 53
52 private: 54 private:
53 // Callback to process messages from the native messaging client through 55 // Callback to process messages from the native messaging client through
54 // |channel_|. 56 // |channel_|.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 void Me2MeNativeMessagingHost::EnsureElevatedHostCreated(); 139 void Me2MeNativeMessagingHost::EnsureElevatedHostCreated();
138 140
139 // Callback to process messages from the elevated host through 141 // Callback to process messages from the elevated host through
140 // |elevated_channel_|. 142 // |elevated_channel_|.
141 void ProcessDelegateResponse(scoped_ptr<base::DictionaryValue> message); 143 void ProcessDelegateResponse(scoped_ptr<base::DictionaryValue> message);
142 144
143 // Disconnect and shut down the elevated host. 145 // Disconnect and shut down the elevated host.
144 void DisconnectElevatedHost(); 146 void DisconnectElevatedHost();
145 147
146 // Native messaging channel used to communicate with the elevated host. 148 // Native messaging channel used to communicate with the elevated host.
147 scoped_ptr<NativeMessagingChannel> elevated_channel_; 149 scoped_ptr<extensions::NativeMessagingChannel> elevated_channel_;
148 150
149 // Timer to control the lifetime of the elevated host. 151 // Timer to control the lifetime of the elevated host.
150 base::OneShotTimer<Me2MeNativeMessagingHost> elevated_host_timer_; 152 base::OneShotTimer<Me2MeNativeMessagingHost> elevated_host_timer_;
151 #endif // defined(OS_WIN) 153 #endif // defined(OS_WIN)
152 154
153 bool needs_elevation_; 155 bool needs_elevation_;
154 156
155 // Handle of the parent window. 157 // Handle of the parent window.
156 intptr_t parent_window_handle_; 158 intptr_t parent_window_handle_;
157 159
158 base::Closure quit_closure_; 160 base::Closure quit_closure_;
159 161
160 // Native messaging channel used to communicate with the native message 162 // Native messaging channel used to communicate with the native message
161 // client. 163 // client.
162 scoped_ptr<NativeMessagingChannel> channel_; 164 scoped_ptr<extensions::NativeMessagingChannel> channel_;
163 scoped_refptr<DaemonController> daemon_controller_; 165 scoped_refptr<DaemonController> daemon_controller_;
164 166
165 // Used to load and update the paired clients for this host. 167 // Used to load and update the paired clients for this host.
166 scoped_refptr<protocol::PairingRegistry> pairing_registry_; 168 scoped_refptr<protocol::PairingRegistry> pairing_registry_;
167 169
168 // Used to exchange the service account authorization code for credentials. 170 // Used to exchange the service account authorization code for credentials.
169 scoped_ptr<OAuthClient> oauth_client_; 171 scoped_ptr<OAuthClient> oauth_client_;
170 172
171 base::ThreadChecker thread_checker_; 173 base::ThreadChecker thread_checker_;
172 174
173 base::WeakPtr<Me2MeNativeMessagingHost> weak_ptr_; 175 base::WeakPtr<Me2MeNativeMessagingHost> weak_ptr_;
174 base::WeakPtrFactory<Me2MeNativeMessagingHost> weak_factory_; 176 base::WeakPtrFactory<Me2MeNativeMessagingHost> weak_factory_;
175 177
176 DISALLOW_COPY_AND_ASSIGN(Me2MeNativeMessagingHost); 178 DISALLOW_COPY_AND_ASSIGN(Me2MeNativeMessagingHost);
177 }; 179 };
178 180
179 } // namespace remoting 181 } // namespace remoting
180 182
181 #endif // REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_ 183 #endif // REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698