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

Side by Side Diff: cloud_print/service/win/chrome_launcher.cc

Issue 21030009: Make element removal methods in DictionaryValue and ListValue take scoped_ptr's as outparams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 7 years, 4 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
« no previous file with comments | « chromeos/network/onc/onc_validator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cloud_print/service/win/chrome_launcher.h" 5 #include "cloud_print/service/win/chrome_launcher.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 133
134 std::string refresh_token; 134 std::string refresh_token;
135 if (!dictionary->GetString(prefs::kCloudPrintRobotRefreshToken, 135 if (!dictionary->GetString(prefs::kCloudPrintRobotRefreshToken,
136 &refresh_token) || 136 &refresh_token) ||
137 refresh_token.empty()) { 137 refresh_token.empty()) {
138 return std::string(); 138 return std::string();
139 } 139 }
140 140
141 // Remove everything except kCloudPrintRoot. 141 // Remove everything except kCloudPrintRoot.
142 base::Value* cloud_print_root = NULL; 142 scoped_ptr<base::Value> cloud_print_root;
143 dictionary->Remove(prefs::kCloudPrintRoot, &cloud_print_root); 143 dictionary->Remove(prefs::kCloudPrintRoot, &cloud_print_root);
144 dictionary->Clear(); 144 dictionary->Clear();
145 dictionary->Set(prefs::kCloudPrintRoot, cloud_print_root); 145 dictionary->Set(prefs::kCloudPrintRoot, cloud_print_root.release());
146 146
147 dictionary->SetBoolean(prefs::kCloudPrintXmppPingEnabled, true); 147 dictionary->SetBoolean(prefs::kCloudPrintXmppPingEnabled, true);
148 if (!proxy_id.empty()) // Reuse proxy id if we already had one. 148 if (!proxy_id.empty()) // Reuse proxy id if we already had one.
149 dictionary->SetString(prefs::kCloudPrintProxyId, proxy_id); 149 dictionary->SetString(prefs::kCloudPrintProxyId, proxy_id);
150 std::string result; 150 std::string result;
151 base::JSONWriter::WriteWithOptions(dictionary, 151 base::JSONWriter::WriteWithOptions(dictionary,
152 base::JSONWriter::OPTIONS_PRETTY_PRINT, 152 base::JSONWriter::OPTIONS_PRETTY_PRINT,
153 &result); 153 &result);
154 return result; 154 return result;
155 } 155 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 } 337 }
338 } else { 338 } else {
339 LOG(ERROR) << "Chrome launch failed."; 339 LOG(ERROR) << "Chrome launch failed.";
340 return result; 340 return result;
341 } 341 }
342 } 342 }
343 NOTREACHED(); 343 NOTREACHED();
344 return std::string(); 344 return std::string();
345 } 345 }
346 346
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_validator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698