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

Side by Side Diff: goopdate/app_state_install_complete.cc

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_state_install_complete.h ('k') | goopdate/app_state_installing.h » ('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 2009 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 #include "omaha/common/config_manager.h"
17 #include "omaha/goopdate/app_state_install_complete.h"
18 #include "omaha/base/logging.h"
19 #include "omaha/goopdate/model.h"
20 #include "omaha/goopdate/worker.h"
21
22 namespace omaha {
23
24 namespace fsm {
25
26 AppStateInstallComplete::AppStateInstallComplete(App* app)
27 : AppState(STATE_INSTALL_COMPLETE) {
28 ASSERT1(app);
29
30 // Start the crash handler if an installer has indicated that it requires OOP
31 // crash handling.
32 bool is_machine = app->app_bundle()->is_machine();
33 if (ConfigManager::Instance()->CanCollectStats(is_machine) &&
34 (!is_machine || user_info::IsRunningAsSystem())) {
35 VERIFY1(SUCCEEDED(goopdate_utils::StartCrashHandler(is_machine)));
36 }
37
38 VERIFY1(SUCCEEDED(app->model()->PurgeAppLowerVersions(
39 app->app_guid_string(), app->next_version()->version())));
40 }
41
42 // Omaha installs and updates are two-step processes. Omaha is handled as a
43 // special case in both installs and updates.
44 //
45 // In the install case, Omaha itself is installed by the /install process, which
46 // is responsible for pinging. Omaha is never part of the bundle in this case.
47 //
48 // In update case, the Omaha update is run as a /update process first.
49 // The install manager does not wait for that process to complete and, if the
50 // launch of it was successful, it transitions the Omaha app into the install
51 // complete state. No ping should be sent in this case. Next, the update process
52 // runs, finishes the update of Omaha, and then it sends the
53 // EVENT_UPDATE_COMPLETE ping.
54 const PingEvent* AppStateInstallComplete::CreatePingEvent(
55 App* app,
56 CurrentState previous_state) const {
57 ASSERT1(app);
58 UNREFERENCED_PARAMETER(previous_state);
59
60 const PingEvent::Types event_type(app->is_update() ?
61 PingEvent::EVENT_UPDATE_COMPLETE :
62 PingEvent::EVENT_INSTALL_COMPLETE);
63
64 const bool is_omaha = !!::IsEqualGUID(kGoopdateGuid, app->app_guid());
65
66 const bool can_ping = !is_omaha;
67
68 const HRESULT error_code(app->error_code());
69 ASSERT1(SUCCEEDED(error_code));
70
71 return can_ping ?
72 new PingEvent(event_type, GetCompletionResult(*app), error_code, 0) :
73 NULL;
74 }
75
76 // Canceling while in a terminal state has no effect.
77 void AppStateInstallComplete::Cancel(App* app) {
78 CORE_LOG(L3, (_T("[AppStateInstallComplete::Cancel][0x%p]"), app));
79 UNREFERENCED_PARAMETER(app);
80 }
81
82 // Terminal states should not transition to error.
83 void AppStateInstallComplete::Error(App* app,
84 const ErrorContext& error_context,
85 const CString& message) {
86 UNREFERENCED_PARAMETER(error_context);
87 UNREFERENCED_PARAMETER(message);
88 HandleInvalidStateTransition(app, _T(__FUNCTION__));
89 }
90
91 } // namespace fsm
92
93 } // namespace omaha
OLDNEW
« no previous file with comments | « goopdate/app_state_install_complete.h ('k') | goopdate/app_state_installing.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698