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