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

Side by Side Diff: net/base/url_util.h

Issue 24261010: Allow explicitly whitelisted apps/extensions in public sessions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix handing of guest user ID. Created 7 years, 2 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 | « content/public/test/test_utils.cc ('k') | net/base/url_util.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef NET_BASE_URL_UTIL_H_ 5 #ifndef NET_BASE_URL_UTIL_H_
6 #define NET_BASE_URL_UTIL_H_ 6 #define NET_BASE_URL_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h"
10 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
12 #include "url/url_parse.h"
11 13
12 class GURL; 14 class GURL;
13 15
14 namespace net { 16 namespace net {
15 17
16 // Returns a new GURL by appending the given query parameter name and the 18 // Returns a new GURL by appending the given query parameter name and the
17 // value. Unsafe characters in the name and the value are escaped like 19 // value. Unsafe characters in the name and the value are escaped like
18 // %XX%XX. The original query component is preserved if it's present. 20 // %XX%XX. The original query component is preserved if it's present.
19 // 21 //
20 // Examples: 22 // Examples:
(...skipping 16 matching lines...) Expand all
37 // AppendOrReplaceQueryParameter( 39 // AppendOrReplaceQueryParameter(
38 // GURL("http://example.com"), "name", "new").spec() 40 // GURL("http://example.com"), "name", "new").spec()
39 // => "http://example.com?name=value" 41 // => "http://example.com?name=value"
40 // AppendOrReplaceQueryParameter( 42 // AppendOrReplaceQueryParameter(
41 // GURL("http://example.com?x=y&name=old"), "name", "new").spec() 43 // GURL("http://example.com?x=y&name=old"), "name", "new").spec()
42 // => "http://example.com?x=y&name=new" 44 // => "http://example.com?x=y&name=new"
43 NET_EXPORT GURL AppendOrReplaceQueryParameter(const GURL& url, 45 NET_EXPORT GURL AppendOrReplaceQueryParameter(const GURL& url,
44 const std::string& name, 46 const std::string& name,
45 const std::string& value); 47 const std::string& value);
46 48
49 // Iterates over the key-value pairs in the query portion of |url|.
50 class NET_EXPORT QueryIterator {
51 public:
52 explicit QueryIterator(const GURL& url);
53 ~QueryIterator();
54
55 std::string GetKey() const;
56 std::string GetValue() const;
57 const std::string& GetUnescapedValue();
58
59 bool IsAtEnd() const;
60 void Advance();
61
62 private:
63 const GURL& url_;
64 url_parse::Component query_;
65 bool at_end_;
66 url_parse::Component key_;
67 url_parse::Component value_;
68 std::string unescaped_value_;
69
70 DISALLOW_COPY_AND_ASSIGN(QueryIterator);
71 };
72
47 // Looks for |search_key| in the query portion of |url|. Returns true if the 73 // Looks for |search_key| in the query portion of |url|. Returns true if the
48 // key is found and sets |out_value| to the unescaped value for the key. 74 // key is found and sets |out_value| to the unescaped value for the key.
49 // Returns false if the key is not found. 75 // Returns false if the key is not found.
50 NET_EXPORT bool GetValueForKeyInQuery(const GURL& url, 76 NET_EXPORT bool GetValueForKeyInQuery(const GURL& url,
51 const std::string& search_key, 77 const std::string& search_key,
52 std::string* out_value); 78 std::string* out_value);
53 79
54 } // namespace net 80 } // namespace net
55 81
56 #endif // NET_BASE_URL_UTIL_H_ 82 #endif // NET_BASE_URL_UTIL_H_
OLDNEW
« no previous file with comments | « content/public/test/test_utils.cc ('k') | net/base/url_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698