summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extensions_service.h
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-09 16:35:18 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-09 16:35:18 +0000
commitec5b50d6d76fc975f0e7b5e037f28974e13cabb5 (patch)
tree9643090a68cd8ff404aae0c79330822a855d5270 /chrome/browser/extensions/extensions_service.h
parente161c191f63808fb0503af5ab05ae5ac176ecfe9 (diff)
downloadchromium_src-ec5b50d6d76fc975f0e7b5e037f28974e13cabb5.zip
chromium_src-ec5b50d6d76fc975f0e7b5e037f28974e13cabb5.tar.gz
chromium_src-ec5b50d6d76fc975f0e7b5e037f28974e13cabb5.tar.bz2
Implement new strategy for default apps. Instead of using
the component extension system, simply install them as normal apps the first time Chrome runs. Remove the old style default apps. This also removes support for --disable-apps, which doesn't seem necessary since we already have --disable-extensions. BUG=53972 TEST=Uninstall any installed apps. Remove the "default_apps_installed" and "app_promo_counter" keys from Preferences if they are present. Start Chrome with the --enable-default-apps flag, navigate to chrome://extensions/, and click "update now" in the developer tools. This is to make the updater grab the apps from the store quicker, so that you don't have to wait while testing. Normally Chrome would do this by itself after 5-40 mins. Go to NTP. You should see gmail, calendar, and docs default apps show up along with the promo (the text that says "New! A world of ..."). Refresh the NTP 10 times. The promo should go away on the 10th time. There are other details. To test each of these, remove all installed apps and remove the keys from the preferences to reset the state. * If you close Chrome before getting the default apps. They should still show up the next time Chrome is started (after clicking 'Update now') * Clicking "hide this message" should hide the promo and it shouldn't come back on refresh. * Installing or uninstalling any app should hide the promo, and it shouldn't come back. * If the keys from the preferences are removed, but apps are left installed, the default apps should not be installed when clicking 'update now'. * The default apps should only be installed in locale en-US. Review URL: http://codereview.chromium.org/3522015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62084 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extensions_service.h')
-rw-r--r--chrome/browser/extensions/extensions_service.h30
1 files changed, 24 insertions, 6 deletions
diff --git a/chrome/browser/extensions/extensions_service.h b/chrome/browser/extensions/extensions_service.h
index 71fbfd9..10f54c6 100644
--- a/chrome/browser/extensions/extensions_service.h
+++ b/chrome/browser/extensions/extensions_service.h
@@ -20,6 +20,7 @@
#include "base/time.h"
#include "base/tuple.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/extensions/default_apps.h"
#include "chrome/browser/extensions/extension_icon_manager.h"
#include "chrome/browser/extensions/extension_menu_manager.h"
#include "chrome/browser/extensions/extension_prefs.h"
@@ -51,6 +52,7 @@ struct PendingExtensionInfo {
enum ExpectedCrxType {
UNKNOWN, // Sometimes we don't know the type of a pending item. An
// update URL from external_extensions.json is one such case.
+ APP,
THEME,
EXTENSION
};
@@ -60,7 +62,8 @@ struct PendingExtensionInfo {
bool is_from_sync,
bool install_silently,
bool enable_on_install,
- bool enable_incognito_on_install);
+ bool enable_incognito_on_install,
+ Extension::Location install_source);
PendingExtensionInfo();
@@ -70,6 +73,7 @@ struct PendingExtensionInfo {
bool install_silently;
bool enable_on_install;
bool enable_incognito_on_install;
+ Extension::Location install_source;
};
// A PendingExtensionMap is a map from IDs of pending extensions to
@@ -169,6 +173,10 @@ class ExtensionsService
return !(extensions_.empty() && disabled_extensions_.empty());
}
+ const FilePath& install_directory() const { return install_directory_; }
+
+ DefaultApps* default_apps() { return &default_apps_; }
+
// Whether this extension can run in an incognito window.
bool IsIncognitoEnabled(const Extension* extension);
void SetIsIncognitoEnabled(Extension* extension, bool enabled);
@@ -177,8 +185,6 @@ class ExtensionsService
bool AllowFileAccess(const Extension* extension);
void SetAllowFileAccess(Extension* extension, bool allow);
- const FilePath& install_directory() const { return install_directory_; }
-
// Initialize and start all installed extensions.
void Init();
@@ -225,6 +231,10 @@ class ExtensionsService
void AddPendingExtensionFromExternalUpdateUrl(const std::string& id,
const GURL& update_url);
+ // Like the above. Always installed silently, and defaults update url
+ // from extension id.
+ void AddPendingExtensionFromDefaultAppList(const std::string& id);
+
// Reloads the specified extension.
void ReloadExtension(const std::string& extension_id);
@@ -386,8 +396,11 @@ class ExtensionsService
const NotificationSource& source,
const NotificationDetails& details);
- // Whether there are any apps installed.
- bool HasApps();
+ // Whether there are any apps installed. Component apps are not included.
+ bool HasApps() const;
+
+ // Gets the set of loaded app ids. Component apps are not included.
+ ExtensionIdSet GetAppIds() const;
private:
virtual ~ExtensionsService();
@@ -409,7 +422,8 @@ class ExtensionsService
const std::string& id, const GURL& update_url,
PendingExtensionInfo::ExpectedCrxType crx_type,
bool is_from_sync, bool install_silently,
- bool enable_on_install, bool enable_incognito_on_install);
+ bool enable_on_install, bool enable_incognito_on_install,
+ Extension::Location install_source);
// Handles sending notification that |extension| was loaded.
void NotifyExtensionLoaded(Extension* extension);
@@ -511,6 +525,10 @@ class ExtensionsService
typedef std::map<GURL, int> ProtectedStorageMap;
ProtectedStorageMap protected_storage_map_;
+ // Manages the installation of default apps and the promotion of them in the
+ // app launcher.
+ DefaultApps default_apps_;
+
FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest,
UpdatePendingExtensionAlreadyInstalled);
FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest,