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

Side by Side Diff: goopdate/app_state_waiting_to_check_for_update.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
OLDNEW
(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 #include "omaha/goopdate/app_state_waiting_to_check_for_update.h"
17 #include "omaha/base/debug.h"
18 #include "omaha/base/error.h"
19 #include "omaha/base/highres_timer-win32.h"
20 #include "omaha/base/logging.h"
21 #include "omaha/common/update_request.h"
22 #include "omaha/goopdate/app_manager.h"
23 #include "omaha/goopdate/app_state_checking_for_update.h"
24 #include "omaha/goopdate/update_request_utils.h"
25 #include "omaha/goopdate/model.h"
26 #include "omaha/goopdate/server_resource.h"
27 #include "omaha/goopdate/string_formatter.h"
28 #include "omaha/goopdate/worker.h"
29 #include "omaha/goopdate/worker_metrics.h"
30
31 namespace omaha {
32
33 namespace fsm {
34
35 AppStateWaitingToCheckForUpdate::AppStateWaitingToCheckForUpdate()
36 : AppState(STATE_WAITING_TO_CHECK_FOR_UPDATE) {
37 }
38
39 void AppStateWaitingToCheckForUpdate::PreUpdateCheck(
40 App* app,
41 xml::UpdateRequest* update_request) {
42 CORE_LOG(L3, (_T("[AppStateWaitingToCheckForUpdate::PreUpdateCheck]")));
43 ASSERT1(app);
44 ASSERT1(update_request);
45
46 ASSERT1(app->model()->IsLockedByCaller());
47
48 const CString& current_version(app->current_version()->version());
49 if (!current_version.IsEmpty()) {
50 app->model()->PurgeAppLowerVersions(app->app_guid_string(),
51 current_version);
52 }
53
54 AppManager* app_manager(AppManager::Instance());
55
56 VERIFY1(SUCCEEDED(app_manager->SynchronizeClientState(app->app_guid())));
57
58 // Handle the normal flow and return. Abnormal cases are below.
59 if (app->is_eula_accepted()) {
60 update_request_utils::BuildRequest(app, true, update_request);
61 ChangeState(app, new AppStateCheckingForUpdate);
62 return;
63 }
64
65 // The app's EULA has not been accepted, so do not add this app to the update
66 // check. This means bundle size does not always match the request size.
67
68 ASSERT1(app->app_guid() != kGoopdateGuid);
69
70 // TODO(omaha3): Is there a better way to do this such that we don't need to
71 // know about offline installs here?
72 if (app->app_bundle()->is_offline_install()) {
73 // Offline installs do not need requests, so skip building the request.
74 ChangeState(app, new AppStateCheckingForUpdate);
75 return;
76 }
77
78 ASSERT1(app->is_update());
79 metric_worker_apps_not_updated_eula++;
80
81 StringFormatter formatter(app->app_bundle()->display_language());
82 CString message;
83 VERIFY1(SUCCEEDED(formatter.LoadString(IDS_INSTALL_FAILED, &message)));
84 Error(app,
85 ErrorContext(GOOPDATE_E_APP_UPDATE_DISABLED_EULA_NOT_ACCEPTED),
86 message);
87 }
88
89 } // namespace fsm
90
91 } // namespace omaha
OLDNEW
« no previous file with comments | « goopdate/app_state_waiting_to_check_for_update.h ('k') | goopdate/app_state_waiting_to_download.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698