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

Side by Side Diff: goopdate/app_bundle_state.h

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « goopdate/app_bundle.cc ('k') | goopdate/app_bundle_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 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 #ifndef OMAHA_GOOPDATE_APP_BUNDLE_STATE_H_
17 #define OMAHA_GOOPDATE_APP_BUNDLE_STATE_H_
18
19 #include <windows.h>
20 #include <atlstr.h>
21 #include "base/basictypes.h"
22
23 namespace omaha {
24
25 class App;
26 class AppBundle;
27 class AppBundleTest;
28 class WebServicesClientInterface;
29
30 namespace fsm {
31
32 // Defines the interface for encapsulating behavior associated with a particular
33 // state of the AppBundle object.
34 // All state transition calls should go through AppBundle, meaning it is the
35 // only class that should use this interface.
36 class AppBundleState {
37 public:
38 virtual ~AppBundleState() {}
39
40 virtual HRESULT put_altTokens(AppBundle* app_bundle,
41 ULONG_PTR impersonation_token,
42 ULONG_PTR primary_token,
43 DWORD caller_proc_id);
44 virtual HRESULT put_sessionId(AppBundle* app_bundle, BSTR session_id);
45 virtual HRESULT Initialize(AppBundle* app_bundle);
46 virtual HRESULT CreateApp(AppBundle* app_bundle,
47 const CString& app_id,
48 App** app);
49 virtual HRESULT CreateInstalledApp(AppBundle* app_bundle,
50 const CString& app_id,
51 App** app);
52 virtual HRESULT CreateAllInstalledApps(AppBundle* app_bundle);
53
54 virtual HRESULT CheckForUpdate(AppBundle* app_bundle);
55 virtual HRESULT Download(AppBundle* app_bundle);
56 virtual HRESULT Install(AppBundle* app_bundle);
57
58 virtual HRESULT UpdateAllApps(AppBundle* app_bundle);
59
60 virtual HRESULT Stop(AppBundle* app_bundle);
61 virtual HRESULT Pause(AppBundle* app_bundle);
62 virtual HRESULT Resume(AppBundle* app_bundle);
63
64 virtual HRESULT DownloadPackage(AppBundle* app_bundle,
65 const CString& app_id,
66 const CString& package_name);
67
68 virtual HRESULT CompleteAsyncCall(AppBundle* app_bundle);
69
70 virtual bool IsBusy() const;
71
72 protected:
73 enum BundleState {
74 STATE_INIT,
75 STATE_INITIALIZED,
76 STATE_BUSY,
77 STATE_READY,
78 STATE_PAUSED,
79 STATE_STOPPED,
80 };
81
82
83 explicit AppBundleState(BundleState state) : state_(state) {}
84
85 // These functions provide pass-through access to private AppBundle members.
86 // TODO(omaha): remove paranoid asserts and implement inline.
87 void AddAppToBundle(AppBundle* app_bundle, App* app);
88 bool IsPendingNonBlockingCall(AppBundle* app_bundle);
89
90 HRESULT DoDownloadPackage(AppBundle* app_bundle,
91 const CString& app_id,
92 const CString& package_name);
93
94 // After calling this method, the old state (this object) is deleted and the
95 // code may not reference the members of the old state anymore.
96 void ChangeState(AppBundle* app_bundle, AppBundleState* state);
97
98 HRESULT HandleInvalidStateTransition(AppBundle* app_bundle,
99 const TCHAR* function_name);
100
101 private:
102 friend class AppBundleTest;
103
104 BundleState state_;
105
106 DISALLOW_COPY_AND_ASSIGN(AppBundleState);
107 };
108
109 } // namespace fsm
110
111 } // namespace omaha
112
113 #endif // OMAHA_GOOPDATE_APP_BUNDLE_STATE_H_
OLDNEW
« no previous file with comments | « goopdate/app_bundle.cc ('k') | goopdate/app_bundle_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698