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

Side by Side Diff: chrome/service/cloud_print/cloud_print_proxy.cc

Issue 8491048: Fixed crash in the proxy. Reference has been passed between threads, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/service/cloud_print/cloud_print_proxy.h" 5 #include "chrome/service/cloud_print/cloud_print_proxy.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 info->email.clear(); 181 info->email.clear();
182 if (enabled_) 182 if (enabled_)
183 info->email = user_email(); 183 info->email = user_email();
184 info->proxy_id = proxy_id_; 184 info->proxy_id = proxy_id_;
185 // If the Cloud Print service is not enabled, we may need to read the old 185 // If the Cloud Print service is not enabled, we may need to read the old
186 // value of proxy_id from prefs. 186 // value of proxy_id from prefs.
187 if (info->proxy_id.empty()) 187 if (info->proxy_id.empty())
188 service_prefs_->GetString(prefs::kCloudPrintProxyId, &info->proxy_id); 188 service_prefs_->GetString(prefs::kCloudPrintProxyId, &info->proxy_id);
189 } 189 }
190 190
191 // Notification methods from the backend. Called on UI thread.
192 void CloudPrintProxy::OnPrinterListAvailable(
193 const printing::PrinterList& printer_list) {
194 DCHECK(CalledOnValidThread());
195 // We could potentially show UI here allowing the user to select which
196 // printers to register. For now, we just register all.
197 backend_->RegisterPrinters(printer_list);
198 }
199
200 void CloudPrintProxy::OnAuthenticated( 191 void CloudPrintProxy::OnAuthenticated(
201 const std::string& robot_oauth_refresh_token, 192 const std::string& robot_oauth_refresh_token,
202 const std::string& robot_email, 193 const std::string& robot_email,
203 const std::string& user_email) { 194 const std::string& user_email) {
204 DCHECK(CalledOnValidThread()); 195 DCHECK(CalledOnValidThread());
205 service_prefs_->SetString(prefs::kCloudPrintRobotRefreshToken, 196 service_prefs_->SetString(prefs::kCloudPrintRobotRefreshToken,
206 robot_oauth_refresh_token); 197 robot_oauth_refresh_token);
207 service_prefs_->SetString(prefs::kCloudPrintRobotEmail, 198 service_prefs_->SetString(prefs::kCloudPrintRobotEmail,
208 robot_email); 199 robot_email);
209 // If authenticating from a robot, the user email will be empty. 200 // If authenticating from a robot, the user email will be empty.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 233 }
243 } 234 }
244 235
245 void CloudPrintProxy::Shutdown() { 236 void CloudPrintProxy::Shutdown() {
246 DCHECK(CalledOnValidThread()); 237 DCHECK(CalledOnValidThread());
247 if (backend_.get()) 238 if (backend_.get())
248 backend_->Shutdown(); 239 backend_->Shutdown();
249 backend_.reset(); 240 backend_.reset();
250 } 241 }
251 242
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/cloud_print_proxy.h ('k') | chrome/service/cloud_print/cloud_print_proxy_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698