OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/client/plugin/chromoting_instance.h" | 5 #include "remoting/client/plugin/chromoting_instance.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #if defined(OS_NACL) | 10 #if defined(OS_NACL) |
11 #include <nacl_io/nacl_io.h> | 11 #include <nacl_io/nacl_io.h> |
12 #include <sys/mount.h> | 12 #include <sys/mount.h> |
13 #endif | 13 #endif |
14 | 14 |
15 #include "base/bind.h" | 15 #include "base/bind.h" |
16 #include "base/callback.h" | 16 #include "base/callback.h" |
| 17 #include "base/callback_helpers.h" |
17 #include "base/json/json_reader.h" | 18 #include "base/json/json_reader.h" |
18 #include "base/json/json_writer.h" | 19 #include "base/json/json_writer.h" |
19 #include "base/lazy_instance.h" | 20 #include "base/lazy_instance.h" |
20 #include "base/logging.h" | 21 #include "base/logging.h" |
21 #include "base/strings/string_split.h" | 22 #include "base/strings/string_split.h" |
22 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
23 #include "base/synchronization/lock.h" | 24 #include "base/synchronization/lock.h" |
24 #include "base/threading/thread.h" | 25 #include "base/threading/thread.h" |
25 #include "base/values.h" | 26 #include "base/values.h" |
26 #include "crypto/random.h" | 27 #include "crypto/random.h" |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 audio_control.set_enable(!pause); | 899 audio_control.set_enable(!pause); |
899 client_->host_stub()->ControlAudio(audio_control); | 900 client_->host_stub()->ControlAudio(audio_control); |
900 } | 901 } |
901 void ChromotingInstance::HandleOnPinFetched(const base::DictionaryValue& data) { | 902 void ChromotingInstance::HandleOnPinFetched(const base::DictionaryValue& data) { |
902 std::string pin; | 903 std::string pin; |
903 if (!data.GetString("pin", &pin)) { | 904 if (!data.GetString("pin", &pin)) { |
904 LOG(ERROR) << "Invalid onPinFetched."; | 905 LOG(ERROR) << "Invalid onPinFetched."; |
905 return; | 906 return; |
906 } | 907 } |
907 if (!secret_fetched_callback_.is_null()) { | 908 if (!secret_fetched_callback_.is_null()) { |
908 secret_fetched_callback_.Run(pin); | 909 base::ResetAndReturn(&secret_fetched_callback_).Run(pin); |
909 secret_fetched_callback_.Reset(); | |
910 } else { | 910 } else { |
911 LOG(WARNING) << "Ignored OnPinFetched received without a pending fetch."; | 911 LOG(WARNING) << "Ignored OnPinFetched received without a pending fetch."; |
912 } | 912 } |
913 } | 913 } |
914 | 914 |
915 void ChromotingInstance::HandleOnThirdPartyTokenFetched( | 915 void ChromotingInstance::HandleOnThirdPartyTokenFetched( |
916 const base::DictionaryValue& data) { | 916 const base::DictionaryValue& data) { |
917 std::string token; | 917 std::string token; |
918 std::string shared_secret; | 918 std::string shared_secret; |
919 if (!data.GetString("token", &token) || | 919 if (!data.GetString("token", &token) || |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 | 1190 |
1191 #if !defined(OS_NACL) | 1191 #if !defined(OS_NACL) |
1192 // Log messages are forwarded to the webapp only in PNaCl version of the | 1192 // Log messages are forwarded to the webapp only in PNaCl version of the |
1193 // plugin, so ProcessLogToUI() needs to be called explicitly in the non-PNaCl | 1193 // plugin, so ProcessLogToUI() needs to be called explicitly in the non-PNaCl |
1194 // version. | 1194 // version. |
1195 ProcessLogToUI(message); | 1195 ProcessLogToUI(message); |
1196 #endif // !defined(OS_NACL) | 1196 #endif // !defined(OS_NACL) |
1197 } | 1197 } |
1198 | 1198 |
1199 } // namespace remoting | 1199 } // namespace remoting |
OLD | NEW |