Move Webstore URL concepts to //extensions and out
[chromium-blink-merge.git] / chrome / browser / profiles / off_the_record_profile_impl.h
blob750d51932359428eac856b1005fbb61a6f3f69e8
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_PROFILES_OFF_THE_RECORD_PROFILE_IMPL_H_
6 #define CHROME_BROWSER_PROFILES_OFF_THE_RECORD_PROFILE_IMPL_H_
8 #include <string>
10 #include "base/gtest_prod_util.h"
11 #include "chrome/browser/profiles/off_the_record_profile_io_data.h"
12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser_list.h"
14 #include "components/domain_reliability/clear_mode.h"
15 #include "content/public/browser/content_browser_client.h"
16 #include "content/public/browser/host_zoom_map.h"
18 using base::Time;
19 using base::TimeDelta;
21 class PrefServiceSyncable;
23 ////////////////////////////////////////////////////////////////////////////////
25 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile
26 // to make it suitable for the incognito mode.
28 // Note: This class is a leaf class and is not intended for subclassing.
29 // Providing this header file is for unit testing.
31 ////////////////////////////////////////////////////////////////////////////////
32 class OffTheRecordProfileImpl : public Profile {
33 public:
34 explicit OffTheRecordProfileImpl(Profile* real_profile);
35 virtual ~OffTheRecordProfileImpl();
36 void Init();
38 // Profile implementation.
39 virtual std::string GetProfileName() OVERRIDE;
40 virtual ProfileType GetProfileType() const OVERRIDE;
41 virtual Profile* GetOffTheRecordProfile() OVERRIDE;
42 virtual void DestroyOffTheRecordProfile() OVERRIDE;
43 virtual bool HasOffTheRecordProfile() OVERRIDE;
44 virtual Profile* GetOriginalProfile() OVERRIDE;
45 virtual bool IsSupervised() OVERRIDE;
46 virtual ExtensionSpecialStoragePolicy*
47 GetExtensionSpecialStoragePolicy() OVERRIDE;
48 virtual PrefService* GetPrefs() OVERRIDE;
49 virtual PrefService* GetOffTheRecordPrefs() OVERRIDE;
50 virtual net::URLRequestContextGetter*
51 GetRequestContextForExtensions() OVERRIDE;
52 virtual net::URLRequestContextGetter* CreateRequestContext(
53 content::ProtocolHandlerMap* protocol_handlers,
54 content::URLRequestInterceptorScopedVector request_interceptors) OVERRIDE;
55 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
56 const base::FilePath& partition_path,
57 bool in_memory,
58 content::ProtocolHandlerMap* protocol_handlers,
59 content::URLRequestInterceptorScopedVector request_interceptors) OVERRIDE;
60 virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE;
61 virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE;
62 virtual bool IsSameProfile(Profile* profile) OVERRIDE;
63 virtual Time GetStartTime() const OVERRIDE;
64 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE;
65 virtual history::TopSites* GetTopSites() OVERRIDE;
66 virtual base::FilePath last_selected_directory() OVERRIDE;
67 virtual void set_last_selected_directory(const base::FilePath& path) OVERRIDE;
68 virtual bool WasCreatedByVersionOrLater(const std::string& version) OVERRIDE;
69 virtual void SetExitType(ExitType exit_type) OVERRIDE;
70 virtual ExitType GetLastSessionExitType() OVERRIDE;
72 #if defined(OS_CHROMEOS)
73 virtual void ChangeAppLocale(const std::string& locale,
74 AppLocaleChangedVia) OVERRIDE;
75 virtual void OnLogin() OVERRIDE;
76 virtual void InitChromeOSPreferences() OVERRIDE;
77 #endif // defined(OS_CHROMEOS)
79 virtual PrefProxyConfigTracker* GetProxyConfigTracker() OVERRIDE;
81 virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE;
82 virtual DevToolsNetworkController* GetDevToolsNetworkController() OVERRIDE;
83 virtual void ClearNetworkingHistorySince(
84 base::Time time,
85 const base::Closure& completion) OVERRIDE;
86 virtual GURL GetHomePage() OVERRIDE;
88 // content::BrowserContext implementation:
89 virtual base::FilePath GetPath() const OVERRIDE;
90 virtual scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() OVERRIDE;
91 virtual bool IsOffTheRecord() const OVERRIDE;
92 virtual content::DownloadManagerDelegate*
93 GetDownloadManagerDelegate() OVERRIDE;
94 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE;
95 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
96 int renderer_child_id) OVERRIDE;
97 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE;
98 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
99 int renderer_child_id) OVERRIDE;
100 virtual net::URLRequestContextGetter*
101 GetMediaRequestContextForStoragePartition(
102 const base::FilePath& partition_path,
103 bool in_memory) OVERRIDE;
104 virtual content::ResourceContext* GetResourceContext() OVERRIDE;
105 virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE;
106 virtual storage::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
107 virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE;
108 virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() OVERRIDE;
110 private:
111 FRIEND_TEST_ALL_PREFIXES(OffTheRecordProfileImplTest, GetHostZoomMap);
112 void InitIoData();
113 void InitHostZoomMap();
115 #if defined(OS_ANDROID) || defined(OS_IOS)
116 void UseSystemProxy();
117 #endif // defined(OS_ANDROID) || defined(OS_IOS)
119 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change);
120 PrefProxyConfigTracker* CreateProxyConfigTracker();
122 // The real underlying profile.
123 Profile* profile_;
125 // Weak pointer owned by |profile_|.
126 PrefServiceSyncable* prefs_;
128 scoped_ptr<OffTheRecordProfileIOData::Handle> io_data_;
130 // We use a non-persistent content settings map for OTR.
131 scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
133 // Time we were started.
134 Time start_time_;
136 base::FilePath last_selected_directory_;
138 scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
140 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_;
142 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl);
145 #endif // CHROME_BROWSER_PROFILES_OFF_THE_RECORD_PROFILE_IMPL_H_