diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-15 16:55:11 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-15 16:55:11 +0000 |
commit | ccb79730ade7f78604d42a806c4df57d6cc4fd12 (patch) | |
tree | a7bea9364abca9e63abd4638c51c006f0d2301cc | |
parent | 4a2aa3ce56a0c8cc3dcd1e45b990138ca395cb0c (diff) | |
download | chromium_src-ccb79730ade7f78604d42a806c4df57d6cc4fd12.zip chromium_src-ccb79730ade7f78604d42a806c4df57d6cc4fd12.tar.gz chromium_src-ccb79730ade7f78604d42a806c4df57d6cc4fd12.tar.bz2 |
Trivial move of content::BrowserContext to content/public.
R=avi@chromium.org
TBR=rlp@chromium.org
BUG=98716
TEST=
Review URL: http://codereview.chromium.org/8921021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114651 0039d316-1c4b-4281-b951-d872f2087c98
19 files changed, 144 insertions, 130 deletions
diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h index 03b1672..d425d9d 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h @@ -15,7 +15,7 @@ #include "chrome/browser/net/preconnect.h" // TODO: remove this. #include "chrome/browser/net/pref_proxy_config_tracker.h" #include "chrome/common/extensions/extension_constants.h" -#include "content/browser/browser_context.h" +#include "content/public/browser/browser_context.h" namespace base { class Time; diff --git a/content/browser/browser_context.h b/content/browser/browser_context.h index 2477af5..8bdb181 100644 --- a/content/browser/browser_context.h +++ b/content/browser/browser_context.h @@ -6,117 +6,8 @@ #define CONTENT_BROWSER_BROWSER_CONTEXT_H_ #pragma once -#include "base/hash_tables.h" - -namespace fileapi { -class FileSystemContext; -} - -namespace net { -class URLRequestContextGetter; -} - -namespace quota { -class QuotaManager; -} - -namespace webkit_database { -class DatabaseTracker; -} - -class ChromeAppCacheService; -class ChromeBlobStorageContext; -class DownloadManager; -class FilePath; -class GeolocationPermissionContext; -class SpeechInputPreferences; -class HostZoomMap; -class SSLHostState; -class WebKitContext; - -namespace content { - -class ResourceContext; - -// This class holds the context needed for a browsing session. -// It lives on the UI thread. -class BrowserContext { - public: - virtual ~BrowserContext() {} - - // Returns the path of the directory where this context's data is stored. - virtual FilePath GetPath() = 0; - - // Return whether this context is incognito. Default is false. - // This doesn't belong here; http://crbug.com/89628 - virtual bool IsOffTheRecord() = 0; - - // Retrieves a pointer to the SSLHostState associated with this context. - // The SSLHostState is lazily created the first time that this method is - // called. - virtual SSLHostState* GetSSLHostState() = 0; - - // Returns the DownloadManager associated with this context. - virtual DownloadManager* GetDownloadManager() = 0; - - // Returns the request context information associated with this context. Call - // this only on the UI thread, since it can send notifications that should - // happen on the UI thread. - virtual net::URLRequestContextGetter* GetRequestContext() = 0; - - // Returns the request context appropriate for the given renderer. If the - // renderer process doesn't have an associated installed app, or if the - // installed app's is_storage_isolated() returns false, this is equivalent to - // calling GetRequestContext(). - // TODO(creis): After isolated app storage is no longer an experimental - // feature, consider making this the default contract for GetRequestContext. - virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( - int renderer_child_id) = 0; - - // Returns the request context for media resources asociated with this - // context. - virtual net::URLRequestContextGetter* GetRequestContextForMedia() = 0; - - // Returns the resource context. - virtual const ResourceContext& GetResourceContext() = 0; - - // Returns the Hostname <-> Zoom Level map for this context. - virtual HostZoomMap* GetHostZoomMap() = 0; - - // Returns the geolocation permission context for this context. - virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; - - // Returns the speech input preferences. SpeechInputPreferences is a - // ref counted class, so callers should take a reference if needed. - virtual SpeechInputPreferences* GetSpeechInputPreferences() = 0; - - // Returns true if the last time this context was open it was exited cleanly. - // This doesn't belong here; http://crbug.com/90737 - virtual bool DidLastSessionExitCleanly() = 0; - - // The following getters return references to various storage related - // contexts associated with this browser context. - virtual quota::QuotaManager* GetQuotaManager() = 0; - virtual WebKitContext* GetWebKitContext() = 0; - virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; - virtual ChromeBlobStorageContext* GetBlobStorageContext() = 0; - virtual ChromeAppCacheService* GetAppCacheService() = 0; - virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; -}; - -} // namespace content - -#if defined(COMPILER_GCC) -namespace __gnu_cxx { - -template<> -struct hash<content::BrowserContext*> { - std::size_t operator()(content::BrowserContext* const& p) const { - return reinterpret_cast<std::size_t>(p); - } -}; - -} // namespace __gnu_cxx -#endif +// Deprecated header. +// TODO(joi): Remove in a follow-up change. +#include "content/public/browser/browser_context.h" #endif // CONTENT_BROWSER_BROWSER_CONTEXT_H_ diff --git a/content/browser/browsing_instance.cc b/content/browser/browsing_instance.cc index 6ba5a39..caa0f46 100644 --- a/content/browser/browsing_instance.cc +++ b/content/browser/browsing_instance.cc @@ -6,9 +6,9 @@ #include "base/command_line.h" #include "base/logging.h" -#include "content/browser/browser_context.h" #include "content/browser/site_instance.h" #include "content/browser/webui/web_ui_factory.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/content_browser_client.h" #include "content/public/common/content_switches.h" #include "content/public/common/url_constants.h" diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc index 257de76..a60aee6 100644 --- a/content/browser/download/download_manager_impl.cc +++ b/content/browser/download/download_manager_impl.cc @@ -16,7 +16,6 @@ #include "base/synchronization/lock.h" #include "base/sys_string_conversions.h" #include "build/build_config.h" -#include "content/browser/browser_context.h" #include "content/browser/download/download_create_info.h" #include "content/browser/download/download_file_manager.h" #include "content/browser/download/download_id_factory.h" @@ -28,6 +27,7 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/download_manager_delegate.h" diff --git a/content/browser/download/download_request_handle.cc b/content/browser/download/download_request_handle.cc index 4f6b967..686bd92 100644 --- a/content/browser/download/download_request_handle.cc +++ b/content/browser/download/download_request_handle.cc @@ -6,10 +6,10 @@ #include "base/bind.h" #include "base/stringprintf.h" -#include "content/browser/browser_context.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" using content::BrowserThread; diff --git a/content/browser/download/drag_download_file.cc b/content/browser/download/drag_download_file.cc index cf245e5..505c266 100644 --- a/content/browser/download/drag_download_file.cc +++ b/content/browser/download/drag_download_file.cc @@ -7,11 +7,11 @@ #include "base/bind.h" #include "base/file_util.h" #include "base/message_loop.h" -#include "content/browser/browser_context.h" #include "content/browser/download/download_item.h" #include "content/browser/download/download_stats.h" #include "content/browser/download/download_types.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "net/base/file_stream.h" diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index bc8bbb5..1f58901 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -18,7 +18,6 @@ #include "base/sys_string_conversions.h" #include "base/threading/thread.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_context.h" #include "content/browser/download/download_file_manager.h" #include "content/browser/download/download_item_impl.h" #include "content/browser/download/download_manager.h" @@ -32,6 +31,7 @@ #include "content/browser/resource_context.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/download_manager_delegate.h" diff --git a/content/browser/renderer_host/pepper_file_message_filter.cc b/content/browser/renderer_host/pepper_file_message_filter.cc index 4798339..44a796c 100644 --- a/content/browser/renderer_host/pepper_file_message_filter.cc +++ b/content/browser/renderer_host/pepper_file_message_filter.cc @@ -9,10 +9,10 @@ #include "base/file_util.h" #include "base/platform_file.h" #include "base/process_util.h" -#include "content/browser/browser_context.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/common/pepper_file_messages.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "ipc/ipc_platform_file.h" #include "webkit/plugins/ppapi/file_path.h" diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index ba5619a..e32933e 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -15,7 +15,6 @@ #include "base/threading/thread.h" #include "base/threading/worker_pool.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_context.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/download/download_stats.h" #include "content/browser/download/download_types.h" @@ -32,6 +31,7 @@ #include "content/common/child_process_messages.h" #include "content/common/desktop_notification_messages.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/user_metrics.h" diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 1230458..28845a6 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -40,7 +40,6 @@ #include "base/tracked_objects.h" #include "content/browser/appcache/appcache_dispatcher_host.h" #include "content/browser/browser_child_process_host.h" -#include "content/browser/browser_context.h" #include "content/browser/browser_main.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/device_orientation/message_filter.h" @@ -86,10 +85,12 @@ #include "content/common/child_process_messages.h" #include "content/common/gpu/gpu_messages.h" #include "content/public/browser/notification_service.h" -#include "content/public/browser/user_metrics.h" #include "content/common/resource_messages.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/content_browser_client.h" +#include "content/public/browser/notification_service.h" +#include "content/public/browser/user_metrics.h" #include "content/public/common/content_constants.h" #include "content/public/common/content_switches.h" #include "content/public/common/process_type.h" diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index d38ce05..4ff4c11 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -17,7 +17,6 @@ #include "base/time.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "content/browser/browser_context.h" #include "content/browser/browser_message_filter.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/cross_site_request_manager.h" @@ -34,6 +33,7 @@ #include "content/common/speech_input_messages.h" #include "content/common/swapped_out_messages.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/notification_details.h" diff --git a/content/browser/ssl/ssl_policy_backend.cc b/content/browser/ssl/ssl_policy_backend.cc index ff6cdd3..56bf076 100644 --- a/content/browser/ssl/ssl_policy_backend.cc +++ b/content/browser/ssl/ssl_policy_backend.cc @@ -4,9 +4,9 @@ #include "content/browser/ssl/ssl_policy_backend.h" -#include "content/browser/browser_context.h" #include "content/browser/ssl/ssl_host_state.h" #include "content/browser/tab_contents/navigation_controller.h" +#include "content/public/browser/browser_context.h" SSLPolicyBackend::SSLPolicyBackend(NavigationController* controller) : ssl_host_state_(controller->browser_context()->GetSSLHostState()), diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc index b2718ea..b3e80ceb 100644 --- a/content/browser/tab_contents/navigation_controller.cc +++ b/content/browser/tab_contents/navigation_controller.cc @@ -10,7 +10,6 @@ #include "base/string_util.h" #include "base/time.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_context.h" #include "content/browser/browser_url_handler.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/in_process_webkit/session_storage_namespace.h" @@ -22,6 +21,7 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_delegate.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/user_metrics.h" diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 5e326ec..a3ffb43 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -13,7 +13,6 @@ #include "base/string_util.h" #include "base/time.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_context.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/debugger/devtools_manager_impl.h" #include "content/browser/download/download_manager.h" @@ -40,6 +39,7 @@ #include "content/browser/webui/web_ui_factory.h" #include "content/common/intents_messages.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/devtools_agent_host_registry.h" #include "content/public/browser/notification_service.h" diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 49526ea..20a7299 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -25,6 +25,7 @@ '<(INTERMEDIATE_DIR)', ], 'sources': [ + 'public/browser/browser_context.h', 'public/browser/browser_main_parts.h', 'public/browser/browser_shutdown.h', 'public/browser/browser_thread.h', @@ -85,7 +86,6 @@ 'browser/appcache/chrome_appcache_service.h', 'browser/browser_child_process_host.cc', 'browser/browser_child_process_host.h', - 'browser/browser_context.h', 'browser/browser_main.cc', 'browser/browser_main.h', 'browser/browser_main_loop.cc', diff --git a/content/public/browser/browser_context.h b/content/public/browser/browser_context.h new file mode 100644 index 0000000..32a2bf0 --- /dev/null +++ b/content/public/browser/browser_context.h @@ -0,0 +1,122 @@ +// 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. + +#ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ +#define CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ +#pragma once + +#include "base/hash_tables.h" + +namespace fileapi { +class FileSystemContext; +} + +namespace net { +class URLRequestContextGetter; +} + +namespace quota { +class QuotaManager; +} + +namespace webkit_database { +class DatabaseTracker; +} + +class ChromeAppCacheService; +class ChromeBlobStorageContext; +class DownloadManager; +class FilePath; +class GeolocationPermissionContext; +class SpeechInputPreferences; +class HostZoomMap; +class SSLHostState; +class WebKitContext; + +namespace content { + +class ResourceContext; + +// This class holds the context needed for a browsing session. +// It lives on the UI thread. +class BrowserContext { + public: + virtual ~BrowserContext() {} + + // Returns the path of the directory where this context's data is stored. + virtual FilePath GetPath() = 0; + + // Return whether this context is incognito. Default is false. + // This doesn't belong here; http://crbug.com/89628 + virtual bool IsOffTheRecord() = 0; + + // Retrieves a pointer to the SSLHostState associated with this context. + // The SSLHostState is lazily created the first time that this method is + // called. + virtual SSLHostState* GetSSLHostState() = 0; + + // Returns the DownloadManager associated with this context. + virtual DownloadManager* GetDownloadManager() = 0; + + // Returns the request context information associated with this context. Call + // this only on the UI thread, since it can send notifications that should + // happen on the UI thread. + virtual net::URLRequestContextGetter* GetRequestContext() = 0; + + // Returns the request context appropriate for the given renderer. If the + // renderer process doesn't have an associated installed app, or if the + // installed app's is_storage_isolated() returns false, this is equivalent to + // calling GetRequestContext(). + // TODO(creis): After isolated app storage is no longer an experimental + // feature, consider making this the default contract for GetRequestContext. + virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( + int renderer_child_id) = 0; + + // Returns the request context for media resources asociated with this + // context. + virtual net::URLRequestContextGetter* GetRequestContextForMedia() = 0; + + // Returns the resource context. + virtual const ResourceContext& GetResourceContext() = 0; + + // Returns the Hostname <-> Zoom Level map for this context. + virtual HostZoomMap* GetHostZoomMap() = 0; + + // Returns the geolocation permission context for this context. + virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; + + // Returns the speech input preferences. SpeechInputPreferences is a + // ref counted class, so callers should take a reference if needed. + virtual SpeechInputPreferences* GetSpeechInputPreferences() = 0; + + // Returns true if the last time this context was open it was exited cleanly. + // This doesn't belong here; http://crbug.com/90737 + virtual bool DidLastSessionExitCleanly() = 0; + + // The following getters return references to various storage related + // contexts associated with this browser context. + virtual quota::QuotaManager* GetQuotaManager() = 0; + virtual WebKitContext* GetWebKitContext() = 0; + virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; + virtual ChromeBlobStorageContext* GetBlobStorageContext() = 0; + virtual ChromeAppCacheService* GetAppCacheService() = 0; + virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; +}; + +} // namespace content + +#if defined(COMPILER_GCC) +namespace __gnu_cxx { + +template<> +struct hash<content::BrowserContext*> { + std::size_t operator()(content::BrowserContext* const& p) const { + return reinterpret_cast<std::size_t>(p); + } +}; + +} // namespace __gnu_cxx +#endif + +#endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ diff --git a/content/shell/shell_browser_context.h b/content/shell/shell_browser_context.h index 55ee135..dafba7b 100644 --- a/content/shell/shell_browser_context.h +++ b/content/shell/shell_browser_context.h @@ -10,7 +10,7 @@ #include "base/file_path.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "content/browser/browser_context.h" +#include "content/public/browser/browser_context.h" class DownloadIdFactory; class DownloadManager; diff --git a/content/shell/shell_download_manager_delegate.cc b/content/shell/shell_download_manager_delegate.cc index 4660f0b..d5c9cdd 100644 --- a/content/shell/shell_download_manager_delegate.cc +++ b/content/shell/shell_download_manager_delegate.cc @@ -14,10 +14,10 @@ #include "base/logging.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_context.h" #include "content/browser/download/download_manager.h" #include "content/browser/download/download_state_info.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "net/base/net_util.h" diff --git a/content/test/test_browser_context.h b/content/test/test_browser_context.h index 71c4114..6772af2d 100644 --- a/content/test/test_browser_context.h +++ b/content/test/test_browser_context.h @@ -11,7 +11,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" #include "base/scoped_temp_dir.h" -#include "content/browser/browser_context.h" +#include "content/public/browser/browser_context.h" class WebKitContext; |