| 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 { | 29 public content::HostZoomMap::Observer { |
| 31 public: | 30 public: |
| 32 explicit OffTheRecordProfileImpl(Profile* real_profile); | 31 explicit OffTheRecordProfileImpl(Profile* real_profile); |
| 33 virtual ~OffTheRecordProfileImpl(); | 32 virtual ~OffTheRecordProfileImpl(); |
| 34 void Init(); | 33 void Init(); |
| 35 | 34 |
| 36 // Profile implementation. | 35 // Profile implementation. |
| 37 virtual std::string GetProfileName() OVERRIDE; | 36 virtual std::string GetProfileName() OVERRIDE; |
| 38 virtual Profile* GetOffTheRecordProfile() OVERRIDE; | 37 virtual Profile* GetOffTheRecordProfile() OVERRIDE; |
| 39 virtual void DestroyOffTheRecordProfile() OVERRIDE; | 38 virtual void DestroyOffTheRecordProfile() OVERRIDE; |
| 40 virtual bool HasOffTheRecordProfile() OVERRIDE; | 39 virtual bool HasOffTheRecordProfile() OVERRIDE; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 GetMediaRequestContextForStoragePartition( | 97 GetMediaRequestContextForStoragePartition( |
| 99 const FilePath& partition_path, | 98 const FilePath& partition_path, |
| 100 bool in_memory) OVERRIDE; | 99 bool in_memory) OVERRIDE; |
| 101 virtual content::ResourceContext* GetResourceContext() OVERRIDE; | 100 virtual content::ResourceContext* GetResourceContext() OVERRIDE; |
| 102 virtual content::GeolocationPermissionContext* | 101 virtual content::GeolocationPermissionContext* |
| 103 GetGeolocationPermissionContext() OVERRIDE; | 102 GetGeolocationPermissionContext() OVERRIDE; |
| 104 virtual content::SpeechRecognitionPreferences* | 103 virtual content::SpeechRecognitionPreferences* |
| 105 GetSpeechRecognitionPreferences() OVERRIDE; | 104 GetSpeechRecognitionPreferences() OVERRIDE; |
| 106 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; | 105 virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; |
| 107 | 106 |
| 108 // content::NotificationObserver implementation. | 107 // content::HostZoomMap::Observer implementation: |
| 109 virtual void Observe(int type, | 108 virtual void OnZoomLevelChanged(const std::string& host) OVERRIDE; |
| 110 const content::NotificationSource& source, | |
| 111 const content::NotificationDetails& details) OVERRIDE; | |
| 112 | 109 |
| 113 private: | 110 private: |
| 114 FRIEND_TEST_ALL_PREFIXES(OffTheRecordProfileImplTest, GetHostZoomMap); | 111 FRIEND_TEST_ALL_PREFIXES(OffTheRecordProfileImplTest, GetHostZoomMap); |
| 115 void InitHostZoomMap(); | 112 void InitHostZoomMap(); |
| 116 | 113 |
| 117 #if defined(OS_ANDROID) | 114 #if defined(OS_ANDROID) |
| 118 void UseSystemProxy(); | 115 void UseSystemProxy(); |
| 119 #endif | 116 #endif |
| 120 | 117 |
| 121 virtual base::Callback<ChromeURLDataManagerBackend*(void)> | 118 virtual base::Callback<ChromeURLDataManagerBackend*(void)> |
| 122 GetChromeURLDataManagerBackendGetter() const OVERRIDE; | 119 GetChromeURLDataManagerBackendGetter() const OVERRIDE; |
| 123 | 120 |
| 124 content::NotificationRegistrar registrar_; | |
| 125 | |
| 126 // The real underlying profile. | 121 // The real underlying profile. |
| 127 Profile* profile_; | 122 Profile* profile_; |
| 128 | 123 |
| 129 // Weak pointer owned by |profile_|. | 124 // Weak pointer owned by |profile_|. |
| 130 PrefServiceSyncable* prefs_; | 125 PrefServiceSyncable* prefs_; |
| 131 | 126 |
| 132 OffTheRecordProfileIOData::Handle io_data_; | 127 OffTheRecordProfileIOData::Handle io_data_; |
| 133 | 128 |
| 134 // We use a non-persistent content settings map for OTR. | 129 // We use a non-persistent content settings map for OTR. |
| 135 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | 130 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; |
| 136 | 131 |
| 137 // Time we were started. | 132 // Time we were started. |
| 138 Time start_time_; | 133 Time start_time_; |
| 139 | 134 |
| 140 FilePath last_selected_directory_; | 135 FilePath last_selected_directory_; |
| 141 | 136 |
| 142 scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; | 137 scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |
| 143 | 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 |