Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / profiles / off_the_record_profile_impl.h
blob56ce53da2af7b25d970cfef4d94f87438ecfb672
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 "content/public/browser/content_browser_client.h"
15 #include "content/public/browser/host_zoom_map.h"
17 using base::Time;
18 using base::TimeDelta;
20 class PrefServiceSyncable;
22 ////////////////////////////////////////////////////////////////////////////////
24 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile
25 // to make it suitable for the incognito mode.
27 // Note: This class is a leaf class and is not intended for subclassing.
28 // Providing this header file is for unit testing.
30 ////////////////////////////////////////////////////////////////////////////////
31 class OffTheRecordProfileImpl : public Profile {
32 public:
33 explicit OffTheRecordProfileImpl(Profile* real_profile);
34 virtual ~OffTheRecordProfileImpl();
35 void Init();
37 // Profile implementation.
38 virtual std::string GetProfileName() OVERRIDE;
39 virtual Profile* GetOffTheRecordProfile() OVERRIDE;
40 virtual void DestroyOffTheRecordProfile() OVERRIDE;
41 virtual bool HasOffTheRecordProfile() OVERRIDE;
42 virtual Profile* GetOriginalProfile() OVERRIDE;
43 virtual bool IsManaged() OVERRIDE;
44 virtual ExtensionService* GetExtensionService() OVERRIDE;
45 virtual ExtensionSpecialStoragePolicy*
46 GetExtensionSpecialStoragePolicy() OVERRIDE;
47 virtual PrefService* GetPrefs() OVERRIDE;
48 virtual PrefService* GetOffTheRecordPrefs() OVERRIDE;
49 virtual net::URLRequestContextGetter*
50 GetRequestContextForExtensions() OVERRIDE;
51 virtual net::URLRequestContextGetter* CreateRequestContext(
52 content::ProtocolHandlerMap* protocol_handlers) OVERRIDE;
53 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
54 const base::FilePath& partition_path,
55 bool in_memory,
56 content::ProtocolHandlerMap* protocol_handlers) OVERRIDE;
57 virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE;
58 virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE;
59 virtual bool IsSameProfile(Profile* profile) OVERRIDE;
60 virtual Time GetStartTime() const OVERRIDE;
61 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE;
62 virtual history::TopSites* GetTopSites() OVERRIDE;
63 virtual base::FilePath last_selected_directory() OVERRIDE;
64 virtual void set_last_selected_directory(const base::FilePath& path) OVERRIDE;
65 virtual bool WasCreatedByVersionOrLater(const std::string& version) OVERRIDE;
66 virtual void SetExitType(ExitType exit_type) OVERRIDE;
67 virtual ExitType GetLastSessionExitType() OVERRIDE;
69 #if defined(OS_CHROMEOS)
70 virtual void ChangeAppLocale(const std::string& locale,
71 AppLocaleChangedVia) OVERRIDE;
72 virtual void OnLogin() OVERRIDE;
73 virtual void InitChromeOSPreferences() OVERRIDE;
74 #endif // defined(OS_CHROMEOS)
76 virtual PrefProxyConfigTracker* GetProxyConfigTracker() OVERRIDE;
78 virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE;
79 virtual void ClearNetworkingHistorySince(
80 base::Time time,
81 const base::Closure& completion) OVERRIDE;
82 virtual GURL GetHomePage() OVERRIDE;
84 // content::BrowserContext implementation:
85 virtual base::FilePath GetPath() const OVERRIDE;
86 virtual scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() OVERRIDE;
87 virtual bool IsOffTheRecord() const OVERRIDE;
88 virtual content::DownloadManagerDelegate*
89 GetDownloadManagerDelegate() OVERRIDE;
90 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE;
91 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
92 int renderer_child_id) OVERRIDE;
93 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE;
94 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
95 int renderer_child_id) OVERRIDE;
96 virtual net::URLRequestContextGetter*
97 GetMediaRequestContextForStoragePartition(
98 const base::FilePath& partition_path,
99 bool in_memory) OVERRIDE;
100 virtual void RequestMIDISysExPermission(
101 int render_process_id,
102 int render_view_id,
103 int bridge_id,
104 const GURL& requesting_frame,
105 const MIDISysExPermissionCallback& callback) OVERRIDE;
106 virtual void CancelMIDISysExPermissionRequest(
107 int render_process_id,
108 int render_view_id,
109 int bridge_id,
110 const GURL& requesting_frame) OVERRIDE;
111 virtual void RequestProtectedMediaIdentifierPermission(
112 int render_process_id,
113 int render_view_id,
114 int bridge_id,
115 int group_id,
116 const GURL& requesting_frame,
117 const ProtectedMediaIdentifierPermissionCallback& callback) OVERRIDE;
118 virtual void CancelProtectedMediaIdentifierPermissionRequests(
119 int group_id) OVERRIDE;
120 virtual content::ResourceContext* GetResourceContext() OVERRIDE;
121 virtual content::GeolocationPermissionContext*
122 GetGeolocationPermissionContext() OVERRIDE;
123 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
125 private:
126 FRIEND_TEST_ALL_PREFIXES(OffTheRecordProfileImplTest, GetHostZoomMap);
127 void InitHostZoomMap();
129 #if defined(OS_ANDROID) || defined(OS_IOS)
130 void UseSystemProxy();
131 #endif // defined(OS_ANDROID) || defined(OS_IOS)
133 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change);
134 PrefProxyConfigTracker* CreateProxyConfigTracker();
136 // The real underlying profile.
137 Profile* profile_;
139 // Weak pointer owned by |profile_|.
140 PrefServiceSyncable* prefs_;
142 OffTheRecordProfileIOData::Handle io_data_;
144 // We use a non-persistent content settings map for OTR.
145 scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
147 // Time we were started.
148 Time start_time_;
150 base::FilePath last_selected_directory_;
152 scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
154 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_;
156 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl);
159 #endif // CHROME_BROWSER_PROFILES_OFF_THE_RECORD_PROFILE_IMPL_H_