| 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 content::NotificationRegistrar registrar_; | 114 void OnZoomLevelChanged(const std::string& host); |
| 122 | 115 |
| 123 // The real underlying profile. | 116 // The real underlying profile. |
| 124 Profile* profile_; | 117 Profile* profile_; |
| 125 | 118 |
| 126 // Weak pointer owned by |profile_|. | 119 // Weak pointer owned by |profile_|. |
| 127 PrefServiceSyncable* prefs_; | 120 PrefServiceSyncable* prefs_; |
| 128 | 121 |
| 129 OffTheRecordProfileIOData::Handle io_data_; | 122 OffTheRecordProfileIOData::Handle io_data_; |
| 130 | 123 |
| 131 // We use a non-persistent content settings map for OTR. | 124 // We use a non-persistent content settings map for OTR. |
| 132 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | 125 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; |
| 133 | 126 |
| 134 // Time we were started. | 127 // Time we were started. |
| 135 Time start_time_; | 128 Time start_time_; |
| 136 | 129 |
| 137 FilePath last_selected_directory_; | 130 FilePath last_selected_directory_; |
| 138 | 131 |
| 139 scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; | 132 scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |
| 140 | 133 |
| 134 content::HostZoomMap::ZoomLevelChangedCallback zoom_callback_; |
| 135 |
| 141 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl); | 136 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl); |
| 142 }; | 137 }; |
| 143 | 138 |
| 144 #endif // CHROME_BROWSER_PROFILES_OFF_THE_RECORD_PROFILE_IMPL_H_ | 139 #endif // CHROME_BROWSER_PROFILES_OFF_THE_RECORD_PROFILE_IMPL_H_ |
| OLD | NEW |