OLD | NEW |
---|---|
(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 assets manager that share default apps | |
asargent_no_longer_on_chrome
2014/05/20 21:20:25
nit: "that share" -> "that shares"
Dmitry Polukhin
2014/05/20 23:42:16
Done.
| |
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 shared place for all users | |
asargent_no_longer_on_chrome
2014/05/20 21:20:25
nit: "can be installed in shared place" -> "can be
Dmitry Polukhin
2014/05/20 23:42:16
Done.
| |
59 // on the device. | |
60 static bool CanShareAssets(const Extension* extension); | |
61 | |
62 // Called in UI thread to check if given version of the |extension| already | |
asargent_no_longer_on_chrome
2014/05/20 21:20:25
a couple grammar nits; this should be:
"Called on
Dmitry Polukhin
2014/05/20 23:42:16
Done.
| |
63 // exists at 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 when version is found in shared location. | |
73 static void RunInstallCallback(const base::FilePath& shared_version_dir, | |
74 InstallExtensionCallback callback); | |
75 | |
76 // Called on task runner thread to install extension to shared location. | |
77 static void InstallSharedExtension( | |
78 const std::string& id, | |
79 const std::string& version, | |
80 const base::FilePath& unpacked_extension_root); | |
81 | |
82 // Called on UI thread to process shared install result. | |
83 static void InstallSharedExtensionDone( | |
84 const std::string& id, | |
85 const std::string& version, | |
86 const base::FilePath& shared_version_dir); | |
87 | |
88 // Called on task runner thread to do local install because shared install | |
89 // failed. | |
90 static void SharedInstallFailed(const std::string& id, | |
91 const std::string& version, | |
92 const base::FilePath& unpacked_extension_root, | |
93 const base::FilePath& local_install_dir, | |
94 InstallExtensionCallback callback); | |
95 | |
96 // Called on UI thread to mark that shared version is not used. | |
97 static void MarkSharedExtensionUnused( | |
98 const std::string& id, | |
99 Profile* profile); | |
100 | |
101 // Called on task runner thread to remove shared version. | |
102 static void DeleteSharedVersion(const base::FilePath& shared_version_dir); | |
103 | |
104 // Called on task runner thread to remove shared extension dir. | |
105 static void DeleteSharedExtension(const std::string& id); | |
106 | |
107 DISALLOW_COPY_AND_ASSIGN(ExtensionAssetsManagerChromeOS); | |
108 }; | |
109 | |
110 } // namespace extensions | |
111 | |
112 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ASSETS_MANAGER_CHROMEOS_H_ | |
OLD | NEW |