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

Side by Side Diff: chrome/browser/extensions/api/cookies/cookies_helpers.cc

Issue 270183002: Move IsStringUTF8/ASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more minor nit Created 6 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 | 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 // Implements common functionality for the Chrome Extensions Cookies API. 5 // Implements common functionality for the Chrome Extensions Cookies API.
6 6
7 #include "chrome/browser/extensions/api/cookies/cookies_helpers.h" 7 #include "chrome/browser/extensions/api/cookies/cookies_helpers.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // A cookie is a raw byte sequence. By explicitly parsing it as UTF-8, we 70 // A cookie is a raw byte sequence. By explicitly parsing it as UTF-8, we
71 // apply error correction, so the string can be safely passed to the renderer. 71 // apply error correction, so the string can be safely passed to the renderer.
72 cookie->name = base::UTF16ToUTF8(base::UTF8ToUTF16(canonical_cookie.Name())); 72 cookie->name = base::UTF16ToUTF8(base::UTF8ToUTF16(canonical_cookie.Name()));
73 cookie->value = 73 cookie->value =
74 base::UTF16ToUTF8(base::UTF8ToUTF16(canonical_cookie.Value())); 74 base::UTF16ToUTF8(base::UTF8ToUTF16(canonical_cookie.Value()));
75 cookie->domain = canonical_cookie.Domain(); 75 cookie->domain = canonical_cookie.Domain();
76 cookie->host_only = net::cookie_util::DomainIsHostOnly( 76 cookie->host_only = net::cookie_util::DomainIsHostOnly(
77 canonical_cookie.Domain()); 77 canonical_cookie.Domain());
78 // A non-UTF8 path is invalid, so we just replace it with an empty string. 78 // A non-UTF8 path is invalid, so we just replace it with an empty string.
79 cookie->path = IsStringUTF8(canonical_cookie.Path()) ? canonical_cookie.Path() 79 cookie->path = base::IsStringUTF8(canonical_cookie.Path()) ?
80 : std::string(); 80 canonical_cookie.Path() : std::string();
81 cookie->secure = canonical_cookie.IsSecure(); 81 cookie->secure = canonical_cookie.IsSecure();
82 cookie->http_only = canonical_cookie.IsHttpOnly(); 82 cookie->http_only = canonical_cookie.IsHttpOnly();
83 cookie->session = !canonical_cookie.IsPersistent(); 83 cookie->session = !canonical_cookie.IsPersistent();
84 if (canonical_cookie.IsPersistent()) { 84 if (canonical_cookie.IsPersistent()) {
85 cookie->expiration_date.reset( 85 cookie->expiration_date.reset(
86 new double(canonical_cookie.ExpiryDate().ToDoubleT())); 86 new double(canonical_cookie.ExpiryDate().ToDoubleT()));
87 } 87 }
88 cookie->store_id = store_id; 88 cookie->store_id = store_id;
89 89
90 return cookie.Pass(); 90 return cookie.Pass();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 if (sub_domain == *details_->domain) 201 if (sub_domain == *details_->domain)
202 return true; 202 return true;
203 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot. 203 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot.
204 sub_domain.erase(0, next_dot); 204 sub_domain.erase(0, next_dot);
205 } 205 }
206 return false; 206 return false;
207 } 207 }
208 208
209 } // namespace cookies_helpers 209 } // namespace cookies_helpers
210 } // namespace extensions 210 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/download/download_extensions.cc ('k') | chrome/browser/extensions/api/proxy/proxy_api_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698