profile.h revision dc0f95d653279beabeb9817299e2902918ba123e
172a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen// Copyright (c) 2011 The Chromium Authors. All rights reserved. 2c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Use of this source code is governed by a BSD-style license that can be 3c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// found in the LICENSE file. 4c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 5c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// This class gathers state related to a single user profile. 6c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 721d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen#ifndef CHROME_BROWSER_PROFILES_PROFILE_H_ 821d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen#define CHROME_BROWSER_PROFILES_PROFILE_H_ 93345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#pragma once 10c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 11c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#include "base/basictypes.h" 123345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#include "base/logging.h" 133345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 143345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merricknamespace base { 153345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrickclass Time; 163345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick} 17c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 18c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#if defined(OS_CHROMEOS) 193345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merricknamespace chromeos { 2021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass EnterpriseExtensionObserver; 213345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrickclass ProxyConfigServiceImpl; 223345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick} 23c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#endif 24c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 25dc0f95d653279beabeb9817299e2902918ba123eKristian Monsennamespace fileapi { 26dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass FileSystemContext; 27dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass SandboxedFileSystemContext; 28dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen} 29dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen 30c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochnamespace history { 31c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass TopSites; 32c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 33c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 34c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochnamespace net { 35c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass TransportSecurityState; 36c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass SSLConfigService; 37c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 38c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 39201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdochnamespace policy { 40dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass ProfilePolicyConnector; 41201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch} 42201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch 43dc0f95d653279beabeb9817299e2902918ba123eKristian Monsennamespace prerender { 44dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass PrerenderManager; 45c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 46c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 47dc0f95d653279beabeb9817299e2902918ba123eKristian Monsennamespace webkit_database { 48dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass DatabaseTracker; 4921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen} 5021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen 51c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass AutocompleteClassifier; 52c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass BackgroundContentsService; 53c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass BookmarkModel; 54513209b27ff55e2841eac0e4120199c23acce758Ben Murdochclass BrowserSignin; 55c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass BrowserThemeProvider; 563345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrickclass ChromeAppCacheService; 573345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrickclass ChromeBlobStorageContext; 5872a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsenclass ChromeURLDataManager; 59731df977c0511bca2206b5f333555b1205ff1f43Iain Merrickclass CloudPrintProxyService; 60c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass DesktopNotificationService; 61c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass DownloadManager; 62c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass Extension; 63c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass ExtensionDevToolsManager; 64731df977c0511bca2206b5f333555b1205ff1f43Iain Merrickclass ExtensionEventRouter; 6521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass ExtensionInfoMap; 66c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass ExtensionMessageService; 6772a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsenclass ExtensionPrefValueMap; 68731df977c0511bca2206b5f333555b1205ff1f43Iain Merrickclass ExtensionProcessManager; 6921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass ExtensionService; 70dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass ExtensionSpecialStoragePolicy; 71c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass FaviconService; 723345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrickclass FilePath; 73c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass FindBarState; 74c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass GeolocationContentSettingsMap; 75c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass GeolocationPermissionContext; 76c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass HistoryService; 77c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass HostContentSettingsMap; 78c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass HostZoomMap; 79c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass NTPResourceCache; 8021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass NavigationController; 81c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass PasswordStore; 82c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass PersonalDataManager; 83c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass PinnedTabService; 84201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdochclass PrefProxyConfigTracker; 8521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass PrefService; 86c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass ProfileSyncFactory; 8721d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass ProfileSyncService; 8821d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass PromoCounter; 89dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass ProtocolHandlerRegistry; 9021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass SQLitePersistentCookieStore; 91c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass SSLConfigServiceManager; 92c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass SSLHostState; 9321d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass SessionService; 9421d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass SpellCheckHost; 953345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrickclass StatusTray; 96c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass TabRestoreService; 97c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass TemplateURLFetcher; 98c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass TemplateURLModel; 99c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass TokenService; 10021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass TransportSecurityPersister; 101c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass URLRequestContextGetter; 102c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass UserScriptMaster; 103c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass UserStyleSheetWatcher; 104c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass VisitedLinkEventListener; 10521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass VisitedLinkMaster; 106c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass WebDataService; 107c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass WebKitContext; 108dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass PromoResourceService; 109c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 110c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochtypedef intptr_t ProfileId; 111c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 112c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass Profile { 113c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch public: 114c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Profile services are accessed with the following parameter. This parameter 115c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // defines what the caller plans to do with the service. 116c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // The caller is responsible for not performing any operation that would 117c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // result in persistent implicit records while using an OffTheRecord profile. 118c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // This flag allows the profile to perform an additional check. 119c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 120c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // It also gives us an opportunity to perform further checks in the future. We 121c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // could, for example, return an history service that only allow some specific 122c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // methods. 123c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch enum ServiceAccessType { 124c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // The caller plans to perform a read or write that takes place as a result 125c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // of the user input. Use this flag when the operation you are doing can be 126c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // performed while off the record. (ex: creating a bookmark) 127c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 128c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Since EXPLICIT_ACCESS means "as a result of a user action", this request 129c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // always succeeds. 130c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch EXPLICIT_ACCESS, 131c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 132c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // The caller plans to call a method that will permanently change some data 133c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // in the profile, as part of Chrome's implicit data logging. Use this flag 134c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // when you are about to perform an operation which is incompatible with the 135c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // off the record mode. 136c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch IMPLICIT_ACCESS 137c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch }; 138c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 13972a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Key used to bind profile to the widget with which it is associated. 14072a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen static const char* kProfileKey; 14172a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 142c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Value that represents no profile Id. 143dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen static const ProfileId kInvalidProfileId; 144c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 14521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen Profile(); 146c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual ~Profile() {} 147c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 148c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Profile prefs are registered as soon as the prefs are loaded for the first 149c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // time. 150c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch static void RegisterUserPrefs(PrefService* prefs); 151c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 152c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Create a new profile given a path. 153c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch static Profile* CreateProfile(const FilePath& path); 154c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 155c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the request context for the "default" profile. This may be called 156c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // from any thread. This CAN return NULL if a first request context has not 157c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // yet been created. If necessary, listen on the UI thread for 158c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE. 159c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch static URLRequestContextGetter* GetDefaultRequestContext(); 160c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 161c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns a unique Id that can be used to identify this profile at runtime. 162c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // This Id is not persistent and will not survive a restart of the browser. 163c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual ProfileId GetRuntimeId() = 0; 164c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 165c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the path of the directory where this profile's data is stored. 166c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual FilePath GetPath() = 0; 167c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 168c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Return whether this profile is off the record. Default is false. 169c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual bool IsOffTheRecord() = 0; 170c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 171c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Return the off the record version of this profile. The returned pointer 172c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // is owned by the receiving profile. If the receiving profile is off the 173c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // record, the same profile is returned. 174c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual Profile* GetOffTheRecordProfile() = 0; 175c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 176c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Destroys the off the record profile. 177c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void DestroyOffTheRecordProfile() = 0; 178c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 179c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // True if an off the record profile exists. 180c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual bool HasOffTheRecordProfile() = 0; 181c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 182c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Return the original "recording" profile. This method returns this if the 183c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile is not off the record. 184c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual Profile* GetOriginalProfile() = 0; 185c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 1863345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // Returns a pointer to the ChromeAppCacheService instance for this profile. 1873345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick virtual ChromeAppCacheService* GetAppCacheService() = 0; 1883345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 189c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns a pointer to the DatabaseTracker instance for this profile. 190c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; 191c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 192c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns a pointer to the TopSites (thumbnail manager) instance 193c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // for this profile. 194c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual history::TopSites* GetTopSites() = 0; 195c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 196513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch // Variant of GetTopSites that doesn't force creation. 197513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch virtual history::TopSites* GetTopSitesWithoutCreating() = 0; 198513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch 199c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the VisitedLinkMaster associated with this 200c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The VisitedLinkMaster is lazily created the first time 201c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // that this method is called. 202c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual VisitedLinkMaster* GetVisitedLinkMaster() = 0; 203c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 20421d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen // Retrieves a pointer to the ExtensionService associated with this 20521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen // profile. The ExtensionService is created at startup. 20621d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen virtual ExtensionService* GetExtensionService() = 0; 207c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 208c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the UserScriptMaster associated with this 209c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The UserScriptMaster is lazily created the first time 210c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // that this method is called. 211c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual UserScriptMaster* GetUserScriptMaster() = 0; 212c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 213c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the ExtensionDevToolsManager associated with this 214c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The instance is created at startup. 215c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() = 0; 216c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 217c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the ExtensionProcessManager associated with this 218c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The instance is created at startup. 219c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual ExtensionProcessManager* GetExtensionProcessManager() = 0; 220c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 221c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the ExtensionMessageService associated with this 222c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The instance is created at startup. 223c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual ExtensionMessageService* GetExtensionMessageService() = 0; 224c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 225731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick // Accessor. The instance is created at startup. 226731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick virtual ExtensionEventRouter* GetExtensionEventRouter() = 0; 227731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick 228dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // Accessor. The instance is created upon first access. 229dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual ExtensionSpecialStoragePolicy* 230dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen GetExtensionSpecialStoragePolicy() = 0; 23172a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 232c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the SSLHostState associated with this profile. 233c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // The SSLHostState is lazily created the first time that this method is 234c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // called. 235c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual SSLHostState* GetSSLHostState() = 0; 236c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 237c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the TransportSecurityState associated with 238c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // this profile. The TransportSecurityState is lazily created the 239c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // first time that this method is called. 24072a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen virtual net::TransportSecurityState* GetTransportSecurityState() = 0; 241c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 242c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the FaviconService associated with this 243c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The FaviconService is lazily created the first time 244c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // that this method is called. 245c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 246c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Although FaviconService is refcounted, this will not addref, and callers 247c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // do not need to do any reference counting as long as they keep the pointer 248c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // only for the local scope (which they should do anyway since the browser 249c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // process may decide to shut down). 250c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 251c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // |access| defines what the caller plans to do with the service. See 252c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the ServiceAccessType definition above. 253c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual FaviconService* GetFaviconService(ServiceAccessType access) = 0; 254c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 255c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the HistoryService associated with this 256c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The HistoryService is lazily created the first time 257c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // that this method is called. 258c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 259c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Although HistoryService is refcounted, this will not addref, and callers 260c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // do not need to do any reference counting as long as they keep the pointer 261c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // only for the local scope (which they should do anyway since the browser 262c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // process may decide to shut down). 263c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 264c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // |access| defines what the caller plans to do with the service. See 265c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the ServiceAccessType definition above. 266c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual HistoryService* GetHistoryService(ServiceAccessType access) = 0; 267c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 268c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Similar to GetHistoryService(), but won't create the history service if it 269c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // doesn't already exist. 270c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual HistoryService* GetHistoryServiceWithoutCreating() = 0; 271c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 272c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the AutocompleteClassifier associated with this 273c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The AutocompleteClassifier is lazily created the first time that 274c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // this method is called. 275c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual AutocompleteClassifier* GetAutocompleteClassifier() = 0; 276c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 277c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the WebDataService for this profile. This is owned by 278c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the Profile. Callers that outlive the life of this profile need to be 279c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // sure they refcount the returned value. 280c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 281c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // |access| defines what the caller plans to do with the service. See 282c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the ServiceAccessType definition above. 283c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual WebDataService* GetWebDataService(ServiceAccessType access) = 0; 284c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 285c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Similar to GetWebDataService(), but won't create the web data service if it 286c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // doesn't already exist. 287c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual WebDataService* GetWebDataServiceWithoutCreating() = 0; 288c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 289c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the PasswordStore for this profile. This is owned by the Profile. 290c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual PasswordStore* GetPasswordStore(ServiceAccessType access) = 0; 291c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 292c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the PrefService that manages the preferences 293c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // for this user profile. The PrefService is lazily created the first 294c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // time that this method is called. 295c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual PrefService* GetPrefs() = 0; 296c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 29772a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Retrieves a pointer to the PrefService that manages the preferences 29872a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // for OffTheRecord Profiles. This PrefService is lazily created the first 29972a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // time that this method is called. 30072a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen virtual PrefService* GetOffTheRecordPrefs() = 0; 30172a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 302c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the TemplateURLModel for this profile. This is owned by the 303c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the Profile. 304c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual TemplateURLModel* GetTemplateURLModel() = 0; 305c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 306c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the TemplateURLFetcher for this profile. This is owned by the 307c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. 308c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual TemplateURLFetcher* GetTemplateURLFetcher() = 0; 309c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 310c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the DownloadManager associated with this profile. 311c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual DownloadManager* GetDownloadManager() = 0; 312c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual bool HasCreatedDownloadManager() const = 0; 313c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 314c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the PersonalDataManager associated with this profile. 315c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual PersonalDataManager* GetPersonalDataManager() = 0; 316c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 3174a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch // Returns the FileSystemContext associated to this profile. The context 3184a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch // is lazily created the first time this method is called. This is owned 3194a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch // by the profile. 32072a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; 3213345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 322513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch // Returns the BrowserSignin object assigned to this profile. 323513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch virtual BrowserSignin* GetBrowserSignin() = 0; 324513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch 325c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Init our themes system. 326c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void InitThemes() = 0; 327c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 328c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Set the theme to the specified extension. 329513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch virtual void SetTheme(const Extension* extension) = 0; 330c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 331c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Set the theme to the machine's native theme. 332c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void SetNativeTheme() = 0; 333c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 334c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Clear the theme and reset it to default. 335c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void ClearTheme() = 0; 336c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 337c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Gets the theme that was last set. Returns NULL if the theme is no longer 338c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // installed, if there is no installed theme, or the theme was cleared. 339513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch virtual const Extension* GetTheme() = 0; 340c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 341c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns or creates the ThemeProvider associated with this profile 342c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual BrowserThemeProvider* GetThemeProvider() = 0; 343c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 344c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the request context information associated with this profile. Call 345c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // this only on the UI thread, since it can send notifications that should 346c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // happen on the UI thread. 347c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual URLRequestContextGetter* GetRequestContext() = 0; 348c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 349c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the request context for media resources asociated with this 350c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. 351c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual URLRequestContextGetter* GetRequestContextForMedia() = 0; 352c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 353c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the request context used for extension-related requests. This 354c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // is only used for a separate cookie store currently. 355c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual URLRequestContextGetter* GetRequestContextForExtensions() = 0; 356c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 35721d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen // Called by the ExtensionService that lives in this profile. Gives the 358c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile a chance to react to the load event before the EXTENSION_LOADED 359c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // notification has fired. The purpose for handling this event first is to 360c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // avoid race conditions by making sure URLRequestContexts learn about new 361c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // extensions before anything else needs them to know. 362513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch virtual void RegisterExtensionWithRequestContexts( 363513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch const Extension* extension) {} 364c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 36521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen // Called by the ExtensionService that lives in this profile. Lets the 366c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile clean up its RequestContexts once all the listeners to the 367c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // EXTENSION_UNLOADED notification have finished running. 368513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch virtual void UnregisterExtensionWithRequestContexts( 369513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch const Extension* extension) {} 370c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 371c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the SSLConfigService for this profile. 372c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual net::SSLConfigService* GetSSLConfigService() = 0; 373c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 374c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the Hostname <-> Content settings map for this profile. 375c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0; 376c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 377c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the Hostname <-> Zoom Level map for this profile. 378c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual HostZoomMap* GetHostZoomMap() = 0; 379c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 380c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the geolocation settings map for this profile. 381c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual GeolocationContentSettingsMap* GetGeolocationContentSettingsMap() = 0; 382c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 383c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the geolocation permission context for this profile. 384c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; 385c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 386c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the user style sheet watcher. 387c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() = 0; 388c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 389c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the find bar state for this profile. The find bar state is lazily 390c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // created the first time that this method is called. 391c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual FindBarState* GetFindBarState() = 0; 392c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 393c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the session service for this profile. This may return NULL. If 394c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // this profile supports a session service (it isn't off the record), and 395c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the session service hasn't yet been created, this forces creation of 396c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the session service. 397c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 398c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // This returns NULL in two situations: the profile is off the record, or the 399c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // session service has been explicitly shutdown (browser is exiting). Callers 400c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // should always check the return value for NULL. 401c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual SessionService* GetSessionService() = 0; 402c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 403c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // If this profile has a session service, it is shut down. To properly record 404c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the current state this forces creation of the session service, then shuts 405c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // it down. 406c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void ShutdownSessionService() = 0; 407c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 408c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns true if this profile has a session service. 409c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual bool HasSessionService() const = 0; 410c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 411513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch // Returns true if this profile has a profile sync service. 412513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch virtual bool HasProfileSyncService() const = 0; 413513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch 414c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns true if the last time this profile was open it was exited cleanly. 415c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual bool DidLastSessionExitCleanly() = 0; 416c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 417c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the BookmarkModel, creating if not yet created. 418c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual BookmarkModel* GetBookmarkModel() = 0; 419c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 420dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // Returns the ProtocolHandlerRegistry, creating if not yet created. 421dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() = 0; 422dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen 423c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the Gaia Token Service, creating if not yet created. 424c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual TokenService* GetTokenService() = 0; 425c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 426c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the ProfileSyncService, creating if not yet created. 427c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual ProfileSyncService* GetProfileSyncService() = 0; 428c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 4293345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // Returns the ProfileSyncService, creating if not yet created, with 4303345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // the specified CrOS username. 4313345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick virtual ProfileSyncService* GetProfileSyncService( 4323345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick const std::string& cros_user) = 0; 4333345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 434c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the CloudPrintProxyService, creating if not yet created. 435c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual CloudPrintProxyService* GetCloudPrintProxyService() = 0; 436c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 437c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Return whether 2 profiles are the same. 2 profiles are the same if they 438c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // represent the same profile. This can happen if there is pointer equality 439c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // or if one profile is the off the record version of another profile (or vice 440c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // versa). 441c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual bool IsSameProfile(Profile* profile) = 0; 442c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 443c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the time the profile was started. This is not the time the profile 444c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // was created, rather it is the time the user started chrome and logged into 445c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // this profile. For the single profile case, this corresponds to the time 446c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the user started chrome. 447c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual base::Time GetStartTime() const = 0; 448c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 449c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the TabRestoreService. This returns NULL when off the record. 450c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual TabRestoreService* GetTabRestoreService() = 0; 451c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 452c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void ResetTabRestoreService() = 0; 453c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 454c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // May return NULL. 455c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual SpellCheckHost* GetSpellCheckHost() = 0; 456c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 457c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // If |force| is false, and the spellchecker is already initialized (or is in 458c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the process of initializing), then do nothing. Otherwise clobber the 459c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // current spellchecker and replace it with a new one. 460c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void ReinitializeSpellCheckHost(bool force) = 0; 461c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 462c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the WebKitContext assigned to this profile. 463c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual WebKitContext* GetWebKitContext() = 0; 464c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 465c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the provider of desktop notifications for this profile. 466c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual DesktopNotificationService* GetDesktopNotificationService() = 0; 467c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 468c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the service that manages BackgroundContents for this profile. 4694a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch virtual BackgroundContentsService* GetBackgroundContentsService() const = 0; 470c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 4713345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // Returns the StatusTray, which provides an API for displaying status icons 4723345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // in the system status tray. Returns NULL if status icons are not supported 4733345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // on this platform (or this is a unit test). 4743345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick virtual StatusTray* GetStatusTray() = 0; 4753345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 476c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Marks the profile as cleanly shutdown. 477c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 478c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // NOTE: this is invoked internally on a normal shutdown, but is public so 479c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // that it can be invoked when the user logs out/powers down (WM_ENDSESSION). 480c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void MarkAsCleanShutdown() = 0; 481c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 482c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void InitExtensions() = 0; 483c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 484dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // Start up service that gathers data from a promo resource feed. 485dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual void InitPromoResources() = 0; 486dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen 487dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // Register URLRequestFactories for protocols registered with 488dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // registerProtocolHandler. 489dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual void InitRegisteredProtocolHandlers() = 0; 490c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 491c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the new tab page resource cache. 492c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual NTPResourceCache* GetNTPResourceCache() = 0; 493c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 494c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the last directory that was chosen for uploading or opening a file. 495c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual FilePath last_selected_directory() = 0; 496c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void set_last_selected_directory(const FilePath& path) = 0; 497c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 4983345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // Returns a pointer to the ChromeBlobStorageContext instance for this 4993345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // profile. 5003345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick virtual ChromeBlobStorageContext* GetBlobStorageContext() = 0; 5013345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 502731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick // Returns the IO-thread-accessible profile data for this profile. 503731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick virtual ExtensionInfoMap* GetExtensionInfoMap() = 0; 504731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick 5054a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch // Returns the PromoCounter for Instant, or NULL if not applicable. 5064a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch virtual PromoCounter* GetInstantPromoCounter() = 0; 5074a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch 508dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // Gets the policy connector associated with this profile. 509dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual policy::ProfilePolicyConnector* GetPolicyConnector() = 0; 510201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch 51172a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Returns the ChromeURLDataManager for this profile. 51272a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen virtual ChromeURLDataManager* GetChromeURLDataManager() = 0; 51372a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 5143345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#if defined(OS_CHROMEOS) 51572a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen enum AppLocaleChangedVia { 51672a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Caused by chrome://settings change. 51772a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen APP_LOCALE_CHANGED_VIA_SETTINGS, 51872a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Locale has been reverted via LocaleChangeGuard. 51972a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen APP_LOCALE_CHANGED_VIA_REVERT, 52072a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // From login screen. 52172a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen APP_LOCALE_CHANGED_VIA_LOGIN, 52272a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Source unknown. 52372a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen APP_LOCALE_CHANGED_VIA_UNKNOWN 52472a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen }; 52572a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 52672a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Changes application locale for a profile. 52772a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen virtual void ChangeAppLocale( 52872a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen const std::string& locale, AppLocaleChangedVia via) = 0; 52972a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 530dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // Called after login. 531dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual void OnLogin() = 0; 532dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen 5333345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // Returns ChromeOS's ProxyConfigServiceImpl, creating if not yet created. 5343345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick virtual chromeos::ProxyConfigServiceImpl* 5353345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick GetChromeOSProxyConfigServiceImpl() = 0; 53621d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen 53721d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen // Creates ChromeOS's EnterpriseExtensionListener. 53821d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen virtual void SetupChromeOSEnterpriseExtensionObserver() = 0; 53921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen 540dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // Initializes Chrome OS's preferences. 541dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual void InitChromeOSPreferences() = 0; 542dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen 5433345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#endif // defined(OS_CHROMEOS) 5443345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 545201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch // Returns the helper object that provides the proxy configuration service 546201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch // access to the the proxy configuration possibly defined by preferences. 547201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch virtual PrefProxyConfigTracker* GetProxyConfigTracker() = 0; 548201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch 54921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen // Returns the PrerenderManager used to prerender entire webpages for this 55021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen // profile. 551dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual prerender::PrerenderManager* GetPrerenderManager() = 0; 55221d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen 55372a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Returns whether it is a guest session. 55472a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen static bool IsGuestSession(); 55572a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 556c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#ifdef UNIT_TEST 557c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Use with caution. GetDefaultRequestContext may be called on any thread! 558c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch static void set_default_request_context(URLRequestContextGetter* c) { 559c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch default_request_context_ = c; 560c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 561c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#endif 562c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 563c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Did the user restore the last session? This is set by SessionRestore. 564c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch void set_restored_last_session(bool restored_last_session) { 565c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch restored_last_session_ = restored_last_session; 566c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 567c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch bool restored_last_session() const { 568c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch return restored_last_session_; 569c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 570c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 571c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Stop sending accessibility events until ResumeAccessibilityEvents(). 572c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Calls to Pause nest; no events will be sent until the number of 573c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Resume calls matches the number of Pause calls received. 574c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch void PauseAccessibilityEvents() { 575c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch accessibility_pause_level_++; 576c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 577c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 578c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch void ResumeAccessibilityEvents() { 579c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch DCHECK(accessibility_pause_level_ > 0); 580c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch accessibility_pause_level_--; 581c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 582c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 583c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch bool ShouldSendAccessibilityEvents() { 584c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch return 0 == accessibility_pause_level_; 585c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 586c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 587c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Checks whether sync is configurable by the user. Returns false if sync is 588c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // disabled or controlled by configuration management. 589c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch bool IsSyncAccessible(); 590c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 5913345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // Creates an OffTheRecordProfile which points to this Profile. 5923345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick Profile* CreateOffTheRecordProfile(); 5933345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 594c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch protected: 59572a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen friend class OffTheRecordProfileImpl; 59672a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 597c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch static URLRequestContextGetter* default_request_context_; 598c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 599c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch private: 600c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch bool restored_last_session_; 601c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 602c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Accessibility events will only be propagated when the pause 603c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // level is zero. PauseAccessibilityEvents and ResumeAccessibilityEvents 604c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // increment and decrement the level, respectively, rather than set it to 605c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // true or false, so that calls can be nested. 606c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch int accessibility_pause_level_; 607c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch}; 608c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 60921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen#endif // CHROME_BROWSER_PROFILES_PROFILE_H_ 610