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

Side by Side Diff: extensions/browser/api/web_request/web_request_api.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 (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 "extensions/browser/api/web_request/web_request_api.h" 5 #include "extensions/browser/api/web_request/web_request_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 2356 matching lines...) Expand 10 before | Expand all | Expand 10 after
2367 } 2367 }
2368 2368
2369 for (size_t i = 0; i < headers_value->GetSize(); ++i) { 2369 for (size_t i = 0; i < headers_value->GetSize(); ++i) {
2370 base::DictionaryValue* header_value = NULL; 2370 base::DictionaryValue* header_value = NULL;
2371 std::string name; 2371 std::string name;
2372 std::string value; 2372 std::string value;
2373 EXTENSION_FUNCTION_VALIDATE( 2373 EXTENSION_FUNCTION_VALIDATE(
2374 headers_value->GetDictionary(i, &header_value)); 2374 headers_value->GetDictionary(i, &header_value));
2375 if (!FromHeaderDictionary(header_value, &name, &value)) { 2375 if (!FromHeaderDictionary(header_value, &name, &value)) {
2376 std::string serialized_header; 2376 std::string serialized_header;
2377 base::JSONWriter::Write(header_value, &serialized_header); 2377 base::JSONWriter::Write(*header_value, &serialized_header);
2378 RespondWithError(event_name, 2378 RespondWithError(event_name,
2379 sub_event_name, 2379 sub_event_name,
2380 request_id, 2380 request_id,
2381 response.Pass(), 2381 response.Pass(),
2382 ErrorUtils::FormatErrorMessage(keys::kInvalidHeader, 2382 ErrorUtils::FormatErrorMessage(keys::kInvalidHeader,
2383 serialized_header)); 2383 serialized_header));
2384 return false; 2384 return false;
2385 } 2385 }
2386 if (!net::HttpUtil::IsValidHeaderName(name)) { 2386 if (!net::HttpUtil::IsValidHeaderName(name)) {
2387 RespondWithError(event_name, 2387 RespondWithError(event_name,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2459 base::Bind(&WarningService::NotifyWarningsOnUI, profile_id(), warnings)); 2459 base::Bind(&WarningService::NotifyWarningsOnUI, profile_id(), warnings));
2460 2460
2461 // Continue gracefully. 2461 // Continue gracefully.
2462 RunSync(); 2462 RunSync();
2463 } 2463 }
2464 2464
2465 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { 2465 bool WebRequestHandlerBehaviorChangedFunction::RunSync() {
2466 helpers::ClearCacheOnNavigation(); 2466 helpers::ClearCacheOnNavigation();
2467 return true; 2467 return true;
2468 } 2468 }
OLDNEW
« no previous file with comments | « extensions/browser/api/storage/settings_storage_quota_enforcer.cc ('k') | extensions/browser/computed_hashes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698