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

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

Issue 11037005: New Cloud Print Private API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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) 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 "chrome/service/cloud_print/cloud_print_proxy.h" 5 #include "chrome/service/cloud_print/cloud_print_proxy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 } 116 }
117 if (client_) { 117 if (client_) {
118 client_->OnCloudPrintProxyEnabled(true); 118 client_->OnCloudPrintProxyEnabled(true);
119 } 119 }
120 } 120 }
121 121
122 void CloudPrintProxy::EnableForUserWithRobot( 122 void CloudPrintProxy::EnableForUserWithRobot(
123 const std::string& robot_auth_code, 123 const std::string& robot_auth_code,
124 const std::string& robot_email, 124 const std::string& robot_email,
125 const std::string& user_email) { 125 const std::string& user_email,
126 bool connect_new_printers,
127 const std::vector<std::string>& printer_blacklist) {
126 DCHECK(CalledOnValidThread()); 128 DCHECK(CalledOnValidThread());
129
130 ShutdownBackend();
131 service_prefs_->SetBoolean(prefs::kCloudPrintConnectNewPrinters,
132 connect_new_printers);
133 service_prefs_->RemovePref(prefs::kCloudPrintPrinterBlacklist);
134 if (!printer_blacklist.empty()) {
135 scoped_ptr<base::ListValue> printers(new base::ListValue());
136 printers->AppendStrings(printer_blacklist);
137 service_prefs_->SetValue(prefs::kCloudPrintConnectNewPrinters,
138 printers.release());
139 }
140 service_prefs_->WritePrefs();
141
127 if (!CreateBackend()) 142 if (!CreateBackend())
128 return; 143 return;
129 DCHECK(backend_.get()); 144 DCHECK(backend_.get());
130 user_email_ = user_email; 145 user_email_ = user_email;
131 backend_->InitializeWithRobotAuthCode(robot_auth_code, robot_email); 146 backend_->InitializeWithRobotAuthCode(robot_auth_code, robot_email);
132 if (client_) { 147 if (client_) {
133 client_->OnCloudPrintProxyEnabled(true); 148 client_->OnCloudPrintProxyEnabled(true);
134 } 149 }
135 } 150 }
136 151
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // Finish disabling cloud print for this user. 269 // Finish disabling cloud print for this user.
255 DisableForUser(); 270 DisableForUser();
256 } 271 }
257 272
258 void CloudPrintProxy::ShutdownBackend() { 273 void CloudPrintProxy::ShutdownBackend() {
259 DCHECK(CalledOnValidThread()); 274 DCHECK(CalledOnValidThread());
260 if (backend_.get()) 275 if (backend_.get())
261 backend_->Shutdown(); 276 backend_->Shutdown();
262 backend_.reset(); 277 backend_.reset();
263 } 278 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698