OLD | NEW |
| (Empty) |
1 // Copyright 2009-2010 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 // ======================================================================== | |
15 | |
16 // Defines a command object to be executed in the thread pool when the Install | |
17 // method is called. | |
18 | |
19 #ifndef OMAHA_GOOPDATE_INSTALL_MANAGER_H_ | |
20 #define OMAHA_GOOPDATE_INSTALL_MANAGER_H_ | |
21 | |
22 #include <windows.h> | |
23 #include <atlstr.h> | |
24 #include "base/basictypes.h" | |
25 #include "base/scoped_ptr.h" | |
26 #include "omaha/base/thread_pool.h" | |
27 | |
28 namespace omaha { | |
29 | |
30 class App; | |
31 class AppVersion; | |
32 class InstallerWrapper; | |
33 struct InstallerResultInfo; | |
34 struct Lockable; | |
35 | |
36 // Public interface for the InstallManager. | |
37 class InstallManagerInterface { | |
38 public: | |
39 virtual ~InstallManagerInterface() {} | |
40 virtual CString install_working_dir() const = 0; | |
41 virtual HRESULT Initialize() = 0; | |
42 virtual void InstallApp(App* app, const CString& dir) = 0; | |
43 }; | |
44 | |
45 class InstallManager : public InstallManagerInterface { | |
46 public: | |
47 InstallManager(const Lockable* model_lock, bool is_machine_); | |
48 virtual ~InstallManager(); | |
49 | |
50 // Returns the base directory where the InstallManager expects application | |
51 // packages to be available before the install. | |
52 virtual CString install_working_dir() const; | |
53 | |
54 virtual HRESULT Initialize(); | |
55 | |
56 // Installs an application. Expects the application packages to be present | |
57 // in the specified directory. | |
58 virtual void InstallApp(App* app, const CString& dir); | |
59 | |
60 private: | |
61 // TODO(omaha): Rename to avoid overload. | |
62 static HRESULT InstallApp(bool is_machine, | |
63 HANDLE user_token, | |
64 const CString& existing_version, | |
65 const Lockable& model_lock, | |
66 InstallerWrapper* installer_wrapper, | |
67 App* app, | |
68 const CString& dir); | |
69 static void PopulateSuccessfulInstallResultInfo( | |
70 const App* app, | |
71 InstallerResultInfo* result_info); | |
72 | |
73 const Lockable* model_lock_; | |
74 const bool is_machine_; | |
75 | |
76 // Base path where verified application packages are copied before install. | |
77 CString install_working_dir_; | |
78 | |
79 scoped_ptr<InstallerWrapper> installer_wrapper_; | |
80 | |
81 friend class InstallManagerInstallAppTest; | |
82 | |
83 DISALLOW_COPY_AND_ASSIGN(InstallManager); | |
84 }; | |
85 | |
86 } // namespace omaha | |
87 | |
88 #endif // OMAHA_GOOPDATE_INSTALL_MANAGER_H_ | |
OLD | NEW |