OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PROFILES_OFF_THE_RECORD_PROFILE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_OFF_THE_RECORD_PROFILE_IMPL_H_ |
6 #define CHROME_BROWSER_PROFILES_OFF_THE_RECORD_PROFILE_IMPL_H_ | 6 #define CHROME_BROWSER_PROFILES_OFF_THE_RECORD_PROFILE_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "chrome/browser/profiles/off_the_record_profile_io_data.h" | 11 #include "chrome/browser/profiles/off_the_record_profile_io_data.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/host_zoom_map.h" |
15 #include "content/public/browser/notification_registrar.h" | |
16 | 15 |
17 using base::Time; | 16 using base::Time; |
18 using base::TimeDelta; | 17 using base::TimeDelta; |
19 | 18 |
20 //////////////////////////////////////////////////////////////////////////////// | 19 //////////////////////////////////////////////////////////////////////////////// |
21 // | 20 // |
22 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile | 21 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile |
23 // to make it suitable for the incognito mode. | 22 // to make it suitable for the incognito mode. |
24 // | 23 // |
25 // Note: This class is a leaf class and is not intended for subclassing. | 24 // Note: This class is a leaf class and is not intended for subclassing. |
26 // Providing this header file is for unit testing. | 25 // Providing this header file is for unit testing. |
27 // | 26 // |
28 //////////////////////////////////////////////////////////////////////////////// | 27 //////////////////////////////////////////////////////////////////////////////// |
29 class OffTheRecordProfileImpl : public Profile, | 28 class OffTheRecordProfileImpl : public Profile { |
30 public content::NotificationObserver { | |
31 public: | 29 public: |
32 explicit OffTheRecordProfileImpl(Profile* real_profile); | 30 explicit OffTheRecordProfileImpl(Profile* real_profile); |
33 virtual ~OffTheRecordProfileImpl(); | 31 virtual ~OffTheRecordProfileImpl(); |
34 void Init(); | 32 void Init(); |
35 | 33 |
36 // Profile implementation. | 34 // Profile implementation. |
37 virtual std::string GetProfileName() OVERRIDE; | 35 virtual std::string GetProfileName() OVERRIDE; |
38 virtual Profile* GetOffTheRecordProfile() OVERRIDE; | 36 virtual Profile* GetOffTheRecordProfile() OVERRIDE; |
39 virtual void DestroyOffTheRecordProfile() OVERRIDE; | 37 virtual void DestroyOffTheRecordProfile() OVERRIDE; |
40 virtual bool HasOffTheRecordProfile() OVERRIDE; | 38 virtual bool HasOffTheRecordProfile() OVERRIDE; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 GetMediaRequestContextForStoragePartition( | 96 GetMediaRequestContextForStoragePartition( |
99 const FilePath& partition_path, | 97 const FilePath& partition_path, |
100 bool in_memory) OVERRIDE; | 98 bool in_memory) OVERRIDE; |
101 virtual content::ResourceContext* GetResourceContext() OVERRIDE; | 99 virtual content::ResourceContext* GetResourceContext() OVERRIDE; |
102 virtual content::GeolocationPermissionContext* | 100 virtual content::GeolocationPermissionContext* |
103 GetGeolocationPermissionContext() OVERRIDE; | 101 GetGeolocationPermissionContext() OVERRIDE; |
104 virtual content::SpeechRecognitionPreferences* | 102 virtual content::SpeechRecognitionPreferences* |
105 GetSpeechRecognitionPreferences() OVERRIDE; | 103 GetSpeechRecognitionPreferences() OVERRIDE; |
106 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; | 104 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; |
107 | 105 |
108 // content::NotificationObserver implementation. | |
109 virtual void Observe(int type, | |
110 const content::NotificationSource& source, | |
111 const content::NotificationDetails& details) OVERRIDE; | |
112 | |
113 private: | 106 private: |
114 FRIEND_TEST_ALL_PREFIXES(OffTheRecordProfileImplTest, GetHostZoomMap); | 107 FRIEND_TEST_ALL_PREFIXES(OffTheRecordProfileImplTest, GetHostZoomMap); |
115 void InitHostZoomMap(); | 108 void InitHostZoomMap(); |
116 | 109 |
117 #if defined(OS_ANDROID) | 110 #if defined(OS_ANDROID) |
118 void UseSystemProxy(); | 111 void UseSystemProxy(); |
119 #endif | 112 #endif |
120 | 113 |
121 virtual base::Callback<ChromeURLDataManagerBackend*(void)> | 114 virtual base::Callback<ChromeURLDataManagerBackend*(void)> |
122 GetChromeURLDataManagerBackendGetter() const OVERRIDE; | 115 GetChromeURLDataManagerBackendGetter() const OVERRIDE; |
123 | 116 |
124 content::NotificationRegistrar registrar_; | 117 void OnZoomLevelChanged(const std::string& host); |
125 | 118 |
126 // The real underlying profile. | 119 // The real underlying profile. |
127 Profile* profile_; | 120 Profile* profile_; |
128 | 121 |
129 // Weak pointer owned by |profile_|. | 122 // Weak pointer owned by |profile_|. |
130 PrefServiceSyncable* prefs_; | 123 PrefServiceSyncable* prefs_; |
131 | 124 |
132 OffTheRecordProfileIOData::Handle io_data_; | 125 OffTheRecordProfileIOData::Handle io_data_; |
133 | 126 |
134 // We use a non-persistent content settings map for OTR. | 127 // We use a non-persistent content settings map for OTR. |
135 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | 128 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; |
136 | 129 |
137 // Time we were started. | 130 // Time we were started. |
138 Time start_time_; | 131 Time start_time_; |
139 | 132 |
140 FilePath last_selected_directory_; | 133 FilePath last_selected_directory_; |
141 | 134 |
142 scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; | 135 scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |
143 | 136 |
| 137 content::HostZoomMap::ZoomLevelChangedCallback zoom_callback_; |
| 138 |
144 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl); | 139 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl); |
145 }; | 140 }; |
146 | 141 |
147 #endif // CHROME_BROWSER_PROFILES_OFF_THE_RECORD_PROFILE_IMPL_H_ | 142 #endif // CHROME_BROWSER_PROFILES_OFF_THE_RECORD_PROFILE_IMPL_H_ |
OLD | NEW |