Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / profiles / profile.h
index 88720ed..dd74492 100644 (file)
 #include "base/basictypes.h"
 #include "base/containers/hash_tables.h"
 #include "base/logging.h"
+#include "components/domain_reliability/clear_mode.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/content_browser_client.h"
-#include "net/url_request/url_request_job_factory.h"
 
 class ChromeAppCacheService;
-class ExtensionService;
+class DevToolsNetworkController;
 class ExtensionSpecialStoragePolicy;
 class FaviconService;
 class HostContentSettingsMap;
-class PasswordStore;
 class PrefProxyConfigTracker;
 class PrefService;
 class PromoCounter;
 class ProtocolHandlerRegistry;
 class TestingProfile;
-class WebDataService;
 
 namespace android {
 class TabContentsProvider;
@@ -38,6 +36,10 @@ class SequencedTaskRunner;
 class Time;
 }
 
+namespace chrome {
+class ChromeZoomLevelPrefs;
+}
+
 namespace chrome_browser_net {
 class Predictor;
 }
@@ -51,12 +53,11 @@ namespace content {
 class WebUI;
 }
 
-namespace fileapi {
+namespace storage {
 class FileSystemContext;
 }
 
 namespace history {
-class ShortcutsBackend;
 class TopSites;
 }
 
@@ -69,7 +70,7 @@ class PrefRegistrySyncable;
 }
 
 // Instead of adding more members to Profile, consider creating a
-// BrowserContextKeyedService. See
+// KeyedService. See
 // http://dev.chromium.org/developers/design-documents/profile-architecture
 class Profile : public content::BrowserContext {
  public:
@@ -108,7 +109,7 @@ class Profile : public content::BrowserContext {
     CREATE_STATUS_CREATED,
     // Profile is created, extensions and promo resources are initialized.
     CREATE_STATUS_INITIALIZED,
-    // Profile creation (managed-user registration, generally) was canceled
+    // Profile creation (supervised-user registration, generally) was canceled
     // by the user.
     CREATE_STATUS_CANCELED,
     MAX_CREATE_STATUS  // For histogram display.
@@ -130,6 +131,12 @@ class Profile : public content::BrowserContext {
     EXIT_CRASHED,
   };
 
+  enum ProfileType {
+    REGULAR_PROFILE,  // Login user's normal profile
+    INCOGNITO_PROFILE,  // Login user's off-the-record profile
+    GUEST_PROFILE,  // Guest session's profile
+  };
+
   class Delegate {
    public:
     virtual ~Delegate();
@@ -142,18 +149,16 @@ class Profile : public content::BrowserContext {
 
   // Key used to bind profile to the widget with which it is associated.
   static const char kProfileKey[];
+  // Value representing no hosted domain in the kProfileHostedDomain preference.
+  static const char kNoHostedDomainFound[];
 
   Profile();
-  virtual ~Profile();
+  ~Profile() override;
 
   // Profile prefs are registered as soon as the prefs are loaded for the first
   // time.
   static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
 
-  // Gets task runner for I/O operations associated with |profile|.
-  static scoped_refptr<base::SequencedTaskRunner> GetTaskRunnerForProfile(
-      Profile* profile);
-
   // Create a new profile given a path. If |create_mode| is
   // CREATE_MODE_ASYNCHRONOUS then the profile is initialized asynchronously.
   static Profile* CreateProfile(const base::FilePath& path,
@@ -179,6 +184,9 @@ class Profile : public content::BrowserContext {
   // the browser frame.
   virtual std::string GetProfileName() = 0;
 
+  // Returns the profile type.
+  virtual ProfileType GetProfileType() const = 0;
+
   // Return the incognito version of this profile. The returned pointer
   // is owned by the receiving profile. If the receiving profile is off the
   // record, the same profile is returned.
@@ -198,8 +206,8 @@ class Profile : public content::BrowserContext {
   // profile is not incognito.
   virtual Profile* GetOriginalProfile() = 0;
 
-  // Returns whether the profile is managed (see ManagedUserService).
-  virtual bool IsManaged() = 0;
+  // Returns whether the profile is supervised (see SupervisedUserService).
+  virtual bool IsSupervised() = 0;
 
   // Returns a pointer to the TopSites (thumbnail manager) instance
   // for this profile.
@@ -208,12 +216,6 @@ class Profile : public content::BrowserContext {
   // Variant of GetTopSites that doesn't force creation.
   virtual history::TopSites* GetTopSitesWithoutCreating() = 0;
 
-  // DEPRECATED. Instead, use ExtensionSystem::extension_service().
-  // Retrieves a pointer to the ExtensionService associated with this
-  // profile. The ExtensionService is created at startup.
-  // TODO(yoz): remove this accessor (bug 104095).
-  virtual ExtensionService* GetExtensionService() = 0;
-
   // Accessor. The instance is created upon first access.
   virtual ExtensionSpecialStoragePolicy*
       GetExtensionSpecialStoragePolicy() = 0;
@@ -222,13 +224,18 @@ class Profile : public content::BrowserContext {
   // preferences for this user profile.
   virtual PrefService* GetPrefs() = 0;
 
+  // Retrieves a pointer to the PrefService that manages the default zoom
+  // level and the per-host zoom levels for this user profile.
+  // TODO(wjmaclean): Remove this when HostZoomMap migrates to StoragePartition.
+  virtual chrome::ChromeZoomLevelPrefs* GetZoomLevelPrefs();
+
   // Retrieves a pointer to the PrefService that manages the preferences
   // for OffTheRecord Profiles.  This PrefService is lazily created the first
   // time that this method is called.
   virtual PrefService* GetOffTheRecordPrefs() = 0;
 
   // Returns the main request context.
-  virtual net::URLRequestContextGetter* GetRequestContext() = 0;
+  virtual net::URLRequestContextGetter* GetRequestContext() override = 0;
 
   // Returns the request context used for extension-related requests.  This
   // is only used for a separate cookie store currently.
@@ -260,7 +267,8 @@ class Profile : public content::BrowserContext {
   // ContextBrowserClient to call this function.
   // TODO(ajwong): Remove once http://crbug.com/159193 is resolved.
   virtual net::URLRequestContextGetter* CreateRequestContext(
-      content::ProtocolHandlerMap* protocol_handlers) = 0;
+      content::ProtocolHandlerMap* protocol_handlers,
+      content::URLRequestInterceptorScopedVector request_interceptors) = 0;
 
   // Creates the net::URLRequestContextGetter for a StoragePartition. Should
   // only be called once per partition_path per ContentBrowserClient object.
@@ -271,7 +279,8 @@ class Profile : public content::BrowserContext {
   virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
       const base::FilePath& partition_path,
       bool in_memory,
-      content::ProtocolHandlerMap* protocol_handlers) = 0;
+      content::ProtocolHandlerMap* protocol_handlers,
+      content::URLRequestInterceptorScopedVector request_interceptors) = 0;
 
   // Returns the last directory that was chosen for uploading or opening a file.
   virtual base::FilePath last_selected_directory() = 0;
@@ -285,6 +294,8 @@ class Profile : public content::BrowserContext {
     APP_LOCALE_CHANGED_VIA_REVERT,
     // From login screen.
     APP_LOCALE_CHANGED_VIA_LOGIN,
+    // From login to a public session.
+    APP_LOCALE_CHANGED_VIA_PUBLIC_SESSION_LOGIN,
     // Source unknown.
     APP_LOCALE_CHANGED_VIA_UNKNOWN
   };
@@ -298,9 +309,6 @@ class Profile : public content::BrowserContext {
 
   // Initializes Chrome OS's preferences.
   virtual void InitChromeOSPreferences() = 0;
-
-  // True if the profile is for login session.
-  virtual bool IsLoginProfile() = 0;
 #endif  // defined(OS_CHROMEOS)
 
   // Returns the helper object that provides the proxy configuration service
@@ -310,6 +318,9 @@ class Profile : public content::BrowserContext {
   // Returns the Predictor object used for dns prefetch.
   virtual chrome_browser_net::Predictor* GetNetworkPredictor() = 0;
 
+  // Returns the DevToolsNetworkController for this profile.
+  virtual DevToolsNetworkController* GetDevToolsNetworkController() = 0;
+
   // Deletes all network related data since |time|. It deletes transport
   // security state since |time| and it also deletes HttpServerProperties data.
   // Works asynchronously, however if the |completion| callback is non-null, it
@@ -400,17 +411,9 @@ class Profile : public content::BrowserContext {
   DISALLOW_COPY_AND_ASSIGN(Profile);
 };
 
-#if defined(COMPILER_GCC)
-namespace BASE_HASH_NAMESPACE {
-
-template<>
-struct hash<Profile*> {
-  std::size_t operator()(Profile* const& p) const {
-    return reinterpret_cast<std::size_t>(p);
-  }
+// The comparator for profile pointers as key in a map.
+struct ProfileCompare {
+  bool operator()(Profile* a, Profile* b) const;
 };
 
-}  // namespace BASE_HASH_NAMESPACE
-#endif
-
 #endif  // CHROME_BROWSER_PROFILES_PROFILE_H_