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 11a1fe9c0450e6d56112949b33ef2f7491e0cf0f60Kristian Monsen#ifdef ANDROID 12a1fe9c0450e6d56112949b33ef2f7491e0cf0f60Kristian Monsen#include "base/base_api.h" 13a1fe9c0450e6d56112949b33ef2f7491e0cf0f60Kristian Monsen#endif 14c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#include "base/basictypes.h" 153345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#include "base/logging.h" 16d26447072f93114b19c75ae32e18a68487125c0cKristian Monsen#ifndef ANDROID 17ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen#include "chrome/common/extensions/extension.h" 18d26447072f93114b19c75ae32e18a68487125c0cKristian Monsen#endif 193345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 203345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merricknamespace base { 213345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrickclass Time; 223345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick} 23c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 24ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsennamespace content { 25ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsenclass ResourceContext; 263345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick} 27c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 28dc0f95d653279beabeb9817299e2902918ba123eKristian Monsennamespace fileapi { 29dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass FileSystemContext; 30dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass SandboxedFileSystemContext; 31dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen} 32dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen 33c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochnamespace history { 34c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass TopSites; 35c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 36c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 37c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochnamespace net { 38c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass TransportSecurityState; 39c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass SSLConfigService; 40c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 41c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 42201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdochnamespace policy { 43dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass ProfilePolicyConnector; 44201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch} 45201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch 46dc0f95d653279beabeb9817299e2902918ba123eKristian Monsennamespace prerender { 47dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass PrerenderManager; 48c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 49c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 50dc0f95d653279beabeb9817299e2902918ba123eKristian Monsennamespace webkit_database { 51dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass DatabaseTracker; 5221d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen} 5321d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen 54d26447072f93114b19c75ae32e18a68487125c0cKristian Monsen#ifdef ANDROID 55d26447072f93114b19c75ae32e18a68487125c0cKristian Monsenstruct UnloadedExtensionInfo { 56d26447072f93114b19c75ae32e18a68487125c0cKristian Monsen enum Reason { 57d26447072f93114b19c75ae32e18a68487125c0cKristian Monsen DISABLE, // The extension is being disabled. 58d26447072f93114b19c75ae32e18a68487125c0cKristian Monsen UPDATE, // The extension is being updated to a newer version. 59d26447072f93114b19c75ae32e18a68487125c0cKristian Monsen UNINSTALL, // The extension is being uninstalled. 60d26447072f93114b19c75ae32e18a68487125c0cKristian Monsen }; 61d26447072f93114b19c75ae32e18a68487125c0cKristian Monsen}; 62d26447072f93114b19c75ae32e18a68487125c0cKristian Monsen#endif 63d26447072f93114b19c75ae32e18a68487125c0cKristian Monsen 64c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass AutocompleteClassifier; 65c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass BookmarkModel; 66513209b27ff55e2841eac0e4120199c23acce758Ben Murdochclass BrowserSignin; 673345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrickclass ChromeAppCacheService; 683345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrickclass ChromeBlobStorageContext; 6972a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsenclass ChromeURLDataManager; 70731df977c0511bca2206b5f333555b1205ff1f43Iain Merrickclass CloudPrintProxyService; 71c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass DownloadManager; 72c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass Extension; 73c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass ExtensionDevToolsManager; 74731df977c0511bca2206b5f333555b1205ff1f43Iain Merrickclass ExtensionEventRouter; 7521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass ExtensionInfoMap; 76c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass ExtensionMessageService; 7772a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsenclass ExtensionPrefValueMap; 78731df977c0511bca2206b5f333555b1205ff1f43Iain Merrickclass ExtensionProcessManager; 7921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass ExtensionService; 80dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass ExtensionSpecialStoragePolicy; 81c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass FaviconService; 823345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrickclass FilePath; 83c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass FindBarState; 84c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass GeolocationContentSettingsMap; 85c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass GeolocationPermissionContext; 86c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass HistoryService; 87c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass HostContentSettingsMap; 88c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass HostZoomMap; 89c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass NTPResourceCache; 9021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass NavigationController; 91c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass PasswordStore; 92c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass PersonalDataManager; 93201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdochclass PrefProxyConfigTracker; 9421d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass PrefService; 95c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass ProfileSyncFactory; 9621d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass ProfileSyncService; 9721d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass PromoCounter; 98dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass ProtocolHandlerRegistry; 9921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass SQLitePersistentCookieStore; 100c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass SSLConfigServiceManager; 101c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass SSLHostState; 10221d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass SessionService; 10321d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass SpellCheckHost; 1043345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrickclass StatusTray; 105c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass TabRestoreService; 106c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass TemplateURLFetcher; 107c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass TemplateURLModel; 108c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass TokenService; 10921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass TransportSecurityPersister; 110c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass UserScriptMaster; 111c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass UserStyleSheetWatcher; 112c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass VisitedLinkEventListener; 11321d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenclass VisitedLinkMaster; 114c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass WebDataService; 115c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass WebKitContext; 116dc0f95d653279beabeb9817299e2902918ba123eKristian Monsenclass PromoResourceService; 117c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 118ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsennamespace net { 119ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsenclass URLRequestContextGetter; 120ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen} 121ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen 122c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochtypedef intptr_t ProfileId; 123c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 124a1fe9c0450e6d56112949b33ef2f7491e0cf0f60Kristian Monsenclass 125a1fe9c0450e6d56112949b33ef2f7491e0cf0f60Kristian Monsen#ifdef ANDROID 126a1fe9c0450e6d56112949b33ef2f7491e0cf0f60Kristian MonsenBASE_API 127a1fe9c0450e6d56112949b33ef2f7491e0cf0f60Kristian Monsen#endif 128a1fe9c0450e6d56112949b33ef2f7491e0cf0f60Kristian MonsenProfile { 129c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch public: 130c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Profile services are accessed with the following parameter. This parameter 131c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // defines what the caller plans to do with the service. 132c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // The caller is responsible for not performing any operation that would 133c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // result in persistent implicit records while using an OffTheRecord profile. 134c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // This flag allows the profile to perform an additional check. 135c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 136c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // It also gives us an opportunity to perform further checks in the future. We 137c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // could, for example, return an history service that only allow some specific 138c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // methods. 139c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch enum ServiceAccessType { 140c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // The caller plans to perform a read or write that takes place as a result 141c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // of the user input. Use this flag when the operation you are doing can be 142ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // performed while incognito. (ex: creating a bookmark) 143c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 144c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Since EXPLICIT_ACCESS means "as a result of a user action", this request 145c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // always succeeds. 146c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch EXPLICIT_ACCESS, 147c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 148c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // The caller plans to call a method that will permanently change some data 149c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // in the profile, as part of Chrome's implicit data logging. Use this flag 150c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // when you are about to perform an operation which is incompatible with the 151ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // incognito mode. 152c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch IMPLICIT_ACCESS 153c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch }; 154c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 155ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen class Delegate { 156ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen public: 157ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // Called when creation of the profile is finished. 158ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen virtual void OnProfileCreated(Profile* profile, bool success) = 0; 159cb7fae5ad30624a97df1fe8c72c8484de3e465ddKristian Monsen#ifdef ANDROID 160cb7fae5ad30624a97df1fe8c72c8484de3e465ddKristian Monsen virtual ~Delegate() {} 161cb7fae5ad30624a97df1fe8c72c8484de3e465ddKristian Monsen#endif 162ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen }; 163ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen 16472a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Key used to bind profile to the widget with which it is associated. 16572a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen static const char* kProfileKey; 16672a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 167c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Value that represents no profile Id. 168dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen static const ProfileId kInvalidProfileId; 169c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 17021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen Profile(); 171c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual ~Profile() {} 172c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 173c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Profile prefs are registered as soon as the prefs are loaded for the first 174c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // time. 175c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch static void RegisterUserPrefs(PrefService* prefs); 176c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 177c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Create a new profile given a path. 178c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch static Profile* CreateProfile(const FilePath& path); 179c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 180ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // Same as above, but uses async initialization. 181ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen static Profile* CreateProfileAsync(const FilePath& path, 182ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen Delegate* delegate); 183ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen 184c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the request context for the "default" profile. This may be called 185c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // from any thread. This CAN return NULL if a first request context has not 186c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // yet been created. If necessary, listen on the UI thread for 187c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE. 188ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen static net::URLRequestContextGetter* GetDefaultRequestContext(); 189c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 190c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns a unique Id that can be used to identify this profile at runtime. 191c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // This Id is not persistent and will not survive a restart of the browser. 192c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual ProfileId GetRuntimeId() = 0; 193c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 194c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the path of the directory where this profile's data is stored. 195c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual FilePath GetPath() = 0; 196c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 197ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // Return whether this profile is incognito. Default is false. 198c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual bool IsOffTheRecord() = 0; 199c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 200ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // Return the incognito version of this profile. The returned pointer 201c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // is owned by the receiving profile. If the receiving profile is off the 202c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // record, the same profile is returned. 203c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual Profile* GetOffTheRecordProfile() = 0; 204c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 205ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // Destroys the incognito profile. 206c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void DestroyOffTheRecordProfile() = 0; 207c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 208ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // True if an incognito profile exists. 209c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual bool HasOffTheRecordProfile() = 0; 210c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 211c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Return the original "recording" profile. This method returns this if the 212ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // profile is not incognito. 213c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual Profile* GetOriginalProfile() = 0; 214c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 2153345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // Returns a pointer to the ChromeAppCacheService instance for this profile. 2163345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick virtual ChromeAppCacheService* GetAppCacheService() = 0; 2173345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 218c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns a pointer to the DatabaseTracker instance for this profile. 219c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; 220c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 221c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns a pointer to the TopSites (thumbnail manager) instance 222c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // for this profile. 223c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual history::TopSites* GetTopSites() = 0; 224c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 225513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch // Variant of GetTopSites that doesn't force creation. 226513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch virtual history::TopSites* GetTopSitesWithoutCreating() = 0; 227513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch 228c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the VisitedLinkMaster associated with this 229c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The VisitedLinkMaster is lazily created the first time 230c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // that this method is called. 231c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual VisitedLinkMaster* GetVisitedLinkMaster() = 0; 232c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 23321d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen // Retrieves a pointer to the ExtensionService associated with this 23421d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen // profile. The ExtensionService is created at startup. 23521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen virtual ExtensionService* GetExtensionService() = 0; 236c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 237c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the UserScriptMaster associated with this 238c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The UserScriptMaster is lazily created the first time 239c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // that this method is called. 240c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual UserScriptMaster* GetUserScriptMaster() = 0; 241c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 242c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the ExtensionDevToolsManager associated with this 243c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The instance is created at startup. 244c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() = 0; 245c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 246c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the ExtensionProcessManager associated with this 247c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The instance is created at startup. 248c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual ExtensionProcessManager* GetExtensionProcessManager() = 0; 249c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 250c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the ExtensionMessageService associated with this 251c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The instance is created at startup. 252c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual ExtensionMessageService* GetExtensionMessageService() = 0; 253c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 254731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick // Accessor. The instance is created at startup. 255731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick virtual ExtensionEventRouter* GetExtensionEventRouter() = 0; 256731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick 257dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // Accessor. The instance is created upon first access. 258dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual ExtensionSpecialStoragePolicy* 259dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen GetExtensionSpecialStoragePolicy() = 0; 26072a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 261c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the SSLHostState associated with this profile. 262c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // The SSLHostState is lazily created the first time that this method is 263c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // called. 264c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual SSLHostState* GetSSLHostState() = 0; 265c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 266c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the TransportSecurityState associated with 267c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // this profile. The TransportSecurityState is lazily created the 268c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // first time that this method is called. 26972a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen virtual net::TransportSecurityState* GetTransportSecurityState() = 0; 270c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 271c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the FaviconService associated with this 272c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The FaviconService is lazily created the first time 273c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // that this method is called. 274c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 275c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Although FaviconService is refcounted, this will not addref, and callers 276c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // do not need to do any reference counting as long as they keep the pointer 277c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // only for the local scope (which they should do anyway since the browser 278c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // process may decide to shut down). 279c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 280c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // |access| defines what the caller plans to do with the service. See 281c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the ServiceAccessType definition above. 282c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual FaviconService* GetFaviconService(ServiceAccessType access) = 0; 283c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 284c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the HistoryService associated with this 285c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The HistoryService is lazily created the first time 286c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // that this method is called. 287c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 288c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Although HistoryService is refcounted, this will not addref, and callers 289c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // do not need to do any reference counting as long as they keep the pointer 290c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // only for the local scope (which they should do anyway since the browser 291c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // process may decide to shut down). 292c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 293c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // |access| defines what the caller plans to do with the service. See 294c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the ServiceAccessType definition above. 295c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual HistoryService* GetHistoryService(ServiceAccessType access) = 0; 296c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 297c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Similar to GetHistoryService(), but won't create the history service if it 298c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // doesn't already exist. 299c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual HistoryService* GetHistoryServiceWithoutCreating() = 0; 300c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 301c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the AutocompleteClassifier associated with this 302c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. The AutocompleteClassifier is lazily created the first time that 303c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // this method is called. 304c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual AutocompleteClassifier* GetAutocompleteClassifier() = 0; 305c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 306c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the WebDataService for this profile. This is owned by 307c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the Profile. Callers that outlive the life of this profile need to be 308c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // sure they refcount the returned value. 309c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 310c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // |access| defines what the caller plans to do with the service. See 311c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the ServiceAccessType definition above. 312c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual WebDataService* GetWebDataService(ServiceAccessType access) = 0; 313c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 314c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Similar to GetWebDataService(), but won't create the web data service if it 315c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // doesn't already exist. 316c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual WebDataService* GetWebDataServiceWithoutCreating() = 0; 317c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 318c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the PasswordStore for this profile. This is owned by the Profile. 319c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual PasswordStore* GetPasswordStore(ServiceAccessType access) = 0; 320c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 321c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Retrieves a pointer to the PrefService that manages the preferences 322c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // for this user profile. The PrefService is lazily created the first 323c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // time that this method is called. 324c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual PrefService* GetPrefs() = 0; 325c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 32672a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Retrieves a pointer to the PrefService that manages the preferences 32772a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // for OffTheRecord Profiles. This PrefService is lazily created the first 32872a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // time that this method is called. 32972a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen virtual PrefService* GetOffTheRecordPrefs() = 0; 33072a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 331c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the TemplateURLModel for this profile. This is owned by the 332c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the Profile. 333c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual TemplateURLModel* GetTemplateURLModel() = 0; 334c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 335c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the TemplateURLFetcher for this profile. This is owned by the 336c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. 337c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual TemplateURLFetcher* GetTemplateURLFetcher() = 0; 338c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 339c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the DownloadManager associated with this profile. 340c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual DownloadManager* GetDownloadManager() = 0; 341c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual bool HasCreatedDownloadManager() const = 0; 342c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 343c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the PersonalDataManager associated with this profile. 344c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual PersonalDataManager* GetPersonalDataManager() = 0; 345c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 3464a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch // Returns the FileSystemContext associated to this profile. The context 3474a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch // is lazily created the first time this method is called. This is owned 3484a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch // by the profile. 34972a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; 3503345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 351513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch // Returns the BrowserSignin object assigned to this profile. 352513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch virtual BrowserSignin* GetBrowserSignin() = 0; 353513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch 354c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the request context information associated with this profile. Call 355c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // this only on the UI thread, since it can send notifications that should 356c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // happen on the UI thread. 357ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen virtual net::URLRequestContextGetter* GetRequestContext() = 0; 358ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen 359ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // Returns the request context appropriate for the given app. If installed_app 360ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // is null or installed_app->is_storage_isolated() returns false, this is 361ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // equivalent to calling GetRequestContext(). 362ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // TODO(creis): After isolated app storage is no longer an experimental 363ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // feature, consider making this the default contract for GetRequestContext. 364ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen virtual net::URLRequestContextGetter* GetRequestContextForPossibleApp( 365ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen const Extension* installed_app) = 0; 366c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 367c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the request context for media resources asociated with this 368c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile. 369ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen virtual net::URLRequestContextGetter* GetRequestContextForMedia() = 0; 370c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 371c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the request context used for extension-related requests. This 372c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // is only used for a separate cookie store currently. 373ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen virtual net::URLRequestContextGetter* GetRequestContextForExtensions() = 0; 374ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen 375ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // Returns the request context used within an installed app that has 376ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // requested isolated storage. 377ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp( 378ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen const std::string& app_id) = 0; 379ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen 380d26447072f93114b19c75ae32e18a68487125c0cKristian Monsen#ifndef ANDROID 381ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen virtual const content::ResourceContext& GetResourceContext() = 0; 382d26447072f93114b19c75ae32e18a68487125c0cKristian Monsen#endif 383c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 38421d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen // Called by the ExtensionService that lives in this profile. Gives the 385c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile a chance to react to the load event before the EXTENSION_LOADED 386c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // notification has fired. The purpose for handling this event first is to 387c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // avoid race conditions by making sure URLRequestContexts learn about new 388c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // extensions before anything else needs them to know. 389513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch virtual void RegisterExtensionWithRequestContexts( 390513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch const Extension* extension) {} 391c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 39221d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen // Called by the ExtensionService that lives in this profile. Lets the 393c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // profile clean up its RequestContexts once all the listeners to the 394c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // EXTENSION_UNLOADED notification have finished running. 395513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch virtual void UnregisterExtensionWithRequestContexts( 396ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen const std::string& extension_id, 397ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen const UnloadedExtensionInfo::Reason) {} 398c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 399c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the SSLConfigService for this profile. 400c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual net::SSLConfigService* GetSSLConfigService() = 0; 401c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 402c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the Hostname <-> Content settings map for this profile. 403c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0; 404c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 405c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the Hostname <-> Zoom Level map for this profile. 406c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual HostZoomMap* GetHostZoomMap() = 0; 407c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 408c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the geolocation settings map for this profile. 409c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual GeolocationContentSettingsMap* GetGeolocationContentSettingsMap() = 0; 410c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 411c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the geolocation permission context for this profile. 412c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; 413c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 414c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the user style sheet watcher. 415c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() = 0; 416c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 417c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the find bar state for this profile. The find bar state is lazily 418c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // created the first time that this method is called. 419c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual FindBarState* GetFindBarState() = 0; 420c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 421c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the session service for this profile. This may return NULL. If 422ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // this profile supports a session service (it isn't incognito), and 423c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the session service hasn't yet been created, this forces creation of 424c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the session service. 425c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 426ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // This returns NULL in two situations: the profile is incognito, or the 427c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // session service has been explicitly shutdown (browser is exiting). Callers 428c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // should always check the return value for NULL. 429c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual SessionService* GetSessionService() = 0; 430c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 431c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // If this profile has a session service, it is shut down. To properly record 432c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the current state this forces creation of the session service, then shuts 433c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // it down. 434c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void ShutdownSessionService() = 0; 435c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 436c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns true if this profile has a session service. 437c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual bool HasSessionService() const = 0; 438c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 439513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch // Returns true if this profile has a profile sync service. 440513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch virtual bool HasProfileSyncService() const = 0; 441513209b27ff55e2841eac0e4120199c23acce758Ben Murdoch 442c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns true if the last time this profile was open it was exited cleanly. 443c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual bool DidLastSessionExitCleanly() = 0; 444c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 445c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the BookmarkModel, creating if not yet created. 446c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual BookmarkModel* GetBookmarkModel() = 0; 447c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 448dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // Returns the ProtocolHandlerRegistry, creating if not yet created. 449dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() = 0; 450dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen 451c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the Gaia Token Service, creating if not yet created. 452c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual TokenService* GetTokenService() = 0; 453c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 454c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the ProfileSyncService, creating if not yet created. 455c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual ProfileSyncService* GetProfileSyncService() = 0; 456c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 4573345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // Returns the ProfileSyncService, creating if not yet created, with 4583345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // the specified CrOS username. 4593345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick virtual ProfileSyncService* GetProfileSyncService( 4603345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick const std::string& cros_user) = 0; 4613345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 462c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the CloudPrintProxyService, creating if not yet created. 463c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual CloudPrintProxyService* GetCloudPrintProxyService() = 0; 464c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 465c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Return whether 2 profiles are the same. 2 profiles are the same if they 466c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // represent the same profile. This can happen if there is pointer equality 467ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // or if one profile is the incognito version of another profile (or vice 468c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // versa). 469c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual bool IsSameProfile(Profile* profile) = 0; 470c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 471c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the time the profile was started. This is not the time the profile 472c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // was created, rather it is the time the user started chrome and logged into 473c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // this profile. For the single profile case, this corresponds to the time 474c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the user started chrome. 475c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual base::Time GetStartTime() const = 0; 476c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 477ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // Returns the TabRestoreService. This returns NULL when incognito. 478c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual TabRestoreService* GetTabRestoreService() = 0; 479c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 480c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void ResetTabRestoreService() = 0; 481c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 482c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // May return NULL. 483c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual SpellCheckHost* GetSpellCheckHost() = 0; 484c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 485c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // If |force| is false, and the spellchecker is already initialized (or is in 486c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // the process of initializing), then do nothing. Otherwise clobber the 487c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // current spellchecker and replace it with a new one. 488c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void ReinitializeSpellCheckHost(bool force) = 0; 489c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 490c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the WebKitContext assigned to this profile. 491c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual WebKitContext* GetWebKitContext() = 0; 492c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 4933345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // Returns the StatusTray, which provides an API for displaying status icons 4943345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // in the system status tray. Returns NULL if status icons are not supported 4953345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // on this platform (or this is a unit test). 4963345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick virtual StatusTray* GetStatusTray() = 0; 4973345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 498c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Marks the profile as cleanly shutdown. 499c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // 500c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // NOTE: this is invoked internally on a normal shutdown, but is public so 501c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // that it can be invoked when the user logs out/powers down (WM_ENDSESSION). 502c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void MarkAsCleanShutdown() = 0; 503c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 504ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // Initializes extensions machinery. 505ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // Component extensions are always enabled, external and user extensions 506ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen // are controlled by |extensions_enabled|. 507ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen virtual void InitExtensions(bool extensions_enabled) = 0; 508c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 509dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // Start up service that gathers data from a promo resource feed. 510dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual void InitPromoResources() = 0; 511dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen 512dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // Register URLRequestFactories for protocols registered with 513dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // registerProtocolHandler. 514dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual void InitRegisteredProtocolHandlers() = 0; 515c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 516c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the new tab page resource cache. 517c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual NTPResourceCache* GetNTPResourceCache() = 0; 518c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 519c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Returns the last directory that was chosen for uploading or opening a file. 520c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual FilePath last_selected_directory() = 0; 521c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch virtual void set_last_selected_directory(const FilePath& path) = 0; 522c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 5233345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // Returns a pointer to the ChromeBlobStorageContext instance for this 5243345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // profile. 5253345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick virtual ChromeBlobStorageContext* GetBlobStorageContext() = 0; 5263345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 527731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick // Returns the IO-thread-accessible profile data for this profile. 528731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick virtual ExtensionInfoMap* GetExtensionInfoMap() = 0; 529731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick 5304a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch // Returns the PromoCounter for Instant, or NULL if not applicable. 5314a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch virtual PromoCounter* GetInstantPromoCounter() = 0; 5324a5e2dc747d50c653511c68ccb2cfbfb740bd5a7Ben Murdoch 533dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // Gets the policy connector associated with this profile. 534dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual policy::ProfilePolicyConnector* GetPolicyConnector() = 0; 535201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch 53672a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Returns the ChromeURLDataManager for this profile. 53772a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen virtual ChromeURLDataManager* GetChromeURLDataManager() = 0; 53872a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 5393345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#if defined(OS_CHROMEOS) 54072a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen enum AppLocaleChangedVia { 54172a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Caused by chrome://settings change. 54272a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen APP_LOCALE_CHANGED_VIA_SETTINGS, 54372a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Locale has been reverted via LocaleChangeGuard. 54472a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen APP_LOCALE_CHANGED_VIA_REVERT, 54572a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // From login screen. 54672a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen APP_LOCALE_CHANGED_VIA_LOGIN, 54772a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Source unknown. 54872a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen APP_LOCALE_CHANGED_VIA_UNKNOWN 54972a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen }; 55072a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 55172a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Changes application locale for a profile. 55272a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen virtual void ChangeAppLocale( 55372a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen const std::string& locale, AppLocaleChangedVia via) = 0; 55472a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 555dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // Called after login. 556dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual void OnLogin() = 0; 557dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen 55821d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen // Creates ChromeOS's EnterpriseExtensionListener. 55921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen virtual void SetupChromeOSEnterpriseExtensionObserver() = 0; 56021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen 561dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen // Initializes Chrome OS's preferences. 562dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual void InitChromeOSPreferences() = 0; 5633345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#endif // defined(OS_CHROMEOS) 5643345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 565201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch // Returns the helper object that provides the proxy configuration service 566201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch // access to the the proxy configuration possibly defined by preferences. 567201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch virtual PrefProxyConfigTracker* GetProxyConfigTracker() = 0; 568201ade2fbba22bfb27ae029f4d23fca6ded109a0Ben Murdoch 56921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen // Returns the PrerenderManager used to prerender entire webpages for this 57021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen // profile. 571dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen virtual prerender::PrerenderManager* GetPrerenderManager() = 0; 57221d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen 57372a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen // Returns whether it is a guest session. 57472a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen static bool IsGuestSession(); 57572a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 576c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#ifdef UNIT_TEST 577c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Use with caution. GetDefaultRequestContext may be called on any thread! 578ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen static void set_default_request_context(net::URLRequestContextGetter* c) { 579c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch default_request_context_ = c; 580c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 581c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#endif 582c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 583c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Did the user restore the last session? This is set by SessionRestore. 584c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch void set_restored_last_session(bool restored_last_session) { 585c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch restored_last_session_ = restored_last_session; 586c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 587c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch bool restored_last_session() const { 588c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch return restored_last_session_; 589c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 590c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 591c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Stop sending accessibility events until ResumeAccessibilityEvents(). 592c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Calls to Pause nest; no events will be sent until the number of 593c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Resume calls matches the number of Pause calls received. 594c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch void PauseAccessibilityEvents() { 595c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch accessibility_pause_level_++; 596c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 597c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 598c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch void ResumeAccessibilityEvents() { 599c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch DCHECK(accessibility_pause_level_ > 0); 600c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch accessibility_pause_level_--; 601c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 602c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 603c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch bool ShouldSendAccessibilityEvents() { 604c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch return 0 == accessibility_pause_level_; 605c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 606c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 607c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Checks whether sync is configurable by the user. Returns false if sync is 608c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // disabled or controlled by configuration management. 609c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch bool IsSyncAccessible(); 610c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 6113345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // Creates an OffTheRecordProfile which points to this Profile. 6123345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick Profile* CreateOffTheRecordProfile(); 6133345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 614c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch protected: 61572a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen friend class OffTheRecordProfileImpl; 61672a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 617ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen static net::URLRequestContextGetter* default_request_context_; 618c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 619c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch private: 620c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch bool restored_last_session_; 621c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 622c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Accessibility events will only be propagated when the pause 623c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // level is zero. PauseAccessibilityEvents and ResumeAccessibilityEvents 624c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // increment and decrement the level, respectively, rather than set it to 625c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // true or false, so that calls can be nested. 626c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch int accessibility_pause_level_; 627c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch}; 628c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 62921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen#endif // CHROME_BROWSER_PROFILES_PROFILE_H_ 630