OLD | NEW |
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 #ifndef NET_PROXY_PROXY_RESOLVER_SCRIPT_DATA_H_ | 5 #ifndef NET_PROXY_PROXY_RESOLVER_SCRIPT_DATA_H_ |
6 #define NET_PROXY_PROXY_RESOLVER_SCRIPT_DATA_H_ | 6 #define NET_PROXY_PROXY_RESOLVER_SCRIPT_DATA_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // Creates a script data given the UTF16 bytes of the content. | 34 // Creates a script data given the UTF16 bytes of the content. |
35 static scoped_refptr<ProxyResolverScriptData> FromUTF16( | 35 static scoped_refptr<ProxyResolverScriptData> FromUTF16( |
36 const base::string16& utf16); | 36 const base::string16& utf16); |
37 | 37 |
38 // Creates a script data given a URL to the PAC script. | 38 // Creates a script data given a URL to the PAC script. |
39 static scoped_refptr<ProxyResolverScriptData> FromURL(const GURL& url); | 39 static scoped_refptr<ProxyResolverScriptData> FromURL(const GURL& url); |
40 | 40 |
41 // Creates a script data for using an automatically detected PAC URL. | 41 // Creates a script data for using an automatically detected PAC URL. |
42 static scoped_refptr<ProxyResolverScriptData> ForAutoDetect(); | 42 static scoped_refptr<ProxyResolverScriptData> ForAutoDetect(); |
43 | 43 |
44 Type type() const { | 44 Type type() const { return type_; } |
45 return type_; | |
46 } | |
47 | 45 |
48 // Returns the contents of the script as UTF16. | 46 // Returns the contents of the script as UTF16. |
49 // (only valid for type() == TYPE_SCRIPT_CONTENTS). | 47 // (only valid for type() == TYPE_SCRIPT_CONTENTS). |
50 const base::string16& utf16() const; | 48 const base::string16& utf16() const; |
51 | 49 |
52 // Returns the URL of the script. | 50 // Returns the URL of the script. |
53 // (only valid for type() == TYPE_SCRIPT_URL). | 51 // (only valid for type() == TYPE_SCRIPT_URL). |
54 const GURL& url() const; | 52 const GURL& url() const; |
55 | 53 |
56 // Returns true if |this| matches |other|. | 54 // Returns true if |this| matches |other|. |
57 bool Equals(const ProxyResolverScriptData* other) const; | 55 bool Equals(const ProxyResolverScriptData* other) const; |
58 | 56 |
59 private: | 57 private: |
60 friend class base::RefCountedThreadSafe<ProxyResolverScriptData>; | 58 friend class base::RefCountedThreadSafe<ProxyResolverScriptData>; |
61 ProxyResolverScriptData(Type type, | 59 ProxyResolverScriptData(Type type, |
62 const GURL& url, | 60 const GURL& url, |
63 const base::string16& utf16); | 61 const base::string16& utf16); |
64 virtual ~ProxyResolverScriptData(); | 62 virtual ~ProxyResolverScriptData(); |
65 | 63 |
66 | |
67 const Type type_; | 64 const Type type_; |
68 const GURL url_; | 65 const GURL url_; |
69 const base::string16 utf16_; | 66 const base::string16 utf16_; |
70 }; | 67 }; |
71 | 68 |
72 } // namespace net | 69 } // namespace net |
73 | 70 |
74 #endif // NET_PROXY_PROXY_RESOLVER_SCRIPT_DATA_H_ | 71 #endif // NET_PROXY_PROXY_RESOLVER_SCRIPT_DATA_H_ |
OLD | NEW |