diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-18 18:29:36 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-18 18:29:36 +0000 |
commit | 13677b86fc97aeab327e476c7de42bc777a54ee4 (patch) | |
tree | 5e2682e91c0d09d63a6a54e36d9996fef5528e8d | |
parent | d929a9dfff856658662a962fd4dabed66d1e0b2f (diff) | |
download | chromium_src-13677b86fc97aeab327e476c7de42bc777a54ee4.zip chromium_src-13677b86fc97aeab327e476c7de42bc777a54ee4.tar.gz chromium_src-13677b86fc97aeab327e476c7de42bc777a54ee4.tar.bz2 |
net: Add NET_API to net/base
BUG=76997
TEST=NONE
Review URL: http://codereview.chromium.org/6969077
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85785 0039d316-1c4b-4281-b951-d872f2087c98
59 files changed, 348 insertions, 255 deletions
diff --git a/base/compiler_specific.h b/base/compiler_specific.h index 43ff21c..99e4f8e 100644 --- a/base/compiler_specific.h +++ b/base/compiler_specific.h @@ -54,6 +54,21 @@ code \ MSVC_POP_WARNING() +// Allows exporting a class that inherits from a non-exported base class. +// This uses suppress instead of push/pop because the delimiter after the +// declaration (either "," or "{") has to be placed before the pop macro. +// +// Example usage: +// class EXPORT_API Foo : NON_EXPORTED_BASE(public Bar) { +// +// MSVC Compiler warning C4275: +// non dll-interface class 'Bar' used as base for dll-interface class 'Foo'. +// Note that this is intended to be used only when no access to the base class +// can be gained through the derived class. For more info, see +// http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx +#define NON_EXPORTED_BASE(code) MSVC_SUPPRESS_WARNING(4275) \ + code + #else // Not MSVC #define MSVC_SUPPRESS_WARNING(n) @@ -63,6 +78,7 @@ #define MSVC_DISABLE_OPTIMIZE() #define MSVC_ENABLE_OPTIMIZE() #define ALLOW_THIS_IN_INITIALIZER_LIST(code) code +#define NON_EXPORTED_BASE(code) code #endif // COMPILER_MSVC diff --git a/base/threading/non_thread_safe.h b/base/threading/non_thread_safe.h index e4a1c07..3f60fed 100644 --- a/base/threading/non_thread_safe.h +++ b/base/threading/non_thread_safe.h @@ -6,6 +6,12 @@ #define BASE_THREADING_NON_THREAD_SAFE_H_ #pragma once +// Classes deriving from NonThreadSafe may need to supress MSVC warning 4275: +// non dll-interface class 'Bar' used as base for dll-interface class 'Foo'. +// There is a specific macro to do it: NON_EXPORTED_BASE(), defined in +// compiler_specific.h +#include "base/compiler_specific.h" + #ifndef NDEBUG #include "base/threading/non_thread_safe_impl.h" #endif diff --git a/base/win/object_watcher.h b/base/win/object_watcher.h index 0eef022..4cc6090 100644 --- a/base/win/object_watcher.h +++ b/base/win/object_watcher.h @@ -44,7 +44,7 @@ namespace win { // class BASE_API ObjectWatcher : public MessageLoop::DestructionObserver { public: - class Delegate { + class BASE_API Delegate { public: virtual ~Delegate() {} // Called from the MessageLoop when a signaled object is detected. To diff --git a/net/base/address_list.h b/net/base/address_list.h index eb78653..e29e34b 100644 --- a/net/base/address_list.h +++ b/net/base/address_list.h @@ -9,6 +9,7 @@ #include <string> #include "base/memory/ref_counted.h" +#include "net/base/net_api.h" #include "net/base/net_util.h" struct addrinfo; @@ -17,7 +18,7 @@ namespace net { // An AddressList object contains a linked list of addrinfo structures. This // class is designed to be copied around by value. -class AddressList { +class NET_API AddressList { public: // Constructs an invalid address list. Should not call any methods on this // other than assignment. diff --git a/net/base/asn1_util.h b/net/base/asn1_util.h index 507e79c..563f6d1 100644 --- a/net/base/asn1_util.h +++ b/net/base/asn1_util.h @@ -7,6 +7,7 @@ #pragma once #include "base/string_piece.h" +#include "net/base/net_api.h" namespace net { @@ -45,8 +46,8 @@ bool GetElement(base::StringPiece* in, // ExtractSPKIFromDERCert parses the DER encoded certificate in |cert| and // extracts the bytes of the SubjectPublicKeyInfo. On successful return, // |spki_out| is set to contain the SPKI, pointing into |cert|. -bool ExtractSPKIFromDERCert(base::StringPiece cert, - base::StringPiece* spki_out); +NET_TEST bool ExtractSPKIFromDERCert(base::StringPiece cert, + base::StringPiece* spki_out); } // namespace asn1 diff --git a/net/base/auth.h b/net/base/auth.h index 32919c8..93ef13e 100644 --- a/net/base/auth.h +++ b/net/base/auth.h @@ -10,12 +10,13 @@ #include "base/memory/ref_counted.h" #include "base/string16.h" +#include "net/base/net_api.h" namespace net { // Holds info about an authentication challenge that we may want to display // to the user. -class AuthChallengeInfo : +class NET_API AuthChallengeInfo : public base::RefCountedThreadSafe<AuthChallengeInfo> { public: AuthChallengeInfo(); diff --git a/net/base/backoff_entry.h b/net/base/backoff_entry.h index 6cf164d..1a7d2dc 100644 --- a/net/base/backoff_entry.h +++ b/net/base/backoff_entry.h @@ -8,6 +8,7 @@ #include "base/threading/non_thread_safe.h" #include "base/time.h" +#include "net/base/net_api.h" namespace net { @@ -16,7 +17,7 @@ namespace net { // // This utility class knows nothing about network specifics; it is // intended for reuse in various networking scenarios. -class BackoffEntry : public base::NonThreadSafe { +class NET_TEST BackoffEntry : NON_EXPORTED_BASE(public base::NonThreadSafe) { public: // The set of parameters that define a back-off policy. struct Policy { diff --git a/net/base/capturing_net_log.h b/net/base/capturing_net_log.h index 15887e5..9185f48 100644 --- a/net/base/capturing_net_log.h +++ b/net/base/capturing_net_log.h @@ -14,15 +14,16 @@ #include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" #include "base/time.h" +#include "net/base/net_api.h" #include "net/base/net_log.h" namespace net { // CapturingNetLog is an implementation of NetLog that saves messages to a // bounded buffer. -class CapturingNetLog : public NetLog { +class NET_API CapturingNetLog : public NetLog { public: - struct Entry { + struct NET_API Entry { Entry(EventType type, const base::TimeTicks& time, Source source, @@ -83,7 +84,7 @@ class CapturingNetLog : public NetLog { // // CapturingBoundNetLog can easily be converted to a BoundNetLog using the // bound() method. -class CapturingBoundNetLog { +class NET_TEST CapturingBoundNetLog { public: CapturingBoundNetLog(const NetLog::Source& source, CapturingNetLog* net_log); diff --git a/net/base/cert_database.h b/net/base/cert_database.h index 0fadb61..6c9b008 100644 --- a/net/base/cert_database.h +++ b/net/base/cert_database.h @@ -13,6 +13,7 @@ #include "base/memory/ref_counted.h" #include "base/string16.h" #include "net/base/cert_type.h" +#include "net/base/net_api.h" namespace net { @@ -29,7 +30,7 @@ typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; // for all operations that manipulate the underlying system // certificate store. -class CertDatabase { +class NET_API CertDatabase { public: // A CertDatabase::Observer will be notified on certificate database changes. @@ -37,7 +38,7 @@ class CertDatabase { // a certificate is changed. Observers can register themselves // via CertDatabase::AddObserver, and can un-register with // CertDatabase::RemoveObserver. - class Observer { + class NET_API Observer { public: virtual ~Observer() {} @@ -57,7 +58,7 @@ class CertDatabase { }; // Stores per-certificate error codes for import failures. - struct ImportCertFailure { + struct NET_API ImportCertFailure { public: ImportCertFailure(X509Certificate* cert, int err); ~ImportCertFailure(); diff --git a/net/base/cert_verifier.h b/net/base/cert_verifier.h index f2db53f..2546d7c 100644 --- a/net/base/cert_verifier.h +++ b/net/base/cert_verifier.h @@ -16,6 +16,7 @@ #include "net/base/cert_database.h" #include "net/base/cert_verify_result.h" #include "net/base/completion_callback.h" +#include "net/base/net_api.h" #include "net/base/x509_cert_types.h" namespace net { @@ -47,8 +48,8 @@ struct CachedCertVerifyResult { // request at a time is to create a SingleRequestCertVerifier wrapper around // CertVerifier (which will automatically cancel the single request when it // goes out of scope). -class CertVerifier : public base::NonThreadSafe, - public CertDatabase::Observer { +class NET_API CertVerifier : NON_EXPORTED_BASE(public base::NonThreadSafe), + public CertDatabase::Observer { public: // Opaque type used to cancel a request. typedef void* RequestHandle; diff --git a/net/base/cert_verify_result.h b/net/base/cert_verify_result.h index 7d88547..e4fb84a 100644 --- a/net/base/cert_verify_result.h +++ b/net/base/cert_verify_result.h @@ -8,13 +8,14 @@ #include <vector> +#include "net/base/net_api.h" #include "net/base/x509_cert_types.h" namespace net { // The result of certificate verification. Eventually this may contain the // certificate chain that was constructed during certificate verification. -class CertVerifyResult { +class NET_API CertVerifyResult { public: CertVerifyResult(); ~CertVerifyResult(); diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h index 7fe279f..58b13d4 100644 --- a/net/base/cookie_monster.h +++ b/net/base/cookie_monster.h @@ -21,6 +21,7 @@ #include "base/task.h" #include "base/time.h" #include "net/base/cookie_store.h" +#include "net/base/net_api.h" class GURL; @@ -42,7 +43,7 @@ class CookieList; // // TODO(deanm) Implement CookieMonster, the cookie database. // - Verify that our domain enforcement and non-dotted handling is correct -class CookieMonster : public CookieStore { +class NET_API CookieMonster : public CookieStore { public: class CanonicalCookie; class Delegate; @@ -532,7 +533,7 @@ class CookieMonster : public CookieStore { DISALLOW_COPY_AND_ASSIGN(CookieMonster); }; -class CookieMonster::CanonicalCookie { +class NET_API CookieMonster::CanonicalCookie { public: // These constructors do no validation or canonicalization of their inputs; @@ -689,7 +690,7 @@ class CookieMonster::Delegate virtual ~Delegate() {} }; -class CookieMonster::ParsedCookie { +class NET_API CookieMonster::ParsedCookie { public: typedef std::pair<std::string, std::string> TokenValuePair; typedef std::vector<TokenValuePair> PairList; diff --git a/net/base/cookie_store.h b/net/base/cookie_store.h index 1e0c76e..4dfc34d 100644 --- a/net/base/cookie_store.h +++ b/net/base/cookie_store.h @@ -15,6 +15,7 @@ #include "base/memory/ref_counted.h" #include "base/time.h" #include "net/base/cookie_options.h" +#include "net/base/net_api.h" class GURL; @@ -24,12 +25,12 @@ class CookieMonster; // An interface for storing and retrieving cookies. Implementations need to // be thread safe as its methods can be accessed from IO as well as UI threads. -class CookieStore : public base::RefCountedThreadSafe<CookieStore> { +class NET_API CookieStore : public base::RefCountedThreadSafe<CookieStore> { public: // This struct contains additional consumer-specific information that might // be stored with cookies; currently just MAC information, see: // http://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac - struct CookieInfo { + struct NET_API CookieInfo { CookieInfo(); ~CookieInfo(); diff --git a/net/base/data_url.h b/net/base/data_url.h index 65a211a..a6c42ea 100644 --- a/net/base/data_url.h +++ b/net/base/data_url.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,8 @@ #include <string> +#include "net/base/net_api.h" + class GURL; namespace net { @@ -26,7 +28,7 @@ namespace net { // If <mediatype> is omitted, it defaults to text/plain;charset=US-ASCII. As a // shorthand, "text/plain" can be omitted but the charset parameter supplied. // -class DataURL { +class NET_API DataURL { public: // This method can be used to parse a 'data' URL into its component pieces. // diff --git a/net/base/directory_lister.h b/net/base/directory_lister.h index 29d2691..7cf2c34 100644 --- a/net/base/directory_lister.h +++ b/net/base/directory_lister.h @@ -12,6 +12,7 @@ #include "base/file_util.h" #include "base/message_loop_proxy.h" #include "base/memory/ref_counted.h" +#include "net/base/net_api.h" namespace net { @@ -22,7 +23,7 @@ namespace net { // structs over to the main application thread. The consumer of this class // is insulated from any of the multi-threading details. // -class DirectoryLister { +class NET_API DirectoryLister { public: // Represents one file found. struct DirectoryListerData { diff --git a/net/base/dns_util.h b/net/base/dns_util.h index 40e8736..bf4c330 100644 --- a/net/base/dns_util.h +++ b/net/base/dns_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,6 +9,7 @@ #include <string> #include "base/basictypes.h" +#include "net/base/net_api.h" namespace net { @@ -17,14 +18,14 @@ namespace net { // // dotted: a string in dotted form: "www.google.com" // out: a result in DNS form: "\x03www\x06google\x03com\x00" -bool DNSDomainFromDot(const std::string& dotted, std::string* out); +NET_TEST bool DNSDomainFromDot(const std::string& dotted, std::string* out); // DNSDomainToString coverts a domain in DNS format to a dotted string. -std::string DNSDomainToString(const std::string& domain); +NET_TEST std::string DNSDomainToString(const std::string& domain); // Returns true iff the given character is in the set of valid DNS label // characters as given in RFC 3490, 4.1, 3(a) -bool IsSTD3ASCIIValidCharacter(char c); +NET_TEST bool IsSTD3ASCIIValidCharacter(char c); // Returns the hostname by trimming the ending dot, if one exists. std::string TrimEndingDot(const std::string& host); diff --git a/net/base/dnsrr_resolver.h b/net/base/dnsrr_resolver.h index ab86d87..4c47f8c 100644 --- a/net/base/dnsrr_resolver.h +++ b/net/base/dnsrr_resolver.h @@ -17,12 +17,13 @@ #include "base/time.h" #include "build/build_config.h" #include "net/base/completion_callback.h" +#include "net/base/net_api.h" #include "net/base/network_change_notifier.h" namespace net { // RRResponse contains the result of a successful request for a resource record. -struct RRResponse { +struct NET_TEST RRResponse { RRResponse(); ~RRResponse(); @@ -66,8 +67,8 @@ class RRResolverJob; // the name is a fully qualified DNS domain. // // A DnsRRResolver must be used from the MessageLoop which created it. -class DnsRRResolver : public base::NonThreadSafe, - public NetworkChangeNotifier::IPAddressObserver { +class NET_API DnsRRResolver : NON_EXPORTED_BASE(public base::NonThreadSafe), + public NetworkChangeNotifier::IPAddressObserver { public: typedef intptr_t Handle; diff --git a/net/base/dnssec_chain_verifier.h b/net/base/dnssec_chain_verifier.h index 60376c0..b3f577b 100644 --- a/net/base/dnssec_chain_verifier.h +++ b/net/base/dnssec_chain_verifier.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,6 +10,7 @@ #include <vector> #include "base/string_piece.h" +#include "net/base/net_api.h" namespace net { @@ -18,7 +19,7 @@ namespace net { // name. For example, if the fingerprint of a certificate was stored in a CERT // record for a given domain, then a chain could prove the validity of that // fingerprint. -class DNSSECChainVerifier { +class NET_TEST DNSSECChainVerifier { public: enum Error { OK = 0, diff --git a/net/base/dnssec_keyset.h b/net/base/dnssec_keyset.h index 968063f..448ee3d 100644 --- a/net/base/dnssec_keyset.h +++ b/net/base/dnssec_keyset.h @@ -9,12 +9,13 @@ #include <vector> #include "base/string_piece.h" +#include "net/base/net_api.h" namespace net { // DNSSECKeySet function wraps crypto/signature_verifier.h to accept // DNSSEC encodings. (See RFC 4043) -class DNSSECKeySet { +class NET_TEST DNSSECKeySet { public: DNSSECKeySet(); ~DNSSECKeySet(); diff --git a/net/base/escape.h b/net/base/escape.h index d389d85..6590329 100644 --- a/net/base/escape.h +++ b/net/base/escape.h @@ -11,34 +11,35 @@ #include "base/basictypes.h" #include "base/string16.h" +#include "net/base/net_api.h" // Escaping -------------------------------------------------------------------- // Escape a file. This includes: // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|} -std::string EscapePath(const std::string& path); +NET_API std::string EscapePath(const std::string& path); // Escape application/x-www-form-urlencoded content. This includes: // non-printable, non-7bit, and (including space) ?>=<;+'&%$#"![\]^`{|} // Space is escaped as + and other special characters as %XX (hex). -std::string EscapeUrlEncodedData(const std::string& path); +NET_API std::string EscapeUrlEncodedData(const std::string& path); // Escape all non-ASCII input. -std::string EscapeNonASCII(const std::string& input); +NET_API std::string EscapeNonASCII(const std::string& input); // Escapes characters in text suitable for use as an external protocol handler // command. // We %XX everything except alphanumerics and %-_.!~*'() and the restricted // chracters (;/?:@&=+$,). -std::string EscapeExternalHandlerValue(const std::string& text); +NET_API std::string EscapeExternalHandlerValue(const std::string& text); // Append the given character to the output string, escaping the character if // the character would be interpretted as an HTML delimiter. -void AppendEscapedCharForHTML(char c, std::string* output); +NET_API void AppendEscapedCharForHTML(char c, std::string* output); // Escape chars that might cause this text to be interpretted as HTML tags. -std::string EscapeForHTML(const std::string& text); -string16 EscapeForHTML(const string16& text); +NET_API std::string EscapeForHTML(const std::string& text); +NET_API string16 EscapeForHTML(const string16& text); // Unescaping ------------------------------------------------------------------ @@ -92,10 +93,10 @@ class UnescapeRule { // which, after unescaping, is supposed to be interpreted as UTF-8, and then // converted into full UTF-16 chars. This function won't tell you if any // conversions need to take place, it only unescapes. -std::string UnescapeURLComponent(const std::string& escaped_text, - UnescapeRule::Type rules); -string16 UnescapeURLComponent(const string16& escaped_text, - UnescapeRule::Type rules); +NET_API std::string UnescapeURLComponent(const std::string& escaped_text, + UnescapeRule::Type rules); +NET_API string16 UnescapeURLComponent(const string16& escaped_text, + UnescapeRule::Type rules); // Unescapes the given substring as a URL, and then tries to interpret the // result as being encoded as UTF-8. If the result is convertable into UTF-8, it @@ -106,17 +107,18 @@ string16 UnescapeURLComponent(const string16& escaped_text, // decoding. If this isn't possible because an offset points past the end of // the source strings or into the middle of a multibyte sequence, the offending // offset will be set to string16::npos. |offset[s]_for_adjustment| may be NULL. -string16 UnescapeAndDecodeUTF8URLComponent(const std::string& text, - UnescapeRule::Type rules, - size_t* offset_for_adjustment); -string16 UnescapeAndDecodeUTF8URLComponentWithOffsets( +NET_API string16 UnescapeAndDecodeUTF8URLComponent( + const std::string& text, + UnescapeRule::Type rules, + size_t* offset_for_adjustment); +NET_API string16 UnescapeAndDecodeUTF8URLComponentWithOffsets( const std::string& text, UnescapeRule::Type rules, std::vector<size_t>* offsets_for_adjustment); // Unescape the following ampersand character codes from |text|: // < > & " ' -string16 UnescapeForHTML(const string16& text); +NET_API string16 UnescapeForHTML(const string16& text); // Deprecated ------------------------------------------------------------------ @@ -126,19 +128,20 @@ string16 UnescapeForHTML(const string16& text); // This is basically the same as encodeURIComponent in javascript. // For the string16 version, we do a conversion to charset before encoding the // string. If the charset doesn't exist, we return false. -std::string EscapeQueryParamValue(const std::string& text, bool use_plus); -bool EscapeQueryParamValue(const string16& text, const char* codepage, - bool use_plus, string16* escaped); +NET_API std::string EscapeQueryParamValue(const std::string& text, + bool use_plus); +NET_API bool EscapeQueryParamValue(const string16& text, const char* codepage, + bool use_plus, string16* escaped); // A specialized version of EscapeQueryParamValue for string16s that // assumes the codepage is UTF8. This is provided as a convenience. -string16 EscapeQueryParamValueUTF8(const string16& text, bool use_plus); +NET_API string16 EscapeQueryParamValueUTF8(const string16& text, bool use_plus); // Private Functions (Exposed for Unit Testing) -------------------------------- // A function called by std::for_each that will adjust any offset which occurs // after one or more encoded characters. -struct AdjustEncodingOffset { +struct NET_TEST AdjustEncodingOffset { typedef std::vector<size_t> Adjustments; explicit AdjustEncodingOffset(const Adjustments& adjustments); diff --git a/net/base/file_stream.h b/net/base/file_stream.h index 8c8ea8c..5e07adc 100644 --- a/net/base/file_stream.h +++ b/net/base/file_stream.h @@ -14,6 +14,7 @@ #include "base/memory/scoped_ptr.h" #include "base/platform_file.h" #include "net/base/completion_callback.h" +#include "net/base/net_api.h" class FilePath; @@ -27,7 +28,7 @@ enum Whence { FROM_END = 2 }; -class FileStream { +class NET_API FileStream { public: FileStream(); diff --git a/net/base/filter.h b/net/base/filter.h index 561c8db..99d8356 100644 --- a/net/base/filter.h +++ b/net/base/filter.h @@ -38,6 +38,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/time.h" +#include "net/base/net_api.h" class GURL; @@ -52,7 +53,7 @@ class IOBuffer; // is passed to the constructor of all those filters. To be clear, the context // does NOT reflect the position in a chain, or the fact that there are prior // or later filters in a chain. -class FilterContext { +class NET_TEST FilterContext { public: // Enum to control what histograms are emitted near end-of-life of this // instance. @@ -100,7 +101,7 @@ class FilterContext { }; //------------------------------------------------------------------------------ -class Filter { +class NET_TEST Filter { public: // Return values of function ReadFilteredData. enum FilterStatus { diff --git a/net/base/host_cache.h b/net/base/host_cache.h index d39db61..17757ae 100644 --- a/net/base/host_cache.h +++ b/net/base/host_cache.h @@ -15,11 +15,12 @@ #include "base/time.h" #include "net/base/address_family.h" #include "net/base/address_list.h" +#include "net/base/net_api.h" namespace net { // Cache used by HostResolver to map hostnames to their resolved result. -class HostCache : public base::NonThreadSafe { +class NET_API HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) { public: // Stores the latest address list that was looked up for a hostname. struct Entry : public base::RefCounted<Entry> { diff --git a/net/base/host_mapping_rules.h b/net/base/host_mapping_rules.h index 05f531f..f43e6dcb 100644 --- a/net/base/host_mapping_rules.h +++ b/net/base/host_mapping_rules.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,12 +9,13 @@ #include <string> #include <vector> #include "base/basictypes.h" +#include "net/base/net_api.h" namespace net { class HostPortPair; -class HostMappingRules { +class NET_TEST HostMappingRules { public: HostMappingRules(); ~HostMappingRules(); diff --git a/net/base/host_port_pair.h b/net/base/host_port_pair.h index 7488e6c..d23b63c 100644 --- a/net/base/host_port_pair.h +++ b/net/base/host_port_pair.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,13 +8,14 @@ #include <string> #include "base/basictypes.h" +#include "net/base/net_api.h" struct addrinfo; class GURL; namespace net { -class HostPortPair { +class NET_API HostPortPair { public: HostPortPair(); // If |in_host| represents an IPv6 address, it should not bracket the address. diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h index cf32cb0..3148697 100644 --- a/net/base/host_resolver.h +++ b/net/base/host_resolver.h @@ -13,6 +13,7 @@ #include "net/base/address_family.h" #include "net/base/completion_callback.h" #include "net/base/host_port_pair.h" +#include "net/base/net_api.h" #include "net/base/request_priority.h" namespace net { @@ -32,11 +33,11 @@ class NetLog; // request at a time is to create a SingleRequestHostResolver wrapper around // HostResolver (which will automatically cancel the single request when it // goes out of scope). -class HostResolver { +class NET_API HostResolver { public: // The parameters for doing a Resolve(). A hostname and port are required, // the rest are optional (and have reasonable defaults). - class RequestInfo { + class NET_API RequestInfo { public: explicit RequestInfo(const HostPortPair& host_port_pair); @@ -241,8 +242,8 @@ class SingleRequestHostResolver { // |max_concurrent_resolves| is how many resolve requests will be allowed to // run in parallel. Pass HostResolver::kDefaultParallelism to choose a // default value. -HostResolver* CreateSystemHostResolver(size_t max_concurrent_resolves, - NetLog* net_log); +NET_API HostResolver* CreateSystemHostResolver(size_t max_concurrent_resolves, + NetLog* net_log); } // namespace net diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h index 140afa3..9b8c1a6 100644 --- a/net/base/host_resolver_impl.h +++ b/net/base/host_resolver_impl.h @@ -17,6 +17,7 @@ #include "net/base/host_cache.h" #include "net/base/host_resolver.h" #include "net/base/host_resolver_proc.h" +#include "net/base/net_api.h" #include "net/base/net_log.h" #include "net/base/network_change_notifier.h" @@ -58,9 +59,10 @@ namespace net { // the results from the first attempt that finishes and ignore the results from // all other attempts. -class HostResolverImpl : public HostResolver, - public base::NonThreadSafe, - public NetworkChangeNotifier::IPAddressObserver { +class NET_API HostResolverImpl + : public HostResolver, + NON_EXPORTED_BASE(public base::NonThreadSafe), + public NetworkChangeNotifier::IPAddressObserver { public: // The index into |job_pools_| for the various job pools. Pools with a higher // index have lower priority. diff --git a/net/base/host_resolver_proc.h b/net/base/host_resolver_proc.h index 56259fa..b5c61c4 100644 --- a/net/base/host_resolver_proc.h +++ b/net/base/host_resolver_proc.h @@ -10,6 +10,7 @@ #include "base/memory/ref_counted.h" #include "net/base/address_family.h" +#include "net/base/net_api.h" namespace net { @@ -22,7 +23,8 @@ class AddressList; // // Note that implementations of HostResolverProc *MUST BE THREADSAFE*, since // the HostResolver implementation using them can be multi-threaded. -class HostResolverProc : public base::RefCountedThreadSafe<HostResolverProc> { +class NET_API HostResolverProc + : public base::RefCountedThreadSafe<HostResolverProc> { public: explicit HostResolverProc(HostResolverProc* previous); @@ -83,11 +85,11 @@ class HostResolverProc : public base::RefCountedThreadSafe<HostResolverProc> { // |addrlist| with a list of socket addresses. Otherwise returns a // network error code, and fills |os_error| with a more specific errir if it // was non-NULL. -int SystemHostResolverProc(const std::string& host, - AddressFamily address_family, - HostResolverFlags host_resolver_flags, - AddressList* addrlist, - int* os_error); +NET_TEST int SystemHostResolverProc(const std::string& host, + AddressFamily address_family, + HostResolverFlags host_resolver_flags, + AddressList* addrlist, + int* os_error); } // namespace net diff --git a/net/base/io_buffer.h b/net/base/io_buffer.h index a747ead..1ec7869 100644 --- a/net/base/io_buffer.h +++ b/net/base/io_buffer.h @@ -11,12 +11,13 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/pickle.h" +#include "net/base/net_api.h" namespace net { // This is a simple wrapper around a buffer that provides ref counting for // easier asynchronous IO handling. -class IOBuffer : public base::RefCountedThreadSafe<IOBuffer> { +class NET_API IOBuffer : public base::RefCountedThreadSafe<IOBuffer> { public: IOBuffer(); explicit IOBuffer(int buffer_size); @@ -39,7 +40,7 @@ class IOBuffer : public base::RefCountedThreadSafe<IOBuffer> { // doesn't have to keep track of that value. // NOTE: This doesn't mean that we want to stop sending the size as an explicit // argument to IO functions. Please keep using IOBuffer* for API declarations. -class IOBufferWithSize : public IOBuffer { +class NET_API IOBufferWithSize : public IOBuffer { public: explicit IOBufferWithSize(int size); @@ -53,7 +54,7 @@ class IOBufferWithSize : public IOBuffer { // This is a read only IOBuffer. The data is stored in a string and // the IOBuffer interface does not provide a proper way to modify it. -class StringIOBuffer : public IOBuffer { +class NET_API StringIOBuffer : public IOBuffer { public: explicit StringIOBuffer(const std::string& s); @@ -67,7 +68,7 @@ class StringIOBuffer : public IOBuffer { // This version wraps an existing IOBuffer and provides convenient functions // to progressively read all the data. -class DrainableIOBuffer : public IOBuffer { +class NET_API DrainableIOBuffer : public IOBuffer { public: DrainableIOBuffer(IOBuffer* base, int size); @@ -96,7 +97,7 @@ class DrainableIOBuffer : public IOBuffer { }; // This version provides a resizable buffer and a changeable offset. -class GrowableIOBuffer : public IOBuffer { +class NET_API GrowableIOBuffer : public IOBuffer { public: GrowableIOBuffer(); @@ -121,7 +122,7 @@ class GrowableIOBuffer : public IOBuffer { // This versions allows a pickle to be used as the storage for a write-style // operation, avoiding an extra data copy. -class PickledIOBuffer : public IOBuffer { +class NET_API PickledIOBuffer : public IOBuffer { public: PickledIOBuffer(); @@ -142,7 +143,7 @@ class PickledIOBuffer : public IOBuffer { // A good example is the buffer for a synchronous operation, where we can be // sure that nobody is keeping an extra reference to this object so the lifetime // of the buffer can be completely managed by its intended owner. -class WrappedIOBuffer : public IOBuffer { +class NET_API WrappedIOBuffer : public IOBuffer { public: explicit WrappedIOBuffer(const char* data); diff --git a/net/base/ip_endpoint.h b/net/base/ip_endpoint.h index f76a82a..cc6fd1d 100644 --- a/net/base/ip_endpoint.h +++ b/net/base/ip_endpoint.h @@ -7,6 +7,7 @@ #pragma once #include "base/basictypes.h" +#include "net/base/net_api.h" #include "net/base/net_util.h" struct sockaddr; @@ -16,7 +17,7 @@ namespace net { // An IPEndPoint represents the address of a transport endpoint: // * IP address (either v4 or v6) // * Port -class IPEndPoint { +class NET_API IPEndPoint { public: IPEndPoint(); virtual ~IPEndPoint(); diff --git a/net/base/keygen_handler.h b/net/base/keygen_handler.h index 6927763..990b41d2 100644 --- a/net/base/keygen_handler.h +++ b/net/base/keygen_handler.h @@ -11,6 +11,7 @@ #include "base/memory/scoped_ptr.h" #include "build/build_config.h" #include "googleurl/src/gurl.h" +#include "net/base/net_api.h" #if defined(USE_NSS) #include "crypto/crypto_module_blocking_password_delegate.h" @@ -23,7 +24,7 @@ namespace net { // <http://dev.w3.org/html5/spec/Overview.html#the-keygen-element> // <https://developer.mozilla.org/En/HTML/HTML_Extensions/KEYGEN_Tag> -class KeygenHandler { +class NET_API KeygenHandler { public: // Creates a handler that will generate a key with the given key size and // incorporate the |challenge| into the Netscape SPKAC structure. The request diff --git a/net/base/listen_socket.h b/net/base/listen_socket.h index ad77b19..8136667 100644 --- a/net/base/listen_socket.h +++ b/net/base/listen_socket.h @@ -25,7 +25,9 @@ #endif #include "base/basictypes.h" +#include "base/compiler_specific.h" #include "base/memory/ref_counted.h" +#include "net/base/net_api.h" #if defined(OS_POSIX) struct event; // From libevent @@ -33,13 +35,12 @@ typedef int SOCKET; #endif // Implements a raw socket interface -class ListenSocket : public base::RefCountedThreadSafe<ListenSocket>, +class NET_API ListenSocket : public base::RefCountedThreadSafe<ListenSocket>, #if defined(OS_WIN) - public base::win::ObjectWatcher::Delegate + public base::win::ObjectWatcher::Delegate { #elif defined(OS_POSIX) - public MessageLoopForIO::Watcher + public MessageLoopForIO::Watcher { #endif -{ public: // TODO(erikkay): this delegate should really be split into two parts // to split up the listener from the connected socket. Perhaps this class diff --git a/net/base/mapped_host_resolver.h b/net/base/mapped_host_resolver.h index 5ca5223..343c5e1 100644 --- a/net/base/mapped_host_resolver.h +++ b/net/base/mapped_host_resolver.h @@ -11,6 +11,7 @@ #include "base/memory/scoped_ptr.h" #include "net/base/host_mapping_rules.h" #include "net/base/host_resolver.h" +#include "net/base/net_api.h" namespace net { @@ -18,7 +19,7 @@ namespace net { // request before passing it off to |impl|. This is different from // MockHostResolver which does the remapping at the HostResolverProc // layer, so it is able to preserve the effectiveness of the cache. -class MappedHostResolver : public HostResolver { +class NET_API MappedHostResolver : public HostResolver { public: // Creates a MappedHostResolver that forwards all of its requests through // |impl|. It takes ownership of |impl|. diff --git a/net/base/mime_sniffer.h b/net/base/mime_sniffer.h index 5f3862b8..f6a1175 100644 --- a/net/base/mime_sniffer.h +++ b/net/base/mime_sniffer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,8 @@ #include <string> +#include "net/base/net_api.h" + class GURL; namespace net { @@ -24,7 +26,7 @@ const int kMaxBytesToSniff = 1024; // @param url The URL from which we obtained the content. // @param mime_type The current mime type, e.g. from the Content-Type header. // @return Returns true if we should sniff the mime type. -bool ShouldSniffMimeType(const GURL& url, const std::string& mime_type); +NET_API bool ShouldSniffMimeType(const GURL& url, const std::string& mime_type); // Guess a mime type from the first few bytes of content an its URL. Always // assigns |result| with its best guess of a mime type. @@ -35,9 +37,9 @@ bool ShouldSniffMimeType(const GURL& url, const std::string& mime_type); // @param type_hint The current mime type, e.g. from the Content-Type header. // @param result Address at which to place the sniffed mime type. // @return Returns true if we have enough content to guess the mime type. -bool SniffMimeType(const char* content, size_t content_size, - const GURL& url, const std::string& type_hint, - std::string* result); +NET_API bool SniffMimeType(const char* content, size_t content_size, + const GURL& url, const std::string& type_hint, + std::string* result); } // namespace net diff --git a/net/base/mime_util.h b/net/base/mime_util.h index 249a25b..d228b58 100644 --- a/net/base/mime_util.h +++ b/net/base/mime_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,89 +10,93 @@ #include <vector> #include "base/file_path.h" +#include "net/base/net_api.h" namespace net { // Get the mime type (if any) that is associated with the given file extension. // Returns true if a corresponding mime type exists. -bool GetMimeTypeFromExtension(const FilePath::StringType& ext, - std::string* mime_type); +NET_API bool GetMimeTypeFromExtension(const FilePath::StringType& ext, + std::string* mime_type); // Get the mime type (if any) that is associated with the given file. Returns // true if a corresponding mime type exists. -bool GetMimeTypeFromFile(const FilePath& file_path, std::string* mime_type); +NET_API bool GetMimeTypeFromFile(const FilePath& file_path, + std::string* mime_type); // Get the preferred extension (if any) associated with the given mime type. // Returns true if a corresponding file extension exists. The extension is // returned without a prefixed dot, ex "html". -bool GetPreferredExtensionForMimeType(const std::string& mime_type, - FilePath::StringType* extension); +NET_API bool GetPreferredExtensionForMimeType(const std::string& mime_type, + FilePath::StringType* extension); // Check to see if a particular MIME type is in our list. -bool IsSupportedImageMimeType(const char* mime_type); -bool IsSupportedMediaMimeType(const char* mime_type); -bool IsSupportedNonImageMimeType(const char* mime_type); -bool IsSupportedJavascriptMimeType(const char* mime_type); +NET_API bool IsSupportedImageMimeType(const char* mime_type); +NET_API bool IsSupportedMediaMimeType(const char* mime_type); +NET_API bool IsSupportedNonImageMimeType(const char* mime_type); +NET_API bool IsSupportedJavascriptMimeType(const char* mime_type); // Get whether this mime type should be displayed in view-source mode. // (For example, XML.) -bool IsViewSourceMimeType(const char* mime_type); +NET_API bool IsViewSourceMimeType(const char* mime_type); // Convenience function. -bool IsSupportedMimeType(const std::string& mime_type); +NET_API bool IsSupportedMimeType(const std::string& mime_type); // Returns true if this the mime_type_pattern matches a given mime-type. // Checks for absolute matching and wildcards. mime-types should be in // lower case. -bool MatchesMimeType(const std::string &mime_type_pattern, - const std::string &mime_type); +NET_API bool MatchesMimeType(const std::string &mime_type_pattern, + const std::string &mime_type); // Returns true if and only if all codecs are supported, false otherwise. -bool AreSupportedMediaCodecs(const std::vector<std::string>& codecs); +NET_API bool AreSupportedMediaCodecs(const std::vector<std::string>& codecs); // Parses a codec string, populating |codecs_out| with the prefix of each codec // in the string |codecs_in|. For example, passed "aaa.b.c,dd.eee", if // |strip| == true |codecs_out| will contain {"aaa", "dd"}, if |strip| == false // |codecs_out| will contain {"aaa.b.c", "dd.eee"}. // See http://www.ietf.org/rfc/rfc4281.txt. -void ParseCodecString(const std::string& codecs, - std::vector<std::string>* codecs_out, - bool strip); +NET_API void ParseCodecString(const std::string& codecs, + std::vector<std::string>* codecs_out, + bool strip); // Check to see if a particular MIME type is in our list which only supports a // certain subset of codecs. -bool IsStrictMediaMimeType(const std::string& mime_type); +NET_API bool IsStrictMediaMimeType(const std::string& mime_type); // Check to see if a particular MIME type is in our list which only supports a // certain subset of codecs. Returns true if and only if all codecs are // supported for that specific MIME type, false otherwise. If this returns // false you will still need to check if the media MIME tpyes and codecs are // supported. -bool IsSupportedStrictMediaMimeType(const std::string& mime_type, +NET_API bool IsSupportedStrictMediaMimeType( + const std::string& mime_type, const std::vector<std::string>& codecs); // Get the extensions for images files. // Note that we do not erase the existing elements in the the provided vector. // Instead, we append the result to it. -void GetImageExtensions(std::vector<FilePath::StringType>* extensions); +NET_API void GetImageExtensions(std::vector<FilePath::StringType>* extensions); // Get the extensions for audio files. // Note that we do not erase the existing elements in the the provided vector. // Instead, we append the result to it. -void GetAudioExtensions(std::vector<FilePath::StringType>* extensions); +NET_API void GetAudioExtensions(std::vector<FilePath::StringType>* extensions); // Get the extensions for video files. // Note that we do not erase the existing elements in the the provided vector. // Instead, we append the result to it. -void GetVideoExtensions(std::vector<FilePath::StringType>* extensions); +NET_API void GetVideoExtensions(std::vector<FilePath::StringType>* extensions); // Get the extensions associated with the given mime type. // There could be multiple extensions for a given mime type, like "html,htm" // for "text/html". // Note that we do not erase the existing elements in the the provided vector. // Instead, we append the result to it. -void GetExtensionsForMimeType(const std::string& mime_type, - std::vector<FilePath::StringType>* extensions); +NET_API void GetExtensionsForMimeType( + const std::string& mime_type, + std::vector<FilePath::StringType>* extensions); } // namespace net diff --git a/net/base/mock_host_resolver.h b/net/base/mock_host_resolver.h index 3b1e36a..44667f4 100644 --- a/net/base/mock_host_resolver.h +++ b/net/base/mock_host_resolver.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,6 +11,7 @@ #include "base/synchronization/waitable_event.h" #include "net/base/host_resolver_impl.h" #include "net/base/host_resolver_proc.h" +#include "net/base/net_api.h" namespace net { @@ -37,7 +38,7 @@ class RuleBasedHostResolverProc; // re-map one hostname to another as well. // Base class shared by MockHostResolver and MockCachingHostResolver. -class MockHostResolverBase : public HostResolver { +class NET_TEST MockHostResolverBase : public HostResolver { public: virtual ~MockHostResolverBase(); @@ -101,7 +102,7 @@ class MockCachingHostResolver : public MockHostResolverBase { // a replacement host string. It then uses the system host resolver to return // a socket address. Generally the replacement should be an IPv4 literal so // there is no network dependency. -class RuleBasedHostResolverProc : public HostResolverProc { +class NET_TEST RuleBasedHostResolverProc : public HostResolverProc { public: explicit RuleBasedHostResolverProc(HostResolverProc* previous); @@ -152,7 +153,7 @@ class RuleBasedHostResolverProc : public HostResolverProc { }; // Using WaitingHostResolverProc you can simulate very long lookups. -class WaitingHostResolverProc : public HostResolverProc { +class NET_TEST WaitingHostResolverProc : public HostResolverProc { public: explicit WaitingHostResolverProc(HostResolverProc* previous); @@ -180,7 +181,7 @@ class WaitingHostResolverProc : public HostResolverProc { // // NOTE: Only use this as a catch-all safety net. Individual tests should use // MockHostResolver. -class ScopedDefaultHostResolverProc { +class NET_TEST ScopedDefaultHostResolverProc { public: ScopedDefaultHostResolverProc(); explicit ScopedDefaultHostResolverProc(HostResolverProc* proc); diff --git a/net/base/net_log.h b/net/base/net_log.h index 3df804a..584e0fa 100644 --- a/net/base/net_log.h +++ b/net/base/net_log.h @@ -11,6 +11,7 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" +#include "net/base/net_api.h" class Value; @@ -35,7 +36,7 @@ namespace net { // TODO(eroman): Start a new Source each time URLRequest redirects // (simpler to reason about each as a separate entity). -class NetLog { +class NET_API NetLog { public: enum EventType { #define EVENT_TYPE(label) TYPE_ ## label, @@ -61,7 +62,7 @@ class NetLog { // Identifies the entity that generated this log. The |id| field should // uniquely identify the source, and is used by log observers to infer // message groupings. Can use NetLog::NextID() to create unique IDs. - struct Source { + struct NET_API Source { static const uint32 kInvalidId = 0; Source() : type(SOURCE_NONE), id(kInvalidId) {} @@ -78,7 +79,8 @@ class NetLog { // Base class for associating additional parameters with an event. Log // observers need to know what specific derivations of EventParameters a // particular EventType uses, in order to get at the individual components. - class EventParameters : public base::RefCountedThreadSafe<EventParameters> { + class NET_API EventParameters + : public base::RefCountedThreadSafe<EventParameters> { public: EventParameters() {} virtual ~EventParameters() {} @@ -163,7 +165,7 @@ class NetLog { // Helper that binds a Source to a NetLog, and exposes convenience methods to // output log messages without needing to pass in the source. -class BoundNetLog { +class NET_API BoundNetLog { public: BoundNetLog() : net_log_(NULL) {} @@ -279,7 +281,7 @@ class NetLogSourceParameter : public NetLog::EventParameters { // ScopedNetLogEvent logs a begin event on creation, and the corresponding end // event on destruction. -class ScopedNetLogEvent { +class NET_TEST ScopedNetLogEvent { public: ScopedNetLogEvent(const BoundNetLog& net_log, NetLog::EventType event_type, diff --git a/net/base/net_module.h b/net/base/net_module.h index b08a30a..16289b1 100644 --- a/net/base/net_module.h +++ b/net/base/net_module.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "base/string_piece.h" +#include "net/base/net_api.h" namespace net { @@ -18,7 +19,7 @@ namespace net { // cannot see the ResourceBundle class used by Chrome), so it uses this API to // get access to such resources. // -class NetModule { +class NET_API NetModule { public: typedef base::StringPiece (*ResourceProvider)(int key); diff --git a/net/base/net_util.h b/net/base/net_util.h index 93cd423..9610932 100644 --- a/net/base/net_util.h +++ b/net/base/net_util.h @@ -23,6 +23,7 @@ #include "base/basictypes.h" #include "base/string16.h" #include "net/base/escape.h" +#include "net/base/net_api.h" struct addrinfo; class FilePath; @@ -59,33 +60,33 @@ class QuoteRule { }; // Nothing is ommitted. -extern const FormatUrlType kFormatUrlOmitNothing; +NET_API extern const FormatUrlType kFormatUrlOmitNothing; // If set, any username and password are removed. -extern const FormatUrlType kFormatUrlOmitUsernamePassword; +NET_API extern const FormatUrlType kFormatUrlOmitUsernamePassword; // If the scheme is 'http://', it's removed. -extern const FormatUrlType kFormatUrlOmitHTTP; +NET_API extern const FormatUrlType kFormatUrlOmitHTTP; // Omits the path if it is just a slash and there is no query or ref. This is // meaningful for non-file "standard" URLs. -extern const FormatUrlType kFormatUrlOmitTrailingSlashOnBareHostname; +NET_API extern const FormatUrlType kFormatUrlOmitTrailingSlashOnBareHostname; // Convenience for omitting all unecessary types. -extern const FormatUrlType kFormatUrlOmitAll; +NET_API extern const FormatUrlType kFormatUrlOmitAll; // Holds a list of ports that should be accepted despite bans. -extern std::multiset<int> explicitly_allowed_ports; +NET_TEST extern std::multiset<int> explicitly_allowed_ports; // Given the full path to a file name, creates a file: URL. The returned URL // may not be valid if the input is malformed. -GURL FilePathToFileURL(const FilePath& path); +NET_API GURL FilePathToFileURL(const FilePath& path); // Converts a file: URL back to a filename that can be passed to the OS. The // file URL must be well-formed (GURL::is_valid() must return true); we don't // handle degenerate cases here. Returns true on success, false if it isn't a // valid file URL. On failure, *file_path will be empty. -bool FileURLToFilePath(const GURL& url, FilePath* file_path); +NET_API bool FileURLToFilePath(const GURL& url, FilePath* file_path); // Splits an input of the form <host>[":"<port>] into its consitituent parts. // Saves the result into |*host| and |*port|. If the input did not have @@ -93,57 +94,59 @@ bool FileURLToFilePath(const GURL& url, FilePath* file_path); // Returns true if the parsing was successful, false otherwise. // The returned host is NOT canonicalized, and may be invalid. If <host> is // an IPv6 literal address, the returned host includes the square brackets. -bool ParseHostAndPort(std::string::const_iterator host_and_port_begin, - std::string::const_iterator host_and_port_end, - std::string* host, - int* port); -bool ParseHostAndPort(const std::string& host_and_port, - std::string* host, - int* port); +NET_TEST bool ParseHostAndPort(std::string::const_iterator host_and_port_begin, + std::string::const_iterator host_and_port_end, + std::string* host, + int* port); +NET_TEST bool ParseHostAndPort(const std::string& host_and_port, + std::string* host, + int* port); // Returns a host:port string for the given URL. -std::string GetHostAndPort(const GURL& url); +NET_API std::string GetHostAndPort(const GURL& url); // Returns a host[:port] string for the given URL, where the port is omitted // if it is the default for the URL's scheme. -std::string GetHostAndOptionalPort(const GURL& url); +NET_TEST std::string GetHostAndOptionalPort(const GURL& url); // Returns the string representation of an address, like "192.168.0.1". // Returns empty string on failure. -std::string NetAddressToString(const struct addrinfo* net_address); -std::string NetAddressToString(const struct sockaddr* net_address, - socklen_t address_len); +NET_API std::string NetAddressToString(const struct addrinfo* net_address); +NET_API std::string NetAddressToString(const struct sockaddr* net_address, + socklen_t address_len); // Same as NetAddressToString, but additionally includes the port number. For // example: "192.168.0.1:99" or "[::1]:80". -std::string NetAddressToStringWithPort(const struct addrinfo* net_address); -std::string NetAddressToStringWithPort(const struct sockaddr* net_address, - socklen_t address_len); +NET_API std::string NetAddressToStringWithPort( + const struct addrinfo* net_address); +NET_API std::string NetAddressToStringWithPort( + const struct sockaddr* net_address, + socklen_t address_len); // Returns the hostname of the current system. Returns empty string on failure. -std::string GetHostName(); +NET_API std::string GetHostName(); // Extracts the unescaped username/password from |url|, saving the results // into |*username| and |*password|. -void GetIdentityFromURL(const GURL& url, +NET_TEST void GetIdentityFromURL(const GURL& url, string16* username, string16* password); // Returns either the host from |url|, or, if the host is empty, the full spec. -std::string GetHostOrSpecFromURL(const GURL& url); +NET_API std::string GetHostOrSpecFromURL(const GURL& url); // Return the value of the HTTP response header with name 'name'. 'headers' // should be in the format that URLRequest::GetResponseHeaders() returns. // Returns the empty string if the header is not found. -std::string GetSpecificHeader(const std::string& headers, - const std::string& name); +NET_API std::string GetSpecificHeader(const std::string& headers, + const std::string& name); // Return the value of the HTTP response header field's parameter named // 'param_name'. Returns the empty string if the parameter is not found or is // improperly formatted. -std::string GetHeaderParamValue(const std::string& header, - const std::string& param_name, - QuoteRule::Type quote_rule); +NET_API std::string GetHeaderParamValue(const std::string& header, + const std::string& param_name, + QuoteRule::Type quote_rule); // Return the filename extracted from Content-Disposition header. The following // formats are tried in order listed below: @@ -173,8 +176,8 @@ std::string GetHeaderParamValue(const std::string& header, // other caller is a unit test. Need to figure out expose this function only to // net_util_unittest. // -std::string GetFileNameFromCD(const std::string& header, - const std::string& referrer_charset); +NET_TEST std::string GetFileNameFromCD(const std::string& header, + const std::string& referrer_charset); // Converts the given host name to unicode characters. This can be called for // any host name, if the input is not IDN or is invalid in some way, we'll just @@ -191,8 +194,8 @@ std::string GetFileNameFromCD(const std::string& header, // Latin letters in the ASCII range can be mixed with a limited set of // script-language pairs (currently Han, Kana and Hangul for zh,ja and ko). // When |languages| is empty, even that mixing is not allowed. -string16 IDNToUnicode(const std::string& host, - const std::string& languages); +NET_API string16 IDNToUnicode(const std::string& host, + const std::string& languages); // Canonicalizes |host| and returns it. Also fills |host_info| with // IP address information. |host_info| must not be NULL. @@ -214,8 +217,8 @@ std::string CanonicalizeHost(const std::string& host, // // NOTE: You should only pass in hosts that have been returned from // CanonicalizeHost(), or you may not get accurate results. -bool IsCanonicalizedHostCompliant(const std::string& host, - const std::string& desired_tld); +NET_API bool IsCanonicalizedHostCompliant(const std::string& host, + const std::string& desired_tld); // Call these functions to get the html snippet for a directory listing. // The return values of both functions are in UTF-8. @@ -233,14 +236,14 @@ std::string GetDirectoryListingHeader(const string16& title); // will be used. // // Both |name| and |raw_bytes| are escaped internally. -std::string GetDirectoryListingEntry(const string16& name, - const std::string& raw_bytes, - bool is_dir, int64 size, - base::Time modified); +NET_API std::string GetDirectoryListingEntry(const string16& name, + const std::string& raw_bytes, + bool is_dir, int64 size, + base::Time modified); // If text starts with "www." it is removed, otherwise text is returned // unmodified. -string16 StripWWW(const string16& text); +NET_API string16 StripWWW(const string16& text); // Gets the filename from the raw Content-Disposition header (as read from the // network). Otherwise uses the last path component name or hostname from @@ -251,10 +254,10 @@ string16 StripWWW(const string16& text); // file:///). referrer_charset is used as one of charsets // to interpret a raw 8bit string in C-D header (after interpreting // as UTF-8 fails). See the comment for GetFilenameFromCD for more details. -string16 GetSuggestedFilename(const GURL& url, - const std::string& content_disposition, - const std::string& referrer_charset, - const string16& default_name); +NET_API string16 GetSuggestedFilename(const GURL& url, + const std::string& content_disposition, + const std::string& referrer_charset, + const string16& default_name); // Checks the given port against a list of ports which are restricted by // default. Returns true if the port is allowed, false if it is restricted. @@ -299,20 +302,21 @@ void AppendFormattedHost(const GURL& url, // into the middle of a component that was entirely removed, past the end of the // string, or into the middle of an encoding sequence), it will be set to // string16::npos. -string16 FormatUrl(const GURL& url, - const std::string& languages, - FormatUrlTypes format_types, - UnescapeRule::Type unescape_rules, - url_parse::Parsed* new_parsed, - size_t* prefix_end, - size_t* offset_for_adjustment); -string16 FormatUrlWithOffsets(const GURL& url, - const std::string& languages, - FormatUrlTypes format_types, - UnescapeRule::Type unescape_rules, - url_parse::Parsed* new_parsed, - size_t* prefix_end, - std::vector<size_t>* offsets_for_adjustment); +NET_API string16 FormatUrl(const GURL& url, + const std::string& languages, + FormatUrlTypes format_types, + UnescapeRule::Type unescape_rules, + url_parse::Parsed* new_parsed, + size_t* prefix_end, + size_t* offset_for_adjustment); +NET_API string16 FormatUrlWithOffsets( + const GURL& url, + const std::string& languages, + FormatUrlTypes format_types, + UnescapeRule::Type unescape_rules, + url_parse::Parsed* new_parsed, + size_t* prefix_end, + std::vector<size_t>* offsets_for_adjustment); // This is a convenience function for FormatUrl() with // format_types = kFormatUrlOmitAll and unescape = SPACES. This is the typical @@ -330,11 +334,11 @@ bool CanStripTrailingSlash(const GURL& url); // Strip the portions of |url| that aren't core to the network request. // - user name / password // - reference section -GURL SimplifyUrlForRequest(const GURL& url); +NET_TEST GURL SimplifyUrlForRequest(const GURL& url); -void SetExplicitlyAllowedPorts(const std::string& allowed_ports); +NET_API void SetExplicitlyAllowedPorts(const std::string& allowed_ports); -class ScopedPortException { +class NET_API ScopedPortException { public: ScopedPortException(int port); ~ScopedPortException(); @@ -366,12 +370,12 @@ static const size_t kIPv6AddressSize = 16; // Parses an IP address literal (either IPv4 or IPv6) to its numeric value. // Returns true on success and fills |ip_number| with the numeric value. -bool ParseIPLiteralToNumber(const std::string& ip_literal, - IPAddressNumber* ip_number); +NET_TEST bool ParseIPLiteralToNumber(const std::string& ip_literal, + IPAddressNumber* ip_number); // Converts an IPv4 address to an IPv4-mapped IPv6 address. // For example 192.168.0.1 would be converted to ::ffff:192.168.0.1. -IPAddressNumber ConvertIPv4NumberToIPv6Number( +NET_TEST IPAddressNumber ConvertIPv4NumberToIPv6Number( const IPAddressNumber& ipv4_number); // Parses an IP block specifier from CIDR notation to an @@ -384,9 +388,9 @@ IPAddressNumber ConvertIPv4NumberToIPv6Number( // 10.10.3.1/20 // a:b:c::/46 // ::1/128 -bool ParseCIDRBlock(const std::string& cidr_literal, - IPAddressNumber* ip_number, - size_t* prefix_length_in_bits); +NET_API bool ParseCIDRBlock(const std::string& cidr_literal, + IPAddressNumber* ip_number, + size_t* prefix_length_in_bits); // Compares an IP address to see if it falls within the specified IP block. // Returns true if it does, false otherwise. @@ -398,9 +402,9 @@ bool ParseCIDRBlock(const std::string& cidr_literal, // In cases when an IPv4 address is being compared to an IPv6 address prefix // and vice versa, the IPv4 addresses will be converted to IPv4-mapped // (IPv6) addresses. -bool IPNumberMatchesPrefix(const IPAddressNumber& ip_number, - const IPAddressNumber& ip_prefix, - size_t prefix_length_in_bits); +NET_TEST bool IPNumberMatchesPrefix(const IPAddressNumber& ip_number, + const IPAddressNumber& ip_prefix, + size_t prefix_length_in_bits); // Makes a copy of |info|. The dynamically-allocated parts are copied as well. // If |recursive| is true, chained entries via ai_next are copied too. @@ -422,12 +426,12 @@ uint16 GetPortFromAddrinfo(const struct addrinfo* info); // Same except for struct sockaddr. const uint16* GetPortFieldFromSockaddr(const struct sockaddr* address, socklen_t address_len); -int GetPortFromSockaddr(const struct sockaddr* address, - socklen_t address_len); +NET_TEST int GetPortFromSockaddr(const struct sockaddr* address, + socklen_t address_len); // Sets every addrinfo in the linked list |head| as having a port field of // |port|. -void SetPortForAllAddrinfos(struct addrinfo* head, uint16 port); +NET_TEST void SetPortForAllAddrinfos(struct addrinfo* head, uint16 port); // Returns true if |host| is one of the names (e.g. "localhost") or IP // addresses (IPv4 127.0.0.0/8 or IPv6 ::1) that indicate a loopback. @@ -435,11 +439,11 @@ void SetPortForAllAddrinfos(struct addrinfo* head, uint16 port); // Note that this function does not check for IP addresses other than // the above, although other IP addresses may point to the local // machine. -bool IsLocalhost(const std::string& host); +NET_TEST bool IsLocalhost(const std::string& host); // struct that is used by GetNetworkList() to represent a network // interface. -struct NetworkInterface { +struct NET_API NetworkInterface { NetworkInterface(); NetworkInterface(const std::string& name, const IPAddressNumber& address); ~NetworkInterface(); @@ -454,7 +458,7 @@ typedef std::vector<NetworkInterface> NetworkInterfaceList; // interface has more than one address, a separate entry is added to // the list for each address. // Can be called only on a thread that allows IO. -bool GetNetworkList(NetworkInterfaceList* networks); +NET_API bool GetNetworkList(NetworkInterfaceList* networks); } // namespace net diff --git a/net/base/network_change_notifier.h b/net/base/network_change_notifier.h index 4550eed..2683956e 100644 --- a/net/base/network_change_notifier.h +++ b/net/base/network_change_notifier.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,15 +8,16 @@ #include "base/basictypes.h" #include "base/observer_list_threadsafe.h" +#include "net/base/net_api.h" namespace net { // NetworkChangeNotifier monitors the system for network changes, and notifies // registered observers of those events. Observers may register on any thread, // and will be called back on the thread from which they registered. -class NetworkChangeNotifier { +class NET_API NetworkChangeNotifier { public: - class IPAddressObserver { + class NET_API IPAddressObserver { public: virtual ~IPAddressObserver() {} @@ -93,12 +94,10 @@ class NetworkChangeNotifier { static void RemoveIPAddressObserver(IPAddressObserver* observer); static void RemoveOnlineStateObserver(OnlineStateObserver* observer); -#ifdef UNIT_TEST // Allow unit tests to trigger notifications. static void NotifyObserversOfIPAddressChangeForTests() { NotifyObserversOfIPAddressChange(); } -#endif protected: NetworkChangeNotifier(); diff --git a/net/base/pem_tokenizer.h b/net/base/pem_tokenizer.h index b54337e..30b2cda 100644 --- a/net/base/pem_tokenizer.h +++ b/net/base/pem_tokenizer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,6 +10,7 @@ #include <vector> #include "base/string_piece.h" +#include "net/base/net_api.h" namespace net { @@ -17,7 +18,7 @@ namespace net { // using RFC 1421, Privacy Enhancement for Internet Electronic Mail. It // does not implement the full specification, most notably it does not // support the Encapsulated Header Portion described in Section 4.4. -class PEMTokenizer { +class NET_TEST PEMTokenizer { public: // Create a new PEMTokenizer that iterates through |str| searching for // instances of PEM encoded blocks that are of the |allowed_block_types|. diff --git a/net/base/registry_controlled_domain.h b/net/base/registry_controlled_domain.h index 57a4a06..49b176b 100644 --- a/net/base/registry_controlled_domain.h +++ b/net/base/registry_controlled_domain.h @@ -114,6 +114,7 @@ #include <string> #include "base/basictypes.h" +#include "net/base/net_api.h" class GURL; @@ -126,7 +127,7 @@ namespace net { struct RegistryControlledDomainServiceSingletonTraits; // This class is a singleton. -class RegistryControlledDomainService { +class NET_API RegistryControlledDomainService { public: ~RegistryControlledDomainService() { } diff --git a/net/base/sdch_filter.h b/net/base/sdch_filter.h index 1ed6077..af04f03 100644 --- a/net/base/sdch_filter.h +++ b/net/base/sdch_filter.h @@ -19,6 +19,7 @@ #include "base/memory/scoped_ptr.h" #include "net/base/filter.h" +#include "net/base/net_api.h" #include "net/base/sdch_manager.h" namespace open_vcdiff { @@ -27,7 +28,7 @@ class VCDiffStreamingDecoder; namespace net { -class SdchFilter : public Filter { +class NET_TEST SdchFilter : public Filter { public: virtual ~SdchFilter(); diff --git a/net/base/sdch_manager.h b/net/base/sdch_manager.h index 4649c41..ce23feb 100644 --- a/net/base/sdch_manager.h +++ b/net/base/sdch_manager.h @@ -30,6 +30,7 @@ #include "base/memory/scoped_ptr.h" #include "base/time.h" #include "googleurl/src/gurl.h" +#include "net/base/net_api.h" namespace net { @@ -54,7 +55,7 @@ class SdchFetcher { //------------------------------------------------------------------------------ -class SdchManager { +class NET_API SdchManager { public: // A list of errors that appeared and were either resolved, or used to turn // off sdch encoding. @@ -161,7 +162,7 @@ class SdchManager { // There is one instance of |Dictionary| for each memory-cached SDCH // dictionary. - class Dictionary : public base::RefCounted<Dictionary> { + class NET_TEST Dictionary : public base::RefCounted<Dictionary> { public: // Sdch filters can get our text to use in decoding compressed data. const std::string& text() const { return text_; } diff --git a/net/base/ssl_cert_request_info.h b/net/base/ssl_cert_request_info.h index cbff862..584154e 100644 --- a/net/base/ssl_cert_request_info.h +++ b/net/base/ssl_cert_request_info.h @@ -10,6 +10,7 @@ #include <vector> #include "base/memory/ref_counted.h" +#include "net/base/net_api.h" namespace net { @@ -17,7 +18,7 @@ class X509Certificate; // The SSLCertRequestInfo class contains the info that allows a user to // select a certificate to send to the SSL server for client authentication. -class SSLCertRequestInfo +class NET_API SSLCertRequestInfo : public base::RefCountedThreadSafe<SSLCertRequestInfo> { public: SSLCertRequestInfo(); diff --git a/net/base/ssl_cipher_suite_names.h b/net/base/ssl_cipher_suite_names.h index 9241c1b..deec529 100644 --- a/net/base/ssl_cipher_suite_names.h +++ b/net/base/ssl_cipher_suite_names.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,7 @@ #pragma once #include "base/basictypes.h" +#include "net/base/net_api.h" namespace net { @@ -16,20 +17,22 @@ namespace net { // wire and recorded at // http://www.iana.org/assignments/tls-parameters/tls-parameters.xml // If the cipher suite is unknown, the strings are set to "???". -void SSLCipherSuiteToStrings(const char** key_exchange_str, - const char** cipher_str, const char** mac_str, - uint16 cipher_suite); +NET_API void SSLCipherSuiteToStrings(const char** key_exchange_str, + const char** cipher_str, + const char** mac_str, + uint16 cipher_suite); // SSLCompressionToString returns the name of the compression algorithm // specified by |compression_method|, which is the TLS compression id. // If the algorithm is unknown, |name| is set to "???". -void SSLCompressionToString(const char** name, uint8 compression_method); +NET_API void SSLCompressionToString(const char** name, + uint8 compression_method); // SSLVersionToString returns the name of the SSL protocol version // specified by |ssl_version|, which is defined in // net/base/ssl_connection_status_flags.h. // If the version is unknown, |name| is set to "???". -void SSLVersionToString(const char** name, int ssl_version); +NET_API void SSLVersionToString(const char** name, int ssl_version); } // namespace net diff --git a/net/base/ssl_client_auth_cache.h b/net/base/ssl_client_auth_cache.h index 571461e..fe4d310 100644 --- a/net/base/ssl_client_auth_cache.h +++ b/net/base/ssl_client_auth_cache.h @@ -11,6 +11,7 @@ #include "base/memory/ref_counted.h" #include "net/base/cert_database.h" +#include "net/base/net_api.h" namespace net { @@ -23,7 +24,7 @@ class X509Certificate; // // TODO(wtc): This class is based on FtpAuthCache. We can extract the common // code to a template class. -class SSLClientAuthCache : public CertDatabase::Observer { +class NET_TEST SSLClientAuthCache : public CertDatabase::Observer { public: SSLClientAuthCache(); ~SSLClientAuthCache(); diff --git a/net/base/ssl_config_service.h b/net/base/ssl_config_service.h index 04af2fc..714d7b7 100644 --- a/net/base/ssl_config_service.h +++ b/net/base/ssl_config_service.h @@ -11,12 +11,13 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/observer_list.h" +#include "net/base/net_api.h" #include "net/base/x509_certificate.h" namespace net { // A collection of SSL-related configuration settings. -struct SSLConfig { +struct NET_API SSLConfig { // Default to revocation checking. // Default to SSL 3.0 on and TLS 1.0 on. SSLConfig(); @@ -62,7 +63,7 @@ struct SSLConfig { // TODO(wtc): move the following members to a new SSLParams structure. They // are not SSL configuration settings. - struct CertAndStatus { + struct NET_API CertAndStatus { CertAndStatus(); ~CertAndStatus(); @@ -99,10 +100,11 @@ struct SSLConfig { // does not cover setting the SSL configuration, as on some systems, the // SSLConfigService objects may not have direct access to the configuration, or // live longer than the configuration preferences. -class SSLConfigService : public base::RefCountedThreadSafe<SSLConfigService> { +class NET_API SSLConfigService + : public base::RefCountedThreadSafe<SSLConfigService> { public: // Observer is notified when SSL config settings have changed. - class Observer { + class NET_API Observer { public: // Notify observers if SSL settings have changed. We don't check all of the // data in SSLConfig, just those that qualify as a user config change. diff --git a/net/base/ssl_config_service_defaults.h b/net/base/ssl_config_service_defaults.h index 6d96a44..6e5eb1b 100644 --- a/net/base/ssl_config_service_defaults.h +++ b/net/base/ssl_config_service_defaults.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #define NET_BASE_SSL_CONFIG_SERVICE_DEFAULTS_H_ #pragma once +#include "net/base/net_api.h" #include "net/base/ssl_config_service.h" namespace net { @@ -13,7 +14,7 @@ namespace net { // This SSLConfigService always returns the default SSLConfig settings. It is // mainly useful for unittests, or for platforms that do not have a native // implementation of SSLConfigService yet. -class SSLConfigServiceDefaults : public SSLConfigService { +class NET_API SSLConfigServiceDefaults : public SSLConfigService { public: SSLConfigServiceDefaults(); diff --git a/net/base/ssl_false_start_blacklist.h b/net/base/ssl_false_start_blacklist.h index d0b10e2..5222822 100644 --- a/net/base/ssl_false_start_blacklist.h +++ b/net/base/ssl_false_start_blacklist.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #define NET_BASE_SSL_FALSE_START_BLACKLIST_H_ #include "base/basictypes.h" +#include "net/base/net_api.h" namespace net { @@ -13,7 +14,7 @@ namespace net { // to TLS False Start. Because this set is several hundred long, it's // precompiled by the code in ssl_false_start_blacklist_process.cc into a hash // table for fast lookups. -class SSLFalseStartBlacklist { +class NET_TEST SSLFalseStartBlacklist { public: // IsMember returns true if the given host is in the blacklist. // host: a DNS name in dotted form (i.e. "www.example.com") diff --git a/net/base/ssl_info.h b/net/base/ssl_info.h index 7b65a1b..5535b0c 100644 --- a/net/base/ssl_info.h +++ b/net/base/ssl_info.h @@ -9,6 +9,7 @@ #include <vector> #include "base/memory/ref_counted.h" +#include "net/base/net_api.h" #include "net/base/x509_cert_types.h" namespace net { @@ -17,7 +18,7 @@ class X509Certificate; // SSL connection info. // This is really a struct. All members are public. -class SSLInfo { +class NET_API SSLInfo { public: SSLInfo(); SSLInfo(const SSLInfo& info); diff --git a/net/base/static_cookie_policy.h b/net/base/static_cookie_policy.h index 12a78cd..2eb4d49 100644 --- a/net/base/static_cookie_policy.h +++ b/net/base/static_cookie_policy.h @@ -9,6 +9,7 @@ #include <string> #include "base/basictypes.h" +#include "net/base/net_api.h" class GURL; @@ -16,7 +17,7 @@ namespace net { // The StaticCookiePolicy class implements a static cookie policy that supports // three modes: allow all, deny all, or block third-party cookies. -class StaticCookiePolicy { +class NET_API StaticCookiePolicy { public: // Do not change the order of these types as they are persisted in // preferences. diff --git a/net/base/test_root_certs.h b/net/base/test_root_certs.h index 3fa8fcfd..16864de 100644 --- a/net/base/test_root_certs.h +++ b/net/base/test_root_certs.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include "base/lazy_instance.h" #include "build/build_config.h" +#include "net/base/net_api.h" #if defined(OS_WIN) #include <windows.h> @@ -29,7 +30,7 @@ class X509Certificate; // TestRootCerts is a helper class for unit tests that is used to // artificially mark a certificate as trusted, independent of the local // machine configuration. -class TestRootCerts { +class NET_TEST TestRootCerts { public: // Obtains the Singleton instance to the trusted certificates. static TestRootCerts* GetInstance(); diff --git a/net/base/transport_security_state.h b/net/base/transport_security_state.h index 983438c..a3f1462 100644 --- a/net/base/transport_security_state.h +++ b/net/base/transport_security_state.h @@ -14,6 +14,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" #include "base/time.h" +#include "net/base/net_api.h" #include "net/base/x509_cert_types.h" namespace net { @@ -23,7 +24,7 @@ namespace net { // Tracks which hosts have enabled *-Transport-Security. This object manages // the in-memory store. A separate object must register itself with this object // in order to persist the state to disk. -class TransportSecurityState : +class NET_API TransportSecurityState : public base::RefCountedThreadSafe<TransportSecurityState> { public: // If non-empty, |hsts_hosts| is a JSON-formatted string to treat as if it @@ -32,7 +33,7 @@ class TransportSecurityState : explicit TransportSecurityState(const std::string& hsts_hosts); // A DomainState is the information that we persist about a given domain. - struct DomainState { + struct NET_API DomainState { enum Mode { // Strict mode implies: // * We generate internal redirects from HTTP -> HTTPS. diff --git a/net/base/upload_data.h b/net/base/upload_data.h index 7ef0750..4945607 100644 --- a/net/base/upload_data.h +++ b/net/base/upload_data.h @@ -12,8 +12,9 @@ #include "base/file_path.h" #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" -#include "googleurl/src/gurl.h" #include "base/time.h" +#include "googleurl/src/gurl.h" +#include "net/base/net_api.h" namespace net { @@ -21,7 +22,7 @@ class FileStream; // Interface implemented by callers who require callbacks when new chunks // of data are added. -class ChunkCallback { +class NET_TEST ChunkCallback { public: // Invoked when a new data chunk was given for a chunked transfer upload. virtual void OnChunkAvailable() = 0; @@ -30,7 +31,7 @@ class ChunkCallback { virtual ~ChunkCallback() {} }; -class UploadData : public base::RefCounted<UploadData> { +class NET_API UploadData : public base::RefCounted<UploadData> { public: enum Type { TYPE_BYTES, @@ -42,7 +43,7 @@ class UploadData : public base::RefCounted<UploadData> { TYPE_CHUNK, }; - class Element { + class NET_API Element { public: Element(); ~Element(); diff --git a/net/base/upload_data_stream.h b/net/base/upload_data_stream.h index 83df497..c5a333d 100644 --- a/net/base/upload_data_stream.h +++ b/net/base/upload_data_stream.h @@ -7,6 +7,7 @@ #pragma once #include "base/memory/scoped_ptr.h" +#include "net/base/net_api.h" #include "net/base/upload_data.h" namespace net { @@ -14,7 +15,7 @@ namespace net { class FileStream; class IOBuffer; -class UploadDataStream { +class NET_API UploadDataStream { public: ~UploadDataStream(); @@ -62,9 +63,8 @@ class UploadDataStream { // returns true only after the data in buf() has been consumed. bool IsOnLastChunk() const; -#if defined(UNIT_TEST) + // This method is provided only to be used by unit tests. static void set_merge_chunks(bool merge) { merge_chunks_ = merge; } -#endif private: enum { kBufSize = 16384 }; diff --git a/net/base/winsock_init.h b/net/base/winsock_init.h index 3d2bcb1..034146e 100644 --- a/net/base/winsock_init.h +++ b/net/base/winsock_init.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,10 +9,12 @@ #define NET_BASE_WINSOCK_INIT_H_ #pragma once +#include "net/base/net_api.h" + namespace net { // Make sure that Winsock is initialized, calling WSAStartup if needed. -void EnsureWinsockInit(); +NET_API void EnsureWinsockInit(); } // namespace net diff --git a/net/base/x509_cert_types.h b/net/base/x509_cert_types.h index eb3ad60..1343d92 100644 --- a/net/base/x509_cert_types.h +++ b/net/base/x509_cert_types.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,6 +13,7 @@ #include <vector> #include "build/build_config.h" +#include "net/base/net_api.h" #if defined(OS_MACOSX) #include <Security/x509defs.h> @@ -45,7 +46,7 @@ class SHA1FingerprintLessThan { }; // CertPrincipal represents the issuer or subject field of an X.509 certificate. -struct CertPrincipal { +struct NET_API CertPrincipal { CertPrincipal(); explicit CertPrincipal(const std::string& name); ~CertPrincipal(); @@ -84,7 +85,7 @@ struct CertPrincipal { // This class is useful for maintaining policies about which certificates are // permitted or forbidden for a particular purpose. -class CertPolicy { +class NET_API CertPolicy { public: // The judgments this policy can reach. enum Judgment { diff --git a/net/base/x509_certificate.h b/net/base/x509_certificate.h index f6d3502..fde9ae0 100644 --- a/net/base/x509_certificate.h +++ b/net/base/x509_certificate.h @@ -15,6 +15,7 @@ #include "base/memory/ref_counted.h" #include "base/string_piece.h" #include "base/time.h" +#include "net/base/net_api.h" #include "net/base/x509_cert_types.h" #if defined(OS_WIN) @@ -48,7 +49,8 @@ class CertVerifyResult; typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; // X509Certificate represents an X.509 certificate used by SSL. -class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> { +class NET_API X509Certificate + : public base::RefCountedThreadSafe<X509Certificate> { public: // A handle to the certificate object in the underlying crypto library. // We assume that OSCertHandle is a pointer type on all platforms and |