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

Side by Side Diff: chrome/browser/extensions/api/streams_private/streams_private_api.cc

Issue 2516363005: Inline StringValue into base::Value (Closed)
Patch Set: Rebase and Nits. Created 3 years, 10 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 "chrome/browser/extensions/api/streams_private/streams_private_api.h" 5 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 19 matching lines...) Expand all
30 base::DictionaryValue* result) { 30 base::DictionaryValue* result) {
31 if (!headers) 31 if (!headers)
32 return; 32 return;
33 33
34 size_t iter = 0; 34 size_t iter = 0;
35 std::string header_name; 35 std::string header_name;
36 std::string header_value; 36 std::string header_value;
37 while (headers->EnumerateHeaderLines(&iter, &header_name, &header_value)) { 37 while (headers->EnumerateHeaderLines(&iter, &header_name, &header_value)) {
38 base::Value* existing_value = NULL; 38 base::Value* existing_value = NULL;
39 if (result->Get(header_name, &existing_value)) { 39 if (result->Get(header_name, &existing_value)) {
40 base::StringValue* existing_string_value = 40 *existing_value =
41 static_cast<base::StringValue*>(existing_value); 41 base::Value(existing_value->GetString() + ", " + header_value);
42 existing_string_value->GetString()->append(", ").append(header_value);
43 } else { 42 } else {
44 result->SetString(header_name, header_value); 43 result->SetString(header_name, header_value);
45 } 44 }
46 } 45 }
47 } 46 }
48 47
49 } // namespace 48 } // namespace
50 49
51 namespace streams_private = api::streams_private; 50 namespace streams_private = api::streams_private;
52 51
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> > 184 static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> >
186 g_factory = LAZY_INSTANCE_INITIALIZER; 185 g_factory = LAZY_INSTANCE_INITIALIZER;
187 186
188 // static 187 // static
189 BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* 188 BrowserContextKeyedAPIFactory<StreamsPrivateAPI>*
190 StreamsPrivateAPI::GetFactoryInstance() { 189 StreamsPrivateAPI::GetFactoryInstance() {
191 return g_factory.Pointer(); 190 return g_factory.Pointer();
192 } 191 }
193 192
194 } // namespace extensions 193 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/settings/system_settings_provider.h ('k') | chrome/browser/ui/webui/options/manage_profile_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698