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

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

Issue 10834004: Correct const accessors in base/values.(h|cc) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reverting webdriver:Command::parameters_ to const 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
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 ListValue* StringToCharList(const std::string& s) { 110 ListValue* StringToCharList(const std::string& s) {
111 ListValue* result = new ListValue; 111 ListValue* result = new ListValue;
112 for (size_t i = 0, n = s.size(); i < n; ++i) { 112 for (size_t i = 0, n = s.size(); i < n; ++i) {
113 result->Append( 113 result->Append(
114 Value::CreateIntegerValue( 114 Value::CreateIntegerValue(
115 *reinterpret_cast<const unsigned char*>(&s[i]))); 115 *reinterpret_cast<const unsigned char*>(&s[i])));
116 } 116 }
117 return result; 117 return result;
118 } 118 }
119 119
120 bool CharListToString(ListValue* list, std::string* out) { 120 bool CharListToString(const ListValue* list, std::string* out) {
121 if (!list) 121 if (!list)
122 return false; 122 return false;
123 const size_t list_length = list->GetSize(); 123 const size_t list_length = list->GetSize();
124 out->resize(list_length); 124 out->resize(list_length);
125 int value = 0; 125 int value = 0;
126 for (size_t i = 0; i < list_length; ++i) { 126 for (size_t i = 0; i < list_length; ++i) {
127 if (!list->GetInteger(i, &value) || value < 0 || value > 255) 127 if (!list->GetInteger(i, &value) || value < 0 || value > 255)
128 return false; 128 return false;
129 unsigned char tmp = static_cast<unsigned char>(value); 129 unsigned char tmp = static_cast<unsigned char>(value);
130 (*out)[i] = *reinterpret_cast<char*>(&tmp); 130 (*out)[i] = *reinterpret_cast<char*>(&tmp);
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 625
626 bool CanExtensionAccessURL(const extensions::Extension* extension, 626 bool CanExtensionAccessURL(const extensions::Extension* extension,
627 const GURL& url) { 627 const GURL& url) {
628 // 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.
629 return (url.SchemeIs(chrome::kAboutScheme) || 629 return (url.SchemeIs(chrome::kAboutScheme) ||
630 extension->HasHostPermission(url) || 630 extension->HasHostPermission(url) ||
631 url.GetOrigin() == extension->url()); 631 url.GetOrigin() == extension->url());
632 } 632 }
633 633
634 } // namespace extension_web_request_api_helpers 634 } // namespace extension_web_request_api_helpers
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/web_request/web_request_api_helpers.h ('k') | chrome/browser/extensions/event_listener_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698