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

Side by Side Diff: components/proximity_auth/client.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/proximity_auth/client.h" 5 #include "components/proximity_auth/client.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/values.h" 9 #include "base/values.h"
10 #include "components/proximity_auth/client_observer.h" 10 #include "components/proximity_auth/client_observer.h"
(...skipping 19 matching lines...) Expand all
30 const char kMessageTypeDecryptResponse[] = "decrypt_response"; 30 const char kMessageTypeDecryptResponse[] = "decrypt_response";
31 const char kMessageTypeUnlockRequest[] = "unlock_request"; 31 const char kMessageTypeUnlockRequest[] = "unlock_request";
32 const char kMessageTypeUnlockResponse[] = "unlock_response"; 32 const char kMessageTypeUnlockResponse[] = "unlock_response";
33 33
34 // The name for an unlock event originating from the local device. 34 // The name for an unlock event originating from the local device.
35 const char kUnlockEventName[] = "easy_unlock"; 35 const char kUnlockEventName[] = "easy_unlock";
36 36
37 // Serializes the |value| to a JSON string and returns the result. 37 // Serializes the |value| to a JSON string and returns the result.
38 std::string SerializeValueToJson(const base::Value& value) { 38 std::string SerializeValueToJson(const base::Value& value) {
39 std::string json; 39 std::string json;
40 base::JSONWriter::Write(&value, &json); 40 base::JSONWriter::Write(value, &json);
41 return json; 41 return json;
42 } 42 }
43 43
44 // Returns the message type represented by the |message|. This is a convenience 44 // Returns the message type represented by the |message|. This is a convenience
45 // wrapper that should only be called when the |message| is known to specify its 45 // wrapper that should only be called when the |message| is known to specify its
46 // message type, i.e. this should not be called for untrusted input. 46 // message type, i.e. this should not be called for untrusted input.
47 std::string GetMessageType(const base::DictionaryValue& message) { 47 std::string GetMessageType(const base::DictionaryValue& message) {
48 std::string type; 48 std::string type;
49 message.GetString(kTypeKey, &type); 49 message.GetString(kTypeKey, &type);
50 return type; 50 return type;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } else { 280 } else {
281 VLOG(1) << "[Client] Message of unknown type '" << pending_message_->type 281 VLOG(1) << "[Client] Message of unknown type '" << pending_message_->type
282 << "sent."; 282 << "sent.";
283 } 283 }
284 284
285 pending_message_.reset(); 285 pending_message_.reset();
286 ProcessMessageQueue(); 286 ProcessMessageQueue();
287 } 287 }
288 288
289 } // namespace proximity_auth 289 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/printing/renderer/print_web_view_helper.cc ('k') | components/search_engines/keyword_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698