OLD | NEW |
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 "extensions/browser/api/messaging/native_messaging_channel.h" | 13 #include "extensions/browser/api/messaging/native_messaging_channel.h" |
14 #include "remoting/host/setup/daemon_controller.h" | 14 #include "remoting/host/setup/daemon_controller.h" |
15 #include "remoting/host/setup/oauth_client.h" | 15 #include "remoting/host/setup/oauth_client.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class DictionaryValue; | 18 class DictionaryValue; |
19 class ListValue; | 19 class ListValue; |
20 } // namespace base | 20 } // namespace base |
21 | 21 |
22 namespace gaia { | 22 namespace gaia { |
23 class GaiaOAuthClient; | 23 class GaiaOAuthClient; |
24 } // namespace gaia | 24 } // namespace gaia |
25 | 25 |
| 26 namespace tracked_objects { |
| 27 class Location; |
| 28 } // namespace tracked_objects |
| 29 |
26 namespace remoting { | 30 namespace remoting { |
27 | 31 |
28 const char kElevatingSwitchName[] = "elevate"; | 32 const char kElevatingSwitchName[] = "elevate"; |
29 const char kInputSwitchName[] = "input"; | 33 const char kInputSwitchName[] = "input"; |
30 const char kOutputSwitchName[] = "output"; | 34 const char kOutputSwitchName[] = "output"; |
31 | 35 |
32 namespace protocol { | 36 namespace protocol { |
33 class PairingRegistry; | 37 class PairingRegistry; |
34 } // namespace protocol | 38 } // namespace protocol |
35 | 39 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // or on the calling thread if called by the PairingRegistry. | 111 // or on the calling thread if called by the PairingRegistry. |
108 // These methods fill in the |response| dictionary from the other parameters, | 112 // These methods fill in the |response| dictionary from the other parameters, |
109 // and pass it to SendResponse(). | 113 // and pass it to SendResponse(). |
110 void SendConfigResponse(scoped_ptr<base::DictionaryValue> response, | 114 void SendConfigResponse(scoped_ptr<base::DictionaryValue> response, |
111 scoped_ptr<base::DictionaryValue> config); | 115 scoped_ptr<base::DictionaryValue> config); |
112 void SendPairedClientsResponse(scoped_ptr<base::DictionaryValue> response, | 116 void SendPairedClientsResponse(scoped_ptr<base::DictionaryValue> response, |
113 scoped_ptr<base::ListValue> pairings); | 117 scoped_ptr<base::ListValue> pairings); |
114 void SendUsageStatsConsentResponse( | 118 void SendUsageStatsConsentResponse( |
115 scoped_ptr<base::DictionaryValue> response, | 119 scoped_ptr<base::DictionaryValue> response, |
116 const DaemonController::UsageStatsConsent& consent); | 120 const DaemonController::UsageStatsConsent& consent); |
117 void SendAsyncResult(scoped_ptr<base::DictionaryValue> response, | 121 void SendAsyncSuccess(scoped_ptr<base::DictionaryValue> response); |
118 DaemonController::AsyncResult result); | 122 void SendAsyncFailure(scoped_ptr<base::DictionaryValue> response, |
| 123 const std::string& error_message, |
| 124 const tracked_objects::Location& location); |
119 void SendBooleanResult(scoped_ptr<base::DictionaryValue> response, | 125 void SendBooleanResult(scoped_ptr<base::DictionaryValue> response, |
120 bool result); | 126 bool result); |
121 void SendCredentialsResponse(scoped_ptr<base::DictionaryValue> response, | 127 void SendCredentialsResponse(scoped_ptr<base::DictionaryValue> response, |
122 const std::string& user_email, | 128 const std::string& user_email, |
123 const std::string& refresh_token); | 129 const std::string& refresh_token); |
124 | 130 |
125 void OnError(); | |
126 | |
127 void Stop(); | 131 void Stop(); |
128 | 132 |
129 // Returns true if the request was successfully delegated to the elevated | 133 // Returns true if the request was successfully delegated to the elevated |
130 // host and false otherwise. | 134 // host and false otherwise. |
131 bool DelegateToElevatedHost(scoped_ptr<base::DictionaryValue> message); | 135 bool DelegateToElevatedHost(scoped_ptr<base::DictionaryValue> message); |
132 | 136 |
133 #if defined(OS_WIN) | 137 #if defined(OS_WIN) |
134 class ElevatedChannelEventHandler | 138 class ElevatedChannelEventHandler |
135 : public extensions::NativeMessagingChannel::EventHandler { | 139 : public extensions::NativeMessagingChannel::EventHandler { |
136 public: | 140 public: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 189 |
186 base::WeakPtr<Me2MeNativeMessagingHost> weak_ptr_; | 190 base::WeakPtr<Me2MeNativeMessagingHost> weak_ptr_; |
187 base::WeakPtrFactory<Me2MeNativeMessagingHost> weak_factory_; | 191 base::WeakPtrFactory<Me2MeNativeMessagingHost> weak_factory_; |
188 | 192 |
189 DISALLOW_COPY_AND_ASSIGN(Me2MeNativeMessagingHost); | 193 DISALLOW_COPY_AND_ASSIGN(Me2MeNativeMessagingHost); |
190 }; | 194 }; |
191 | 195 |
192 } // namespace remoting | 196 } // namespace remoting |
193 | 197 |
194 #endif // REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_ | 198 #endif // REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_ |
OLD | NEW |