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

Side by Side Diff: cloud_print/service/service_state.cc

Issue 10834004: Correct const accessors in base/values.(h|cc) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: One more, Windows-only Created 8 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
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/service_state.h" 5 #include "cloud_print/service/service_state.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 bool ServiceState::FromString(const std::string& json) { 96 bool ServiceState::FromString(const std::string& json) {
97 Reset(); 97 Reset();
98 scoped_ptr<base::Value> data(base::JSONReader::Read(json)); 98 scoped_ptr<base::Value> data(base::JSONReader::Read(json));
99 if (!data.get()) 99 if (!data.get())
100 return false; 100 return false;
101 101
102 const base::DictionaryValue* services = NULL; 102 const base::DictionaryValue* services = NULL;
103 if (!data->GetAsDictionary(&services)) 103 if (!data->GetAsDictionary(&services))
104 return false; 104 return false;
105 105
106 base::DictionaryValue* cloud_print = NULL; 106 const base::DictionaryValue* cloud_print = NULL;
107 if (!services->GetDictionary(kCloudPrintJsonName, &cloud_print)) 107 if (!services->GetDictionary(kCloudPrintJsonName, &cloud_print))
108 return false; 108 return false;
109 109
110 bool valid_file = true; 110 bool valid_file = true;
111 // Don't exit on fail. Collect all data for re-use by user later. 111 // Don't exit on fail. Collect all data for re-use by user later.
112 if (!cloud_print->GetBoolean(kEnabledOptionName, &valid_file)) 112 if (!cloud_print->GetBoolean(kEnabledOptionName, &valid_file))
113 valid_file = false; 113 valid_file = false;
114 114
115 cloud_print->GetString(kEmailOptionName, &email_); 115 cloud_print->GetString(kEmailOptionName, &email_);
116 cloud_print->GetString(kProxyIdOptionName, &proxy_id_); 116 cloud_print->GetString(kProxyIdOptionName, &proxy_id_);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 const std::string& password, 201 const std::string& password,
202 const std::string& proxy_id) { 202 const std::string& proxy_id) {
203 robot_token_.clear(); 203 robot_token_.clear();
204 robot_email_.clear(); 204 robot_email_.clear();
205 email_ = email; 205 email_ = email;
206 proxy_id_ = proxy_id; 206 proxy_id_ = proxy_id;
207 auth_token_ = LoginToGoogle("cloudprint", email_, password); 207 auth_token_ = LoginToGoogle("cloudprint", email_, password);
208 xmpp_auth_token_ = LoginToGoogle("chromiumsync", email_, password); 208 xmpp_auth_token_ = LoginToGoogle("chromiumsync", email_, password);
209 return IsValid(); 209 return IsValid();
210 } 210 }
211
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698