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

Side by Side 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: eliminate race condition between install and 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ASSETS_MANAGER_CHROMEOS_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ASSETS_MANAGER_CHROMEOS_H_
7
8 #include "chrome/browser/extensions/extension_assets_manager.h"
9
10 template <typename T> struct DefaultSingletonTraits;
11 class PrefRegistrySimple;
12
13 namespace base {
14 class SequencedTaskRunner;
15 }
16
17 namespace extensions {
18
19 // Chrome OS specific implementation of assets manager that shares default apps
20 // between all users on the machine.
21 class ExtensionAssetsManagerChromeOS : public ExtensionAssetsManager {
22 public:
23 static ExtensionAssetsManagerChromeOS* GetInstance();
24
25 // Path to shared extensions install dir.
26 static const char kSharedExtensionsDir[];
27
28 // Register shared assets related preferences.
29 static void RegisterPrefs(PrefRegistrySimple* registry);
30
31 // Override from ExtensionAssetsManager.
32 virtual void InstallExtension(const Extension* extension,
33 const base::FilePath& unpacked_extension_root,
34 const base::FilePath& local_install_dir,
35 Profile* profile,
36 InstallExtensionCallback callback) OVERRIDE;
37 virtual void UninstallExtension(
38 const std::string& id,
39 Profile* profile,
40 const base::FilePath& local_install_dir,
41 const base::FilePath& extension_root) OVERRIDE;
42
43 static void SetSharedInstallDirForTesting(const base::FilePath& install_dir);
44
45 private:
46 friend struct DefaultSingletonTraits<ExtensionAssetsManagerChromeOS>;
47
48 ExtensionAssetsManagerChromeOS();
49 virtual ~ExtensionAssetsManagerChromeOS();
50
51 // Should be called on UI thread to get associated file task runner for
52 // the profile.
53 static base::SequencedTaskRunner* GetFileTaskRunner(Profile* profile);
54
55 // Return shared install dir.
56 static base::FilePath GetSharedInstallDir();
57
58 // Return |true| if |extension| can be installed in a shared place for all
59 // users on the device.
60 static bool CanShareAssets(const Extension* extension);
61
62 // Called on the UI thread to check if a given version of the |extension|
63 // already exists at the shared location.
64 static void CheckSharedExtension(
65 const std::string& id,
66 const std::string& version,
67 const base::FilePath& unpacked_extension_root,
68 const base::FilePath& local_install_dir,
69 Profile* profile,
70 InstallExtensionCallback callback);
71
72 // Called on task runner thread to install extension to shared location.
73 static void InstallSharedExtension(
74 const std::string& id,
75 const std::string& version,
76 const base::FilePath& unpacked_extension_root);
77
78 // Called on UI thread to process shared install result.
79 static void InstallSharedExtensionDone(
80 const std::string& id,
81 const std::string& version,
82 const base::FilePath& shared_version_dir);
83
84 // Called on task runner thread to install the extension to local dir call
85 // callback with the result.
86 static void InstallLocalExtension(
87 const std::string& id,
88 const std::string& version,
89 const base::FilePath& unpacked_extension_root,
90 const base::FilePath& local_install_dir,
91 InstallExtensionCallback callback);
92
93 // Called on UI thread to mark that shared version is not used.
94 static void MarkSharedExtensionUnused(const std::string& id,
95 Profile* profile);
96
97 // Called on task runner thread to remove shared version.
98 static void DeleteSharedVersion(const base::FilePath& shared_version_dir);
99
100 DISALLOW_COPY_AND_ASSIGN(ExtensionAssetsManagerChromeOS);
101 };
102
103 } // namespace extensions
104
105 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ASSETS_MANAGER_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698