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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api_helpers.cc

Issue 10809011: Fix removal of headers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/web_request/web_request_api_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/web_request/web_request_api_helpers.h" 5 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 break; 469 break;
470 } 470 }
471 } 471 }
472 472
473 // Now execute the modifications if there were no conflicts. 473 // Now execute the modifications if there were no conflicts.
474 if (!extension_conflicts) { 474 if (!extension_conflicts) {
475 // Delete headers 475 // Delete headers
476 { 476 {
477 for (i = (*delta)->deleted_response_headers.begin(); 477 for (i = (*delta)->deleted_response_headers.begin();
478 i != (*delta)->deleted_response_headers.end(); ++i) { 478 i != (*delta)->deleted_response_headers.end(); ++i) {
479 (*override_response_headers)->RemoveHeaderWithValue(i->first, 479 (*override_response_headers)->RemoveHeaderLine(i->first, i->second);
480 i->second);
481 removed_headers.insert(ToLowerCase(*i)); 480 removed_headers.insert(ToLowerCase(*i));
482 } 481 }
483 } 482 }
484 483
485 // Add headers. 484 // Add headers.
486 { 485 {
487 for (i = (*delta)->added_response_headers.begin(); 486 for (i = (*delta)->added_response_headers.begin();
488 i != (*delta)->added_response_headers.end(); ++i) { 487 i != (*delta)->added_response_headers.end(); ++i) {
489 ResponseHeader lowercase_header(ToLowerCase(*i)); 488 ResponseHeader lowercase_header(ToLowerCase(*i));
490 if (added_headers.find(lowercase_header) != added_headers.end()) 489 if (added_headers.find(lowercase_header) != added_headers.end())
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 625
627 bool CanExtensionAccessURL(const extensions::Extension* extension, 626 bool CanExtensionAccessURL(const extensions::Extension* extension,
628 const GURL& url) { 627 const GURL& url) {
629 // about: URLs are not covered in host permissions, but are allowed anyway. 628 // about: URLs are not covered in host permissions, but are allowed anyway.
630 return (url.SchemeIs(chrome::kAboutScheme) || 629 return (url.SchemeIs(chrome::kAboutScheme) ||
631 extension->HasHostPermission(url) || 630 extension->HasHostPermission(url) ||
632 url.GetOrigin() == extension->url()); 631 url.GetOrigin() == extension->url());
633 } 632 }
634 633
635 } // namespace extension_web_request_api_helpers 634 } // namespace extension_web_request_api_helpers
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/web_request/web_request_api_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698