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

Side by Side Diff: remoting/host/setup/me2me_native_messaging_host.cc

Issue 1945443002: Convert callers of base::DeepCopy() to base::CreateDeepCopy() in //remoting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 3 more Created 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "remoting/host/setup/me2me_native_messaging_host.h" 5 #include "remoting/host/setup/me2me_native_messaging_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 "getRefreshTokenFromAuthCode", 56 "getRefreshTokenFromAuthCode",
57 }; 57 };
58 58
59 // Helper to extract the "config" part of a message as a DictionaryValue. 59 // Helper to extract the "config" part of a message as a DictionaryValue.
60 // Returns nullptr on failure, and logs an error message. 60 // Returns nullptr on failure, and logs an error message.
61 std::unique_ptr<base::DictionaryValue> ConfigDictionaryFromMessage( 61 std::unique_ptr<base::DictionaryValue> ConfigDictionaryFromMessage(
62 std::unique_ptr<base::DictionaryValue> message) { 62 std::unique_ptr<base::DictionaryValue> message) {
63 std::unique_ptr<base::DictionaryValue> result; 63 std::unique_ptr<base::DictionaryValue> result;
64 const base::DictionaryValue* config_dict; 64 const base::DictionaryValue* config_dict;
65 if (message->GetDictionary("config", &config_dict)) { 65 if (message->GetDictionary("config", &config_dict)) {
66 result.reset(config_dict->DeepCopy()); 66 result = config_dict->CreateDeepCopy();
67 } else { 67 } else {
68 LOG(ERROR) << "'config' dictionary not found"; 68 LOG(ERROR) << "'config' dictionary not found";
69 } 69 }
70 return result; 70 return result;
71 } 71 }
72 72
73 } // namespace 73 } // namespace
74 74
75 namespace remoting { 75 namespace remoting {
76 76
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 120 }
121 121
122 std::unique_ptr<base::DictionaryValue> message_dict( 122 std::unique_ptr<base::DictionaryValue> message_dict(
123 static_cast<base::DictionaryValue*>(message.release())); 123 static_cast<base::DictionaryValue*>(message.release()));
124 std::unique_ptr<base::DictionaryValue> response(new base::DictionaryValue()); 124 std::unique_ptr<base::DictionaryValue> response(new base::DictionaryValue());
125 125
126 // If the client supplies an ID, it will expect it in the response. This 126 // If the client supplies an ID, it will expect it in the response. This
127 // might be a string or a number, so cope with both. 127 // might be a string or a number, so cope with both.
128 const base::Value* id; 128 const base::Value* id;
129 if (message_dict->Get("id", &id)) 129 if (message_dict->Get("id", &id))
130 response->Set("id", id->DeepCopy()); 130 response->Set("id", id->CreateDeepCopy());
131 131
132 std::string type; 132 std::string type;
133 if (!message_dict->GetString("type", &type)) { 133 if (!message_dict->GetString("type", &type)) {
134 LOG(ERROR) << "'type' not found"; 134 LOG(ERROR) << "'type' not found";
135 channel_->SendMessage(nullptr); 135 channel_->SendMessage(nullptr);
136 return; 136 return;
137 } 137 }
138 138
139 response->SetString("type", type + "Response"); 139 response->SetString("type", type + "Response");
140 140
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 744
745 bool Me2MeNativeMessagingHost::DelegateToElevatedHost( 745 bool Me2MeNativeMessagingHost::DelegateToElevatedHost(
746 std::unique_ptr<base::DictionaryValue> message) { 746 std::unique_ptr<base::DictionaryValue> message) {
747 NOTREACHED(); 747 NOTREACHED();
748 return false; 748 return false;
749 } 749 }
750 750
751 #endif // !defined(OS_WIN) 751 #endif // !defined(OS_WIN)
752 752
753 } // namespace remoting 753 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/policy_watcher.cc ('k') | remoting/host/setup/me2me_native_messaging_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698