Skip to content

Commit

Permalink
Move http_server_properties_manager from chrome/browser/net to net/http.
Browse files Browse the repository at this point in the history
BUG=

Review URL: https://codereview.chromium.org/378823002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282319 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
mef@chromium.org committed Jul 10, 2014
1 parent 8ca02c0 commit ad66db1
Show file tree
Hide file tree
Showing 13 changed files with 453 additions and 387 deletions.
32 changes: 32 additions & 0 deletions chrome/browser/net/http_server_properties_manager_factory.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2014 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.

#include "chrome/browser/net/http_server_properties_manager_factory.h"

#include "chrome/common/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "content/public/browser/browser_thread.h"
#include "net/http/http_server_properties_manager.h"

namespace chrome_browser_net {

/* static */
net::HttpServerPropertiesManager*
HttpServerPropertiesManagerFactory::CreateManager(PrefService* pref_service) {
using content::BrowserThread;
return new net::HttpServerPropertiesManager(
pref_service,
prefs::kHttpServerProperties,
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
}

/* static */
void HttpServerPropertiesManagerFactory::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterDictionaryPref(
prefs::kHttpServerProperties,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
}

} // namespace chrome_browser_net
39 changes: 39 additions & 0 deletions chrome/browser/net/http_server_properties_manager_factory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2014 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.

#ifndef CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_FACTORY_H_
#define CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_FACTORY_H_

#include "base/macros.h"

class PrefService;

namespace net {
class HttpServerPropertiesManager;
}

namespace user_prefs {
class PrefRegistrySyncable;
}

namespace chrome_browser_net {

////////////////////////////////////////////////////////////////////////////////
// Class for registration and creation of HttpServerPropertiesManager
class HttpServerPropertiesManagerFactory {
public:
// Create an instance of HttpServerPropertiesManager.
static net::HttpServerPropertiesManager* CreateManager(
PrefService* pref_service);

// Register prefs for properties managed by HttpServerPropertiesManager.
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);

private:
DISALLOW_IMPLICIT_CONSTRUCTORS(HttpServerPropertiesManagerFactory);
};

} // namespace chrome_browser_net

#endif // CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_FACTORY_H_
5 changes: 3 additions & 2 deletions chrome/browser/prefs/browser_prefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "chrome/browser/media/media_stream_devices_controller.h"
#include "chrome/browser/metrics/chrome_metrics_service_client.h"
#include "chrome/browser/metrics/variations/variations_service.h"
#include "chrome/browser/net/http_server_properties_manager.h"
#include "chrome/browser/net/http_server_properties_manager_factory.h"
#include "chrome/browser/net/net_pref_observer.h"
#include "chrome/browser/net/prediction_options.h"
#include "chrome/browser/net/predictor.h"
Expand Down Expand Up @@ -96,6 +96,7 @@
#include "components/translate/core/browser/translate_prefs.h"
#include "content/public/browser/render_process_host.h"
#include "extensions/browser/extension_prefs.h"
#include "net/http/http_server_properties_manager.h"

#if defined(ENABLE_AUTOFILL_DIALOG)
#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
Expand Down Expand Up @@ -352,7 +353,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
sync_driver::SyncPrefs::RegisterProfilePrefs(registry);
ChromeContentBrowserClient::RegisterProfilePrefs(registry);
ChromeVersionService::RegisterProfilePrefs(registry);
chrome_browser_net::HttpServerPropertiesManager::RegisterProfilePrefs(
chrome_browser_net::HttpServerPropertiesManagerFactory::RegisterProfilePrefs(
registry);
chrome_browser_net::Predictor::RegisterProfilePrefs(registry);
chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry);
Expand Down
10 changes: 6 additions & 4 deletions chrome/browser/profiles/profile_impl_io_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "chrome/browser/net/chrome_network_delegate.h"
#include "chrome/browser/net/connect_interceptor.h"
#include "chrome/browser/net/cookie_store_util.h"
#include "chrome/browser/net/http_server_properties_manager.h"
#include "chrome/browser/net/http_server_properties_manager_factory.h"
#include "chrome/browser/net/predictor.h"
#include "chrome/browser/net/sqlite_server_bound_cert_store.h"
#include "chrome/browser/profiles/profile.h"
Expand All @@ -45,6 +45,7 @@
#include "net/base/sdch_manager.h"
#include "net/ftp/ftp_network_layer.h"
#include "net/http/http_cache.h"
#include "net/http/http_server_properties_manager.h"
#include "net/ssl/server_bound_cert_service.h"
#include "net/url_request/url_request_job_factory_impl.h"
#include "webkit/browser/quota/special_storage_policy.h"
Expand Down Expand Up @@ -103,7 +104,7 @@ ProfileImplIOData::Handle::~Handle() {
}

if (io_data_->http_server_properties_manager_)
io_data_->http_server_properties_manager_->ShutdownOnUIThread();
io_data_->http_server_properties_manager_->ShutdownOnPrefThread();
io_data_->ShutdownOnUIThread();
}

Expand Down Expand Up @@ -313,7 +314,8 @@ void ProfileImplIOData::Handle::LazyInitialize() const {
initialized_ = true;
PrefService* pref_service = profile_->GetPrefs();
io_data_->http_server_properties_manager_ =
new chrome_browser_net::HttpServerPropertiesManager(pref_service);
chrome_browser_net::HttpServerPropertiesManagerFactory::CreateManager(
pref_service);
io_data_->set_http_server_properties(
scoped_ptr<net::HttpServerProperties>(
io_data_->http_server_properties_manager_));
Expand Down Expand Up @@ -377,7 +379,7 @@ void ProfileImplIOData::InitializeInternal(
ApplyProfileParamsToContext(main_context);

if (http_server_properties_manager_)
http_server_properties_manager_->InitializeOnIOThread();
http_server_properties_manager_->InitializeOnNetworkThread();

main_context->set_transport_security_state(transport_security_state());

Expand Down
5 changes: 2 additions & 3 deletions chrome/browser/profiles/profile_impl_io_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "content/public/browser/cookie_store_factory.h"

namespace chrome_browser_net {
class HttpServerPropertiesManager;
class Predictor;
} // namespace chrome_browser_net

Expand All @@ -29,6 +28,7 @@ class DomainReliabilityMonitor;
namespace net {
class FtpTransactionFactory;
class HttpServerProperties;
class HttpServerPropertiesManager;
class HttpTransactionFactory;
class SDCHManager;
} // namespace net
Expand Down Expand Up @@ -211,8 +211,7 @@ class ProfileImplIOData : public ProfileIOData {

// Same as |ProfileIOData::http_server_properties_|, owned there to maintain
// destruction ordering.
mutable chrome_browser_net::HttpServerPropertiesManager*
http_server_properties_manager_;
mutable net::HttpServerPropertiesManager* http_server_properties_manager_;

mutable scoped_ptr<chrome_browser_net::Predictor> predictor_;

Expand Down
4 changes: 2 additions & 2 deletions chrome/chrome_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,8 @@
'browser/net/dns_probe_service.h',
'browser/net/evicted_domain_cookie_counter.cc',
'browser/net/evicted_domain_cookie_counter.h',
'browser/net/http_server_properties_manager.cc',
'browser/net/http_server_properties_manager.h',
'browser/net/http_server_properties_manager_factory.cc',
'browser/net/http_server_properties_manager_factory.h',
'browser/net/net_error_tab_helper.cc',
'browser/net/net_error_tab_helper.h',
'browser/net/net_log_temp_file.cc',
Expand Down
1 change: 0 additions & 1 deletion chrome/chrome_tests_unit.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,6 @@
'browser/net/dns_probe_service_unittest.cc',
'browser/net/evicted_domain_cookie_counter_unittest.cc',
'browser/net/firefox_proxy_settings_unittest.cc',
'browser/net/http_server_properties_manager_unittest.cc',
'browser/net/net_error_tab_helper_unittest.cc',
'browser/net/net_log_temp_file_unittest.cc',
'browser/net/network_stats_unittest.cc',
Expand Down
4 changes: 3 additions & 1 deletion net/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ component("net") {
":net_resources",
"//base",
"//base:i18n",
"//base:prefs",
"//base/third_party/dynamic_annotations",
"//crypto",
"//crypto:platform",
Expand Down Expand Up @@ -522,7 +523,7 @@ component("net") {
include_dirs = [ "//third_party/openssl" ]
}
}

if (use_icu_alternatives_on_android) {
deps -= [
"//base:i18n",
Expand Down Expand Up @@ -1065,6 +1066,7 @@ test("net_unittests") {
":test_support",
"//base",
"//base:i18n",
"//base:prefs_test_support",
"//base/allocator",
"//base/third_party/dynamic_annotations",
"//crypto",
Expand Down
Loading

0 comments on commit ad66db1

Please sign in to comment.