Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / extensions / common / extension.h
index cf5e85c..47f85f3 100644 (file)
 #include "ui/gfx/size.h"
 #include "url/gurl.h"
 
-class ExtensionAction;
-class SkBitmap;
-
 namespace base {
 class DictionaryValue;
 class Version;
 }
 
-namespace gfx {
-class ImageSkia;
-}
-
 namespace extensions {
 class PermissionSet;
 class PermissionsData;
@@ -69,9 +62,9 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
     // An external extension that the user uninstalled. We should not reinstall
     // such extensions on startup.
     EXTERNAL_EXTENSION_UNINSTALLED,
-    // Special state for component extensions, since they are always loaded by
-    // the component loader, and should never be auto-installed on startup.
-    ENABLED_COMPONENT,
+    // DEPRECATED: Special state for component extensions.
+    // Maintained as a placeholder since states may be stored to disk.
+    ENABLED_COMPONENT_DEPRECATED,
     NUM_STATES
   };
 
@@ -84,6 +77,10 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
     DEPRECATED_DISABLE_LAST,  // Not used.
   };
 
+  // Reasons an extension may be disabled. These are used in histograms, so do
+  // not remove/reorder entries - only add at the end just before
+  // DISABLE_REASON_LAST (and update the shift value for it). Also remember to
+  // update the enum listing in tools/metrics/histograms.xml.
   enum DisableReason {
     DISABLE_NONE = 0,
     DISABLE_USER_ACTION = 1 << 0,
@@ -92,21 +89,16 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
     DISABLE_UNSUPPORTED_REQUIREMENT = 1 << 3,
     DISABLE_SIDELOAD_WIPEOUT = 1 << 4,
     DISABLE_UNKNOWN_FROM_SYNC = 1 << 5,
-    DISABLE_PERMISSIONS_CONSENT = 1 << 6,  // Unused - abandoned experiment.
-    DISABLE_KNOWN_DISABLED = 1 << 7,
+    // DISABLE_PERMISSIONS_CONSENT = 1 << 6,  // Deprecated.
+    // DISABLE_KNOWN_DISABLED = 1 << 7,  // Deprecated.
     DISABLE_NOT_VERIFIED = 1 << 8,  // Disabled because we could not verify
                                     // the install.
     DISABLE_GREYLIST = 1 << 9,
     DISABLE_CORRUPTED = 1 << 10,
-    DISABLE_REMOTE_INSTALL = 1 << 11
-  };
-
-  enum InstallType {
-    INSTALL_ERROR,
-    DOWNGRADE,
-    REINSTALL,
-    UPGRADE,
-    NEW_INSTALL
+    DISABLE_REMOTE_INSTALL = 1 << 11,
+    DISABLE_INACTIVE_EPHEMERAL_APP = 1 << 12,  // Cached ephemeral apps are
+                                               // disabled to prevent activity.
+    DISABLE_REASON_LAST = 1 << 13,  // This should always be the last value
   };
 
   // A base class for parsed manifest data that APIs want to store on
@@ -170,6 +162,10 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
     // also installed by Default (i.e. WAS_INSTALLED_BY_DEFAULT is also true).
     WAS_INSTALLED_BY_OEM = 1 << 10,
 
+    // |WAS_INSTALLED_BY_CUSTODIAN| means this extension was installed by the
+    // custodian of a supervised user.
+    WAS_INSTALLED_BY_CUSTODIAN = 1 << 11,
+
     // When adding new flags, make sure to update kInitFromValueFlagBits.
   };
 
@@ -334,21 +330,24 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
   bool was_installed_by_oem() const {
     return (creation_flags_ & WAS_INSTALLED_BY_OEM) != 0;
   }
+  bool was_installed_by_custodian() const {
+    return (creation_flags_ & WAS_INSTALLED_BY_CUSTODIAN) != 0;
+  }
 
-  // App-related.
+  // Type-related queries.
   bool is_app() const;
   bool is_platform_app() const;
   bool is_hosted_app() const;
   bool is_legacy_packaged_app() const;
   bool is_extension() const;
+  bool is_shared_module() const;
+  bool is_theme() const;
+
   bool can_be_incognito_enabled() const;
 
   void AddWebExtentPattern(const URLPattern& pattern);
   const URLPatternSet& web_extent() const { return extent_; }
 
-  // Theme-related.
-  bool is_theme() const;
-
  private:
   friend class base::RefCountedThreadSafe<Extension>;