Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Unified Diff: chrome/browser/extensions/extension_assets_manager_chromeos.h

Issue 273193006: Install Chrome OS apps to shared location (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added uninstall Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_assets_manager_chromeos.h
diff --git a/chrome/browser/extensions/extension_assets_manager_chromeos.h b/chrome/browser/extensions/extension_assets_manager_chromeos.h
new file mode 100644
index 0000000000000000000000000000000000000000..27eec96a826172626efd015382260def83fe8b71
--- /dev/null
+++ b/chrome/browser/extensions/extension_assets_manager_chromeos.h
@@ -0,0 +1,109 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ASSETS_MANAGER_CHROMEOS_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_ASSETS_MANAGER_CHROMEOS_H_
+
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/extensions/extension_assets_manager.h"
+
+template <typename T> struct DefaultSingletonTraits;
+class PrefRegistrySimple;
+
+namespace base {
+class SequencedTaskRunner;
+}
+
+namespace extensions {
+
+// Chrome OS specific implementation assets manager that share default apps
+// between all users on the machine.
+class ExtensionAssetsManagerChromeOS : public ExtensionAssetsManager {
+ public:
+ static ExtensionAssetsManagerChromeOS* GetInstance();
+
+ // Path to shared extensions install dir.
+ static const char kSharedExtensionsDir[];
+
+ // Register shared assets related preferences.
+ static void RegisterPrefs(PrefRegistrySimple* registry);
+
+ // Override from ExtensionAssetsManager.
+ virtual void InstallExtension(const Extension* extension,
+ const base::FilePath& unpacked_extension_root,
+ const base::FilePath& local_install_dir,
+ Profile* profile,
+ InstallExtensionCallback callback) OVERRIDE;
+ virtual void UninstallExtension(
+ const std::string& id,
+ Profile* profile,
+ const base::FilePath& local_install_dir,
+ const base::FilePath& extension_root) OVERRIDE;
+
+ void SetSharedInstallDirForTesting(const base::FilePath& install_dir);
+
+ private:
+ friend struct DefaultSingletonTraits<ExtensionAssetsManagerChromeOS>;
+
+ ExtensionAssetsManagerChromeOS();
+ virtual ~ExtensionAssetsManagerChromeOS();
+
+ // Should be called on UI thread to get associated file task runner for
+ // the profile.
+ static base::SequencedTaskRunner* GetFileTaskRunner(Profile* profile);
+
+ // Return |true| if |extension| can be installed in shared place for all users
+ // on the device.
+ static bool CanShareAssets(const Extension* extension);
+
+ // Called in UI thread to check if given version of the |extension| already
+ // exists at shared location.
+ static void CheckSharedExtension(
+ base::WeakPtr<ExtensionAssetsManagerChromeOS> object,
+ const Extension* extension,
+ const base::FilePath& unpacked_extension_root,
+ const base::FilePath& local_install_dir,
+ Profile* profile,
+ InstallExtensionCallback callback);
+
+ // Called on task runner thread when version found in shared location.
+ static void SharedExtensionFound(const base::FilePath& shared_version_dir,
+ InstallExtensionCallback callback);
+
+ // Called on task runner thread when there is no version in shared location.
+ void SharedExtensionNotFound(
+ const Extension* extension,
+ const base::FilePath& unpacked_extension_root,
+ const base::FilePath& local_install_dir,
+ Profile* profile,
+ InstallExtensionCallback callback);
+
+ // Called on UI thread to mark that shared version is in use.
+ static void MarkSharedExtensionUsed(
+ const std::string& id,
+ const std::string& version,
+ const base::FilePath& shared_version_dir,
+ Profile* profile);
+
+ // Called on UI thread to mark that shared version is not used.
+ static void MarkSharedExtensionUnused(
+ base::WeakPtr<ExtensionAssetsManagerChromeOS> object,
+ const std::string& id,
+ Profile* profile);
+
+ // Called on task runner thread to remove shared version.
+ void DeleteSharedVersion(const base::FilePath& shared_version_dir);
+
+ // Weak factory for callbacks.
+ base::WeakPtrFactory<ExtensionAssetsManagerChromeOS> weak_ptr_factory_;
+
+ // Shared install dir, set to some temporary dir in tests.
+ base::FilePath shared_install_dir_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionAssetsManagerChromeOS);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ASSETS_MANAGER_CHROMEOS_H_

Powered by Google App Engine
This is Rietveld 408576698