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

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

Issue 6621018: Convert Chromoting plugin logging to appear in client UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 &context_, 94 &context_,
95 host_connection_.get(), 95 host_connection_.get(),
96 view_proxy_, 96 view_proxy_,
97 rectangle_decoder_.get(), 97 rectangle_decoder_.get(),
98 input_handler_.get(), 98 input_handler_.get(),
99 NULL)); 99 NULL));
100 100
101 // Kick off the connection. 101 // Kick off the connection.
102 client_->Start(); 102 client_->Start();
103 103
104 LogDebugInfo("Connection status: Initializing");
104 GetScriptableObject()->SetConnectionInfo(STATUS_INITIALIZING, 105 GetScriptableObject()->SetConnectionInfo(STATUS_INITIALIZING,
105 QUALITY_UNKNOWN); 106 QUALITY_UNKNOWN);
106 } 107 }
107 108
108 void ChromotingInstance::Disconnect() { 109 void ChromotingInstance::Disconnect() {
109 DCHECK(CurrentlyOnPluginThread()); 110 DCHECK(CurrentlyOnPluginThread());
110 111
111 LogDebugInfo("Disconnecting from host"); 112 LogDebugInfo("Disconnecting from host");
112 if (client_.get()) { 113 if (client_.get()) {
113 client_->Stop(); 114 client_->Stop();
114 } 115 }
115 116
117 LogDebugInfo("Connection status: Closed");
116 GetScriptableObject()->SetConnectionInfo(STATUS_CLOSED, QUALITY_UNKNOWN); 118 GetScriptableObject()->SetConnectionInfo(STATUS_CLOSED, QUALITY_UNKNOWN);
117 } 119 }
118 120
119 void ChromotingInstance::ViewChanged(const pp::Rect& position, 121 void ChromotingInstance::ViewChanged(const pp::Rect& position,
120 const pp::Rect& clip) { 122 const pp::Rect& clip) {
121 DCHECK(CurrentlyOnPluginThread()); 123 DCHECK(CurrentlyOnPluginThread());
122 124
123 // TODO(ajwong): This is going to be a race condition when the view changes 125 // TODO(ajwong): This is going to be a race condition when the view changes
124 // and we're in the middle of a Paint(). 126 // and we're in the middle of a Paint().
125 VLOG(1) << "ViewChanged " << position.x() << "," << position.y() << "," 127 LogDebugInfo(StringPrintf("ViewChanged: %d,%d %dx%d", position.x(),
126 << position.width() << "," << position.height(); 128 position.y(), position.width(), position.height()));
127 129
128 view_->SetViewport(position.x(), position.y(), 130 view_->SetViewport(position.x(), position.y(),
129 position.width(), position.height()); 131 position.width(), position.height());
130 view_->Paint(); 132 view_->Paint();
131 } 133 }
132 134
133 bool ChromotingInstance::CurrentlyOnPluginThread() const { 135 bool ChromotingInstance::CurrentlyOnPluginThread() const {
134 return pepper_main_loop_dont_post_to_me_ == MessageLoop::current(); 136 return pepper_main_loop_dont_post_to_me_ == MessageLoop::current();
135 } 137 }
136 138
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 return false; 182 return false;
181 } 183 }
182 184
183 ChromotingScriptableObject* ChromotingInstance::GetScriptableObject() { 185 ChromotingScriptableObject* ChromotingInstance::GetScriptableObject() {
184 pp::Var object = GetInstanceObject(); 186 pp::Var object = GetInstanceObject();
185 if (!object.is_undefined()) { 187 if (!object.is_undefined()) {
186 pp::deprecated::ScriptableObject* so = object.AsScriptableObject(); 188 pp::deprecated::ScriptableObject* so = object.AsScriptableObject();
187 DCHECK(so != NULL); 189 DCHECK(so != NULL);
188 return static_cast<ChromotingScriptableObject*>(so); 190 return static_cast<ChromotingScriptableObject*>(so);
189 } 191 }
190 LOG(ERROR) << "Unable to get ScriptableObject for Chromoting plugin."; 192 LogDebugError("Unable to get ScriptableObject for Chromoting plugin.");
191 return NULL; 193 return NULL;
192 } 194 }
193 195
194 void ChromotingInstance::SubmitLoginInfo(const std::string& username, 196 void ChromotingInstance::SubmitLoginInfo(const std::string& username,
195 const std::string& password) { 197 const std::string& password) {
196 protocol::LocalLoginCredentials* credentials = 198 protocol::LocalLoginCredentials* credentials =
197 new protocol::LocalLoginCredentials(); 199 new protocol::LocalLoginCredentials();
198 credentials->set_type(protocol::PASSWORD); 200 credentials->set_type(protocol::PASSWORD);
199 credentials->set_username(username); 201 credentials->set_username(username);
200 credentials->set_credential(password.data(), password.length()); 202 credentials->set_credential(password.data(), password.length());
201 203
202 host_connection_->host_stub()->BeginSessionRequest( 204 host_connection_->host_stub()->BeginSessionRequest(
203 credentials, 205 credentials,
204 new DeleteTask<protocol::LocalLoginCredentials>(credentials)); 206 new DeleteTask<protocol::LocalLoginCredentials>(credentials));
205 } 207 }
206 208
207 void ChromotingInstance::LogDebugInfo(const std::string& info) { 209 void ChromotingInstance::LogDebugInfo(const std::string& info) {
210 LOG(INFO) << info;
208 GetScriptableObject()->LogDebugInfo(info); 211 GetScriptableObject()->LogDebugInfo(info);
209 } 212 }
210 213
214 void ChromotingInstance::LogDebugWarning(const std::string& info) {
215 LOG(WARNING) << info;
216 GetScriptableObject()->LogDebugInfo(
217 StringPrintf("WARNING : %s", info.c_str()));
218 }
219
220 void ChromotingInstance::LogDebugError(const std::string& info) {
221 LOG(ERROR) << info;
222 GetScriptableObject()->LogDebugInfo(StringPrintf("ERROR : %s", info.c_str()));
223 }
224
211 pp::Var ChromotingInstance::GetInstanceObject() { 225 pp::Var ChromotingInstance::GetInstanceObject() {
212 if (instance_object_.is_undefined()) { 226 if (instance_object_.is_undefined()) {
213 ChromotingScriptableObject* object = new ChromotingScriptableObject(this); 227 ChromotingScriptableObject* object = new ChromotingScriptableObject(this);
214 object->Init(); 228 object->Init();
215 229
216 // The pp::Var takes ownership of object here. 230 // The pp::Var takes ownership of object here.
217 instance_object_ = pp::Var(this, object); 231 instance_object_ = pp::Var(this, object);
218 } 232 }
219 233
220 return instance_object_; 234 return instance_object_;
221 } 235 }
222 236
223 } // namespace remoting 237 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698