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

Side by Side Diff: remoting/client/plugin/chromoting_instance.cc

Issue 810133003: replace NULL->nullptr in src/remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 (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)
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // to the UI. This prevents a potential infinite loop if we encounter an error 161 // to the UI. This prevents a potential infinite loop if we encounter an error
162 // while sending the log message to the UI. 162 // while sending the log message to the UI.
163 bool g_logging_to_plugin = false; 163 bool g_logging_to_plugin = false;
164 bool g_has_logging_instance = false; 164 bool g_has_logging_instance = false;
165 base::LazyInstance<scoped_refptr<base::SingleThreadTaskRunner> >::Leaky 165 base::LazyInstance<scoped_refptr<base::SingleThreadTaskRunner> >::Leaky
166 g_logging_task_runner = LAZY_INSTANCE_INITIALIZER; 166 g_logging_task_runner = LAZY_INSTANCE_INITIALIZER;
167 base::LazyInstance<base::WeakPtr<ChromotingInstance> >::Leaky 167 base::LazyInstance<base::WeakPtr<ChromotingInstance> >::Leaky
168 g_logging_instance = LAZY_INSTANCE_INITIALIZER; 168 g_logging_instance = LAZY_INSTANCE_INITIALIZER;
169 base::LazyInstance<base::Lock>::Leaky 169 base::LazyInstance<base::Lock>::Leaky
170 g_logging_lock = LAZY_INSTANCE_INITIALIZER; 170 g_logging_lock = LAZY_INSTANCE_INITIALIZER;
171 logging::LogMessageHandlerFunction g_logging_old_handler = NULL; 171 logging::LogMessageHandlerFunction g_logging_old_handler = nullptr;
172 172
173 } // namespace 173 } // namespace
174 174
175 // String sent in the "hello" message to the webapp to describe features. 175 // String sent in the "hello" message to the webapp to describe features.
176 const char ChromotingInstance::kApiFeatures[] = 176 const char ChromotingInstance::kApiFeatures[] =
177 "highQualityScaling injectKeyEvent sendClipboardItem remapKey trapKey " 177 "highQualityScaling injectKeyEvent sendClipboardItem remapKey trapKey "
178 "notifyClientResolution pauseVideo pauseAudio asyncPin thirdPartyAuth " 178 "notifyClientResolution pauseVideo pauseAudio asyncPin thirdPartyAuth "
179 "pinlessAuth extensionMessage allowMouseLock videoControl"; 179 "pinlessAuth extensionMessage allowMouseLock videoControl";
180 180
181 const char ChromotingInstance::kRequestedCapabilities[] = ""; 181 const char ChromotingInstance::kRequestedCapabilities[] = "";
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 void ChromotingInstance::HandleMessage(const pp::Var& message) { 293 void ChromotingInstance::HandleMessage(const pp::Var& message) {
294 if (!message.is_string()) { 294 if (!message.is_string()) {
295 LOG(ERROR) << "Received a message that is not a string."; 295 LOG(ERROR) << "Received a message that is not a string.";
296 return; 296 return;
297 } 297 }
298 298
299 scoped_ptr<base::Value> json( 299 scoped_ptr<base::Value> json(
300 base::JSONReader::Read(message.AsString(), 300 base::JSONReader::Read(message.AsString(),
301 base::JSON_ALLOW_TRAILING_COMMAS)); 301 base::JSON_ALLOW_TRAILING_COMMAS));
302 base::DictionaryValue* message_dict = NULL; 302 base::DictionaryValue* message_dict = nullptr;
303 std::string method; 303 std::string method;
304 base::DictionaryValue* data = NULL; 304 base::DictionaryValue* data = nullptr;
305 if (!json.get() || 305 if (!json.get() ||
306 !json->GetAsDictionary(&message_dict) || 306 !json->GetAsDictionary(&message_dict) ||
307 !message_dict->GetString("method", &method) || 307 !message_dict->GetString("method", &method) ||
308 !message_dict->GetDictionary("data", &data)) { 308 !message_dict->GetDictionary("data", &data)) {
309 LOG(ERROR) << "Received invalid message:" << message.AsString(); 309 LOG(ERROR) << "Received invalid message:" << message.AsString();
310 return; 310 return;
311 } 311 }
312 312
313 if (method == "connect") { 313 if (method == "connect") {
314 HandleConnect(*data); 314 HandleConnect(*data);
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 void ChromotingInstance::HandleDelegateLargeCursors() { 940 void ChromotingInstance::HandleDelegateLargeCursors() {
941 cursor_setter_.set_delegate_stub(this); 941 cursor_setter_.set_delegate_stub(this);
942 } 942 }
943 943
944 void ChromotingInstance::Disconnect() { 944 void ChromotingInstance::Disconnect() {
945 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); 945 DCHECK(plugin_task_runner_->BelongsToCurrentThread());
946 946
947 VLOG(0) << "Disconnecting from host."; 947 VLOG(0) << "Disconnecting from host.";
948 948
949 // Disconnect the input pipeline and teardown the connection. 949 // Disconnect the input pipeline and teardown the connection.
950 mouse_input_filter_.set_input_stub(NULL); 950 mouse_input_filter_.set_input_stub(nullptr);
951 client_.reset(); 951 client_.reset();
952 video_renderer_.reset(); 952 video_renderer_.reset();
953 } 953 }
954 954
955 void ChromotingInstance::PostChromotingMessage(const std::string& method, 955 void ChromotingInstance::PostChromotingMessage(const std::string& method,
956 const pp::VarDictionary& data) { 956 const pp::VarDictionary& data) {
957 pp::VarDictionary message; 957 pp::VarDictionary message;
958 message.Set(pp::Var("method"), pp::Var(method)); 958 message.Set(pp::Var("method"), pp::Var(method));
959 message.Set(pp::Var("data"), data); 959 message.Set(pp::Var("data"), data);
960 PostMessage(message); 960 PostMessage(message);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 void ChromotingInstance::UnregisterLoggingInstance() { 1036 void ChromotingInstance::UnregisterLoggingInstance() {
1037 base::AutoLock lock(g_logging_lock.Get()); 1037 base::AutoLock lock(g_logging_lock.Get());
1038 1038
1039 // Don't unregister unless we're the currently registered instance. 1039 // Don't unregister unless we're the currently registered instance.
1040 if (this != g_logging_instance.Get().get()) 1040 if (this != g_logging_instance.Get().get())
1041 return; 1041 return;
1042 1042
1043 // Unregister this instance for logging. 1043 // Unregister this instance for logging.
1044 g_has_logging_instance = false; 1044 g_has_logging_instance = false;
1045 g_logging_instance.Get().reset(); 1045 g_logging_instance.Get().reset();
1046 g_logging_task_runner.Get() = NULL; 1046 g_logging_task_runner.Get() = nullptr;
1047 1047
1048 VLOG(1) << "Unregistering global log handler"; 1048 VLOG(1) << "Unregistering global log handler";
1049 } 1049 }
1050 1050
1051 // static 1051 // static
1052 bool ChromotingInstance::LogToUI(int severity, const char* file, int line, 1052 bool ChromotingInstance::LogToUI(int severity, const char* file, int line,
1053 size_t message_start, 1053 size_t message_start,
1054 const std::string& str) { 1054 const std::string& str) {
1055 // Note that we're reading |g_has_logging_instance| outside of a lock. 1055 // Note that we're reading |g_has_logging_instance| outside of a lock.
1056 // This lockless read is done so that we don't needlessly slow down global 1056 // This lockless read is done so that we don't needlessly slow down global
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 url_components.scheme.len); 1124 url_components.scheme.len);
1125 return url_scheme == kChromeExtensionUrlScheme; 1125 return url_scheme == kChromeExtensionUrlScheme;
1126 } 1126 }
1127 1127
1128 bool ChromotingInstance::IsConnected() { 1128 bool ChromotingInstance::IsConnected() {
1129 return client_ && 1129 return client_ &&
1130 (client_->connection_state() == protocol::ConnectionToHost::CONNECTED); 1130 (client_->connection_state() == protocol::ConnectionToHost::CONNECTED);
1131 } 1131 }
1132 1132
1133 } // namespace remoting 1133 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/jni/jni_frame_consumer.cc ('k') | remoting/client/plugin/delegating_signal_strategy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698