| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 #include "net/http/http_response_headers.h" | 22 #include "net/http/http_response_headers.h" |
| 23 | 23 |
| 24 namespace extensions { | 24 namespace extensions { |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 void CreateResponseHeadersDictionary(const net::HttpResponseHeaders* headers, | 27 void CreateResponseHeadersDictionary(const net::HttpResponseHeaders* headers, |
| 28 base::DictionaryValue* result) { | 28 base::DictionaryValue* result) { |
| 29 if (!headers) | 29 if (!headers) |
| 30 return; | 30 return; |
| 31 | 31 |
| 32 void* iter = NULL; | 32 size_t iter = 0; |
| 33 std::string header_name; | 33 std::string header_name; |
| 34 std::string header_value; | 34 std::string header_value; |
| 35 while (headers->EnumerateHeaderLines(&iter, &header_name, &header_value)) { | 35 while (headers->EnumerateHeaderLines(iter, &header_name, &header_value)) { |
| 36 base::Value* existing_value = NULL; | 36 base::Value* existing_value = NULL; |
| 37 if (result->Get(header_name, &existing_value)) { | 37 if (result->Get(header_name, &existing_value)) { |
| 38 base::StringValue* existing_string_value = | 38 base::StringValue* existing_string_value = |
| 39 static_cast<base::StringValue*>(existing_value); | 39 static_cast<base::StringValue*>(existing_value); |
| 40 existing_string_value->GetString()->append(", ").append(header_value); | 40 existing_string_value->GetString()->append(", ").append(header_value); |
| 41 } else { | 41 } else { |
| 42 result->SetString(header_name, header_value); | 42 result->SetString(header_name, header_value); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 } | 45 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> > | 172 static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> > |
| 173 g_factory = LAZY_INSTANCE_INITIALIZER; | 173 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 174 | 174 |
| 175 // static | 175 // static |
| 176 BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* | 176 BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* |
| 177 StreamsPrivateAPI::GetFactoryInstance() { | 177 StreamsPrivateAPI::GetFactoryInstance() { |
| 178 return g_factory.Pointer(); | 178 return g_factory.Pointer(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace extensions | 181 } // namespace extensions |
| OLD | NEW |