1 /* 2 * Copyright 2010, The Android Open Source Project 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * * Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 // This class gathers state related to a single user profile. 27 // On Android, we only use this for AutoFill so methods are mostly 28 // just stubs. 29 30 #ifndef ANDROID_AUTOFILL_PROFILE_H_ 31 #define ANDROID_AUTOFILL_PROFILE_H_ 32 33 #include "android/autofill/android_url_request_context_getter.h" 34 #include "base/basictypes.h" 35 #include "base/file_path.h" 36 #include "base/memory/ref_counted.h" 37 #include "base/scoped_ptr.h" 38 #include "base/timer.h" 39 #include "chrome/browser/prefs/pref_service.h" 40 #include "chrome/browser/profiles/profile.h" 41 42 namespace base { 43 class Time; 44 } 45 46 namespace history { 47 class TopSites; 48 } 49 50 namespace fileapi { 51 class FileSystemContext; 52 } 53 54 namespace net { 55 class TransportSecurityState; 56 class SSLConfigService; 57 } 58 59 namespace policy { 60 class ProfilePolicyContext; 61 } 62 63 namespace prerender { 64 class PrerenderManager; 65 } 66 67 namespace webkit_database { 68 class DatabaseTracker; 69 } 70 71 class AutocompleteClassifier; 72 class BackgroundContentsService; 73 class BookmarkModel; 74 class BrowserSignin; 75 class BrowserThemeProvider; 76 class ChromeURLRequestContextGetter; 77 class DesktopNotificationService; 78 class DownloadManager; 79 class Extension; 80 class ExtensionDevToolsManager; 81 class ExtensionIOEventRouter; 82 class ExtensionProcessManager; 83 class ExtensionMessageService; 84 class ExtensionsService; 85 class FaviconService; 86 class FindBarState; 87 class GeolocationContentSettingsMap; 88 class GeolocationPermissionContext; 89 class HistoryService; 90 class HostContentSettingsMap; 91 class HostZoomMap; 92 class NavigationController; 93 class NTPResourceCache; 94 class PasswordStore; 95 class PersonalDataManager; 96 class PinnedTabService; 97 class PrefProxyConfigTracker; 98 class PromoCounter; 99 class ProfileSyncService; 100 class ProfileSyncFactory; 101 class SessionService; 102 class SpellCheckHost; 103 class SSLConfigServiceManager; 104 class SSLHostState; 105 class TransportSecurityPersister; 106 class SQLitePersistentCookieStore; 107 class TabRestoreService; 108 class TemplateURLFetcher; 109 class TemplateURLModel; 110 class ThemeProvider; 111 class TokenService; 112 class URLRequestContextGetter; 113 class UserScriptMaster; 114 class UserStyleSheetWatcher; 115 class VisitedLinkMaster; 116 class VisitedLinkEventListener; 117 class WebDataService; 118 class WebKitContext; 119 class WebResourceService; 120 class CloudPrintProxyService; 121 122 typedef intptr_t ProfileId; 123 124 // The android profile implementation. 125 class ProfileImplAndroid : public Profile { 126 public: 127 virtual ~ProfileImplAndroid(); 128 SetRequestContext(net::URLRequestContextGetter * context)129 void SetRequestContext(net::URLRequestContextGetter* context) { url_request_context_getter_ = context; } 130 131 // Profile implementation. 132 virtual Profile* GetOriginalProfile(); 133 virtual PersonalDataManager* GetPersonalDataManager(); 134 virtual PrefService* GetPrefs(); GetPath()135 virtual FilePath GetPath() { return path_; } 136 virtual net::URLRequestContextGetter* GetRequestContext(); 137 138 // Functions from Profile that we don't need on Android for AutoFill. GetRuntimeId()139 virtual ProfileId GetRuntimeId() { NOTREACHED(); return 0; } IsOffTheRecord()140 virtual bool IsOffTheRecord() { NOTREACHED(); return false; } GetOffTheRecordProfile()141 virtual Profile* GetOffTheRecordProfile() { NOTREACHED(); return NULL; } DestroyOffTheRecordProfile()142 virtual void DestroyOffTheRecordProfile() { NOTREACHED(); } HasOffTheRecordProfile()143 virtual bool HasOffTheRecordProfile() { NOTREACHED(); return false; } GetAppCacheService()144 virtual ChromeAppCacheService* GetAppCacheService() { NOTREACHED(); return NULL; } GetDatabaseTracker()145 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() { NOTREACHED(); return NULL; } GetTopSites()146 virtual history::TopSites* GetTopSites() { NOTREACHED(); return NULL; } GetVisitedLinkMaster()147 virtual VisitedLinkMaster* GetVisitedLinkMaster() { NOTREACHED(); return NULL; } GetUserScriptMaster()148 virtual UserScriptMaster* GetUserScriptMaster() { NOTREACHED(); return NULL; } GetSSLHostState()149 virtual SSLHostState* GetSSLHostState() { NOTREACHED(); return NULL; } GetTransportSecurityState()150 virtual net::TransportSecurityState* GetTransportSecurityState() { NOTREACHED(); return NULL; } GetExtensionsService()151 virtual ExtensionsService* GetExtensionsService() { NOTREACHED(); return NULL; } GetExtensionDevToolsManager()152 virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() { NOTREACHED(); return NULL; } GetExtensionProcessManager()153 virtual ExtensionProcessManager* GetExtensionProcessManager() { NOTREACHED(); return NULL; } GetExtensionMessageService()154 virtual ExtensionMessageService* GetExtensionMessageService() { NOTREACHED(); return NULL; } GetExtensionEventRouter()155 virtual ExtensionEventRouter* GetExtensionEventRouter() { NOTREACHED(); return NULL; } GetExtensionIOEventRouter()156 virtual ExtensionIOEventRouter* GetExtensionIOEventRouter() { NOTREACHED(); return NULL; }; GetExtensionService()157 virtual ExtensionService* GetExtensionService() { NOTREACHED(); return NULL; } GetExtensionSpecialStoragePolicy()158 virtual ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() { NOTREACHED(); return NULL; } GetFaviconService(ServiceAccessType sat)159 virtual FaviconService* GetFaviconService(ServiceAccessType sat) { NOTREACHED(); return NULL; } GetHistoryService(ServiceAccessType sat)160 virtual HistoryService* GetHistoryService(ServiceAccessType sat) { NOTREACHED(); return NULL; } GetHistoryServiceWithoutCreating()161 virtual HistoryService* GetHistoryServiceWithoutCreating() { NOTREACHED(); return NULL; } GetAutocompleteClassifier()162 virtual AutocompleteClassifier* GetAutocompleteClassifier() { NOTREACHED(); return NULL; } GetWebDataService(ServiceAccessType sat)163 virtual WebDataService* GetWebDataService(ServiceAccessType sat) { NOTREACHED(); return NULL; } GetWebDataServiceWithoutCreating()164 virtual WebDataService* GetWebDataServiceWithoutCreating() { NOTREACHED(); return NULL; } GetPasswordStore(ServiceAccessType sat)165 virtual PasswordStore* GetPasswordStore(ServiceAccessType sat) { NOTREACHED(); return NULL; } GetProtocolHandlerRegistry()166 virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() { NOTREACHED(); return NULL; } GetOffTheRecordPrefs()167 virtual PrefService* GetOffTheRecordPrefs() { NOTREACHED(); return NULL; } GetPolicyConnector()168 virtual policy::ProfilePolicyConnector* GetPolicyConnector() { NOTREACHED(); return NULL; } GetTemplateURLModel()169 virtual TemplateURLModel* GetTemplateURLModel() { NOTREACHED(); return NULL; } GetTemplateURLFetcher()170 virtual TemplateURLFetcher* GetTemplateURLFetcher() { NOTREACHED(); return NULL; } GetDownloadManager()171 virtual DownloadManager* GetDownloadManager() { NOTREACHED(); return NULL; } GetFileSystemContext()172 virtual fileapi::FileSystemContext* GetFileSystemContext() { NOTREACHED(); return NULL; } InitPromoResources()173 virtual void InitPromoResources() { NOTREACHED(); } InitRegisteredProtocolHandlers()174 virtual void InitRegisteredProtocolHandlers() { NOTREACHED(); } InitThemes()175 virtual void InitThemes() { NOTREACHED(); } SetTheme(const Extension * extension)176 virtual void SetTheme(const Extension* extension) { NOTREACHED(); } SetNativeTheme()177 virtual void SetNativeTheme() { NOTREACHED(); } ClearTheme()178 virtual void ClearTheme() { NOTREACHED(); } GetTheme()179 virtual const Extension* GetTheme() { NOTREACHED(); return NULL; } GetThemeProvider()180 virtual BrowserThemeProvider* GetThemeProvider() { NOTREACHED(); return NULL; } HasCreatedDownloadManager()181 virtual bool HasCreatedDownloadManager() const { NOTREACHED(); return false; } GetRequestContextForMedia()182 virtual net::URLRequestContextGetter* GetRequestContextForMedia() { NOTREACHED(); return NULL; } GetRequestContextForExtensions()183 virtual net::URLRequestContextGetter* GetRequestContextForExtensions() { NOTREACHED(); return NULL; } RegisterExtensionWithRequestContexts(const Extension * extension)184 virtual void RegisterExtensionWithRequestContexts(const Extension* extension) { NOTREACHED(); } UnregisterExtensionWithRequestContexts(const Extension * extension)185 virtual void UnregisterExtensionWithRequestContexts(const Extension* extension) { NOTREACHED(); } GetSSLConfigService()186 virtual net::SSLConfigService* GetSSLConfigService() { NOTREACHED(); return NULL; } GetHostContentSettingsMap()187 virtual HostContentSettingsMap* GetHostContentSettingsMap() { NOTREACHED(); return NULL; } GetHostZoomMap()188 virtual HostZoomMap* GetHostZoomMap() { NOTREACHED(); return NULL; } GetGeolocationContentSettingsMap()189 virtual GeolocationContentSettingsMap* GetGeolocationContentSettingsMap() { NOTREACHED(); return NULL; } GetGeolocationPermissionContext()190 virtual GeolocationPermissionContext* GetGeolocationPermissionContext() { NOTREACHED(); return NULL; } GetUserStyleSheetWatcher()191 virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() { NOTREACHED(); return NULL; } GetFindBarState()192 virtual FindBarState* GetFindBarState() { NOTREACHED(); return NULL; } GetSessionService()193 virtual SessionService* GetSessionService() { NOTREACHED(); return NULL; } ShutdownSessionService()194 virtual void ShutdownSessionService() { NOTREACHED(); } HasSessionService()195 virtual bool HasSessionService() const { NOTREACHED(); return false; } DidLastSessionExitCleanly()196 virtual bool DidLastSessionExitCleanly() { NOTREACHED(); return true; } GetBookmarkModel()197 virtual BookmarkModel* GetBookmarkModel() { NOTREACHED(); return NULL; } IsSameProfile(Profile * profile)198 virtual bool IsSameProfile(Profile* profile) { NOTREACHED(); return false; } GetStartTime()199 virtual base::Time GetStartTime() const { NOTREACHED(); return base::Time(); } GetTabRestoreService()200 virtual TabRestoreService* GetTabRestoreService() { NOTREACHED(); return NULL; } ResetTabRestoreService()201 virtual void ResetTabRestoreService() { NOTREACHED(); } GetSpellCheckHost()202 virtual SpellCheckHost* GetSpellCheckHost() { NOTREACHED(); return NULL; } ReinitializeSpellCheckHost(bool force)203 virtual void ReinitializeSpellCheckHost(bool force) { NOTREACHED(); } GetWebKitContext()204 virtual WebKitContext* GetWebKitContext() { NOTREACHED(); return NULL; } GetDesktopNotificationService()205 virtual DesktopNotificationService* GetDesktopNotificationService() { NOTREACHED(); return NULL; } GetBackgroundContentsService()206 virtual BackgroundContentsService* GetBackgroundContentsService() const { NOTREACHED(); return NULL; } GetStatusTray()207 virtual StatusTray* GetStatusTray() { NOTREACHED(); return NULL; } MarkAsCleanShutdown()208 virtual void MarkAsCleanShutdown() { NOTREACHED(); } InitExtensions(bool extensions_enabled)209 virtual void InitExtensions(bool extensions_enabled) { NOTREACHED(); } InitWebResources()210 virtual void InitWebResources() { NOTREACHED(); } GetNTPResourceCache()211 virtual NTPResourceCache* GetNTPResourceCache() { NOTREACHED(); return NULL; } last_selected_directory()212 virtual FilePath last_selected_directory() { NOTREACHED(); return FilePath(""); } set_last_selected_directory(const FilePath & path)213 virtual void set_last_selected_directory(const FilePath& path) { NOTREACHED(); } GetBlobStorageContext()214 virtual ChromeBlobStorageContext* GetBlobStorageContext() { NOTREACHED(); return NULL; } GetExtensionInfoMap()215 virtual ExtensionInfoMap* GetExtensionInfoMap() { NOTREACHED(); return NULL; } GetInstantPromoCounter()216 virtual PromoCounter* GetInstantPromoCounter() { NOTREACHED(); return NULL; } GetProfileSyncService()217 virtual ProfileSyncService* GetProfileSyncService() { NOTREACHED(); return NULL; } GetProfileSyncService(const std::string &)218 virtual ProfileSyncService* GetProfileSyncService(const std::string&) { NOTREACHED(); return NULL; } GetTokenService()219 virtual TokenService* GetTokenService() { NOTREACHED(); return NULL; } InitSyncService()220 void InitSyncService() { NOTREACHED(); } GetCloudPrintProxyService()221 virtual CloudPrintProxyService* GetCloudPrintProxyService() { NOTREACHED(); return NULL; } InitCloudPrintProxyService()222 void InitCloudPrintProxyService() { NOTREACHED(); } 223 GetTopSitesWithoutCreating()224 virtual history::TopSites* GetTopSitesWithoutCreating() { NOTREACHED(); return NULL; } GetBrowserSignin()225 virtual BrowserSignin* GetBrowserSignin() { NOTREACHED(); return NULL; } HasProfileSyncService()226 virtual bool HasProfileSyncService() const { NOTREACHED(); return false; } 227 GetPolicyContext()228 virtual policy::ProfilePolicyContext* GetPolicyContext() { NOTREACHED(); return NULL; } GetChromeURLDataManager()229 virtual ChromeURLDataManager* GetChromeURLDataManager() { NOTREACHED(); return NULL; } GetProxyConfigTracker()230 virtual PrefProxyConfigTracker* GetProxyConfigTracker() { NOTREACHED(); return NULL; } GetPrerenderManager()231 virtual prerender::PrerenderManager* GetPrerenderManager() { NOTREACHED(); return NULL; } GetRequestContextForPossibleApp(const Extension * installed_app)232 virtual net::URLRequestContextGetter* GetRequestContextForPossibleApp( 233 const Extension* installed_app) { NOTREACHED(); return NULL; } GetRequestContextForIsolatedApp(const std::string & app_id)234 virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp( 235 const std::string& app_id) { NOTREACHED(); return NULL; } 236 237 private: 238 friend class Profile; 239 240 explicit ProfileImplAndroid(const FilePath& path); 241 CreateWebDataService()242 void CreateWebDataService() { NOTREACHED(); } GetPrefFilePath()243 FilePath GetPrefFilePath() { return path_; } 244 CreatePasswordStore()245 void CreatePasswordStore() { NOTREACHED(); } 246 StopCreateSessionServiceTimer()247 void StopCreateSessionServiceTimer() { NOTREACHED(); } 248 EnsureRequestContextCreated()249 void EnsureRequestContextCreated() { 250 GetRequestContext(); 251 } 252 EnsureSessionServiceCreated()253 void EnsureSessionServiceCreated() { 254 GetSessionService(); 255 } 256 257 FilePath path_; 258 scoped_ptr<PrefService> preferences_; 259 scoped_refptr<PersonalDataManager> personal_data_; 260 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 261 262 DISALLOW_COPY_AND_ASSIGN(ProfileImplAndroid); 263 }; 264 265 #endif // CHROME_BROWSER_PROFILE_H_ 266