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

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

Issue 196793010: Move IsStringASCII/UTF8 to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
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.h" 5 #include "chrome/browser/extensions/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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 295 }
296 return true; 296 return true;
297 } 297 }
298 298
299 // Converts the |name|, |value| pair of a http header to a HttpHeaders 299 // Converts the |name|, |value| pair of a http header to a HttpHeaders
300 // dictionary. Ownership is passed to the caller. 300 // dictionary. Ownership is passed to the caller.
301 base::DictionaryValue* ToHeaderDictionary(const std::string& name, 301 base::DictionaryValue* ToHeaderDictionary(const std::string& name,
302 const std::string& value) { 302 const std::string& value) {
303 base::DictionaryValue* header = new base::DictionaryValue(); 303 base::DictionaryValue* header = new base::DictionaryValue();
304 header->SetString(keys::kHeaderNameKey, name); 304 header->SetString(keys::kHeaderNameKey, name);
305 if (IsStringUTF8(value)) { 305 if (base::IsStringUTF8(value)) {
306 header->SetString(keys::kHeaderValueKey, value); 306 header->SetString(keys::kHeaderValueKey, value);
307 } else { 307 } else {
308 header->Set(keys::kHeaderBinaryValueKey, 308 header->Set(keys::kHeaderBinaryValueKey,
309 helpers::StringToCharList(value)); 309 helpers::StringToCharList(value));
310 } 310 }
311 return header; 311 return header;
312 } 312 }
313 313
314 // Creates a list of HttpHeaders (see the extension API JSON). If |headers| is 314 // Creates a list of HttpHeaders (see the extension API JSON). If |headers| is
315 // NULL, the list is empty. Ownership is passed to the caller. 315 // NULL, the list is empty. Ownership is passed to the caller.
(...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2438 } else if ((*it)->name().find("AdBlock") != std::string::npos) { 2438 } else if ((*it)->name().find("AdBlock") != std::string::npos) {
2439 adblock = true; 2439 adblock = true;
2440 } else { 2440 } else {
2441 other = true; 2441 other = true;
2442 } 2442 }
2443 } 2443 }
2444 } 2444 }
2445 2445
2446 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); 2446 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other));
2447 } 2447 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/serial/serial_connection.cc ('k') | chrome/browser/extensions/convert_user_script.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698