summaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
authorerg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-11 07:25:40 +0000
committererg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-11 07:25:40 +0000
commitf48b943fa405abdbff3278bd6d29bde6d1ef103b (patch)
treef3ad7676f0e484e5c783ef080cfdfea5cab32f0e /net/http
parente0392155775eb3dc066d51e78a320a10627a74ad (diff)
downloadchromium_src-f48b943fa405abdbff3278bd6d29bde6d1ef103b.zip
chromium_src-f48b943fa405abdbff3278bd6d29bde6d1ef103b.tar.gz
chromium_src-f48b943fa405abdbff3278bd6d29bde6d1ef103b.tar.bz2
More reordering the methods in headers in net/.
BUG=68682 TEST=compiles Review URL: http://codereview.chromium.org/6186005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r--net/http/http_auth_handler_factory.cc80
-rw-r--r--net/http/http_auth_handler_factory.h20
-rw-r--r--net/http/http_cache.cc46
-rw-r--r--net/http/http_cache.h22
-rw-r--r--net/http/http_response_headers.cc11
-rw-r--r--net/http/http_response_headers.h11
6 files changed, 96 insertions, 94 deletions
diff --git a/net/http/http_auth_handler_factory.cc b/net/http/http_auth_handler_factory.cc
index 7d34cff..8cf7d3e 100644
--- a/net/http/http_auth_handler_factory.cc
+++ b/net/http/http_auth_handler_factory.cc
@@ -79,6 +79,46 @@ bool IsSupportedScheme(const std::vector<std::string>& supported_schemes,
} // namespace
+HttpAuthHandlerRegistryFactory::HttpAuthHandlerRegistryFactory() {
+}
+
+HttpAuthHandlerRegistryFactory::~HttpAuthHandlerRegistryFactory() {
+ STLDeleteContainerPairSecondPointers(factory_map_.begin(),
+ factory_map_.end());
+}
+
+void HttpAuthHandlerRegistryFactory::SetURLSecurityManager(
+ const std::string& scheme,
+ URLSecurityManager* security_manager) {
+ HttpAuthHandlerFactory* factory = GetSchemeFactory(scheme);
+ if (factory)
+ factory->set_url_security_manager(security_manager);
+}
+
+void HttpAuthHandlerRegistryFactory::RegisterSchemeFactory(
+ const std::string& scheme,
+ HttpAuthHandlerFactory* factory) {
+ std::string lower_scheme = StringToLowerASCII(scheme);
+ FactoryMap::iterator it = factory_map_.find(lower_scheme);
+ if (it != factory_map_.end()) {
+ delete it->second;
+ }
+ if (factory)
+ factory_map_[lower_scheme] = factory;
+ else
+ factory_map_.erase(it);
+}
+
+HttpAuthHandlerFactory* HttpAuthHandlerRegistryFactory::GetSchemeFactory(
+ const std::string& scheme) const {
+ std::string lower_scheme = StringToLowerASCII(scheme);
+ FactoryMap::const_iterator it = factory_map_.find(lower_scheme);
+ if (it == factory_map_.end()) {
+ return NULL; // |scheme| is not registered.
+ }
+ return it->second;
+}
+
// static
HttpAuthHandlerRegistryFactory* HttpAuthHandlerRegistryFactory::Create(
const std::vector<std::string>& supported_schemes,
@@ -124,36 +164,6 @@ HttpAuthHandlerRegistryFactory* HttpAuthHandlerRegistryFactory::Create(
return registry_factory;
}
-HttpAuthHandlerRegistryFactory::HttpAuthHandlerRegistryFactory() {
-}
-
-HttpAuthHandlerRegistryFactory::~HttpAuthHandlerRegistryFactory() {
- STLDeleteContainerPairSecondPointers(factory_map_.begin(),
- factory_map_.end());
-}
-
-void HttpAuthHandlerRegistryFactory::SetURLSecurityManager(
- const std::string& scheme,
- URLSecurityManager* security_manager) {
- HttpAuthHandlerFactory* factory = GetSchemeFactory(scheme);
- if (factory)
- factory->set_url_security_manager(security_manager);
-}
-
-void HttpAuthHandlerRegistryFactory::RegisterSchemeFactory(
- const std::string& scheme,
- HttpAuthHandlerFactory* factory) {
- std::string lower_scheme = StringToLowerASCII(scheme);
- FactoryMap::iterator it = factory_map_.find(lower_scheme);
- if (it != factory_map_.end()) {
- delete it->second;
- }
- if (factory)
- factory_map_[lower_scheme] = factory;
- else
- factory_map_.erase(it);
-}
-
int HttpAuthHandlerRegistryFactory::CreateAuthHandler(
HttpAuth::ChallengeTokenizer* challenge,
HttpAuth::Target target,
@@ -178,14 +188,4 @@ int HttpAuthHandlerRegistryFactory::CreateAuthHandler(
digest_nonce_count, net_log, handler);
}
-HttpAuthHandlerFactory* HttpAuthHandlerRegistryFactory::GetSchemeFactory(
- const std::string& scheme) const {
- std::string lower_scheme = StringToLowerASCII(scheme);
- FactoryMap::const_iterator it = factory_map_.find(lower_scheme);
- if (it == factory_map_.end()) {
- return NULL; // |scheme| is not registered.
- }
- return it->second;
-}
-
} // namespace net
diff --git a/net/http/http_auth_handler_factory.h b/net/http/http_auth_handler_factory.h
index 2879aed..a56d5e1 100644
--- a/net/http/http_auth_handler_factory.h
+++ b/net/http/http_auth_handler_factory.h
@@ -152,16 +152,6 @@ class HttpAuthHandlerRegistryFactory : public HttpAuthHandlerFactory {
// registry factory is destroyed.
HttpAuthHandlerFactory* GetSchemeFactory(const std::string& scheme) const;
- // Creates an auth handler by dispatching out to the registered factories
- // based on the first token in |challenge|.
- virtual int CreateAuthHandler(HttpAuth::ChallengeTokenizer* challenge,
- HttpAuth::Target target,
- const GURL& origin,
- CreateReason reason,
- int digest_nonce_count,
- const BoundNetLog& net_log,
- scoped_ptr<HttpAuthHandler>* handler);
-
// Creates an HttpAuthHandlerRegistryFactory.
//
// |supported_schemes| is a list of authentication schemes. Valid values
@@ -189,6 +179,16 @@ class HttpAuthHandlerRegistryFactory : public HttpAuthHandlerFactory {
bool negotiate_disable_cname_lookup,
bool negotiate_enable_port);
+ // Creates an auth handler by dispatching out to the registered factories
+ // based on the first token in |challenge|.
+ virtual int CreateAuthHandler(HttpAuth::ChallengeTokenizer* challenge,
+ HttpAuth::Target target,
+ const GURL& origin,
+ CreateReason reason,
+ int digest_nonce_count,
+ const BoundNetLog& net_log,
+ scoped_ptr<HttpAuthHandler>* handler);
+
private:
typedef std::map<std::string, HttpAuthHandlerFactory*> FactoryMap;
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 5710491..3ef5a7b7 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -383,29 +383,6 @@ disk_cache::Backend* HttpCache::GetCurrentBackend() {
return disk_cache_.get();
}
-int HttpCache::CreateTransaction(scoped_ptr<HttpTransaction>* trans) {
- // Do lazy initialization of disk cache if needed.
- if (!disk_cache_.get())
- CreateBackend(NULL, NULL); // We don't care about the result.
-
- trans->reset(new HttpCache::Transaction(this));
- return OK;
-}
-
-HttpCache* HttpCache::GetCache() {
- return this;
-}
-
-HttpNetworkSession* HttpCache::GetSession() {
- net::HttpNetworkLayer* network =
- static_cast<net::HttpNetworkLayer*>(network_layer_.get());
- return network->GetSession();
-}
-
-void HttpCache::Suspend(bool suspend) {
- network_layer_->Suspend(suspend);
-}
-
// static
bool HttpCache::ParseResponseInfo(const char* data, int len,
HttpResponseInfo* response_info,
@@ -442,6 +419,29 @@ void HttpCache::CloseCurrentConnections() {
}
}
+int HttpCache::CreateTransaction(scoped_ptr<HttpTransaction>* trans) {
+ // Do lazy initialization of disk cache if needed.
+ if (!disk_cache_.get())
+ CreateBackend(NULL, NULL); // We don't care about the result.
+
+ trans->reset(new HttpCache::Transaction(this));
+ return OK;
+}
+
+HttpCache* HttpCache::GetCache() {
+ return this;
+}
+
+HttpNetworkSession* HttpCache::GetSession() {
+ net::HttpNetworkLayer* network =
+ static_cast<net::HttpNetworkLayer*>(network_layer_.get());
+ return network->GetSession();
+}
+
+void HttpCache::Suspend(bool suspend) {
+ network_layer_->Suspend(suspend);
+}
+
//-----------------------------------------------------------------------------
int HttpCache::CreateBackend(disk_cache::Backend** backend,
diff --git a/net/http/http_cache.h b/net/http/http_cache.h
index 0641ca4..3438ba7 100644
--- a/net/http/http_cache.h
+++ b/net/http/http_cache.h
@@ -60,8 +60,6 @@ class HttpCache : public HttpTransactionFactory,
public base::SupportsWeakPtr<HttpCache>,
public base::NonThreadSafe {
public:
- ~HttpCache();
-
// The cache mode of operation.
enum Mode {
// Normal mode just behaves like a standard web cache.
@@ -145,6 +143,8 @@ class HttpCache : public HttpTransactionFactory,
NetLog* net_log,
BackendFactory* backend_factory);
+ ~HttpCache();
+
HttpTransactionFactory* network_layer() { return network_layer_.get(); }
// Retrieves the cache backend for this HttpCache instance. If the backend
@@ -157,12 +157,6 @@ class HttpCache : public HttpTransactionFactory,
// Returns the current backend (can be NULL).
disk_cache::Backend* GetCurrentBackend();
- // HttpTransactionFactory implementation:
- virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans);
- virtual HttpCache* GetCache();
- virtual HttpNetworkSession* GetSession();
- virtual void Suspend(bool suspend);
-
// Given a header data blob, convert it to a response info object.
static bool ParseResponseInfo(const char* data, int len,
HttpResponseInfo* response_info,
@@ -184,6 +178,12 @@ class HttpCache : public HttpTransactionFactory,
// immediately, but they will not be reusable. This is for debugging.
void CloseCurrentConnections();
+ // HttpTransactionFactory implementation:
+ virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans);
+ virtual HttpCache* GetCache();
+ virtual HttpNetworkSession* GetSession();
+ virtual void Suspend(bool suspend);
+
protected:
// Disk cache entry data indices.
enum {
@@ -211,15 +211,15 @@ class HttpCache : public HttpTransactionFactory,
typedef std::list<WorkItem*> WorkItemList;
struct ActiveEntry {
+ explicit ActiveEntry(disk_cache::Entry* entry);
+ ~ActiveEntry();
+
disk_cache::Entry* disk_entry;
Transaction* writer;
TransactionList readers;
TransactionList pending_queue;
bool will_process_pending_queue;
bool doomed;
-
- explicit ActiveEntry(disk_cache::Entry* entry);
- ~ActiveEntry();
};
typedef base::hash_map<std::string, ActiveEntry*> ActiveEntriesMap;
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index c2d098c..85df8d5 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -87,6 +87,17 @@ bool ShouldUpdateHeader(const std::string::const_iterator& name_begin,
} // namespace
+struct HttpResponseHeaders::ParsedHeader {
+ // A header "continuation" contains only a subsequent value for the
+ // preceding header. (Header values are comma separated.)
+ bool is_continuation() const { return name_begin == name_end; }
+
+ std::string::const_iterator name_begin;
+ std::string::const_iterator name_end;
+ std::string::const_iterator value_begin;
+ std::string::const_iterator value_end;
+};
+
//-----------------------------------------------------------------------------
HttpResponseHeaders::HttpResponseHeaders(const std::string& raw_input)
diff --git a/net/http/http_response_headers.h b/net/http/http_response_headers.h
index 2b556b3..df92c23 100644
--- a/net/http/http_response_headers.h
+++ b/net/http/http_response_headers.h
@@ -254,16 +254,7 @@ class HttpResponseHeaders
typedef base::hash_set<std::string> HeaderSet;
// The members of this structure point into raw_headers_.
- struct ParsedHeader {
- std::string::const_iterator name_begin;
- std::string::const_iterator name_end;
- std::string::const_iterator value_begin;
- std::string::const_iterator value_end;
-
- // A header "continuation" contains only a subsequent value for the
- // preceding header. (Header values are comma separated.)
- bool is_continuation() const { return name_begin == name_end; }
- };
+ struct ParsedHeader;
typedef std::vector<ParsedHeader> HeaderList;
HttpResponseHeaders();