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

Side by Side Diff: goopdate/app_state_waiting_to_download.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_waiting_to_download.h ('k') | goopdate/app_state_waiting_to_install.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-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_download.h"
17 #include "omaha/base/debug.h"
18 #include "omaha/base/logging.h"
19 #include "omaha/goopdate/app_state_download_complete.h"
20 #include "omaha/goopdate/app_state_downloading.h"
21 #include "omaha/goopdate/download_manager.h"
22 #include "omaha/goopdate/model.h"
23
24 namespace omaha {
25
26 namespace fsm {
27
28 AppStateWaitingToDownload::AppStateWaitingToDownload()
29 : AppState(STATE_WAITING_TO_DOWNLOAD) {
30 }
31
32 const PingEvent* AppStateWaitingToDownload::CreatePingEvent(
33 App* app,
34 CurrentState previous_state) const {
35 ASSERT1(app);
36 UNREFERENCED_PARAMETER(previous_state);
37
38 // Omaha 3 reports this ping later than Omaha 2 because the COM server does
39 // not know the client's intent when doing the update check.
40 const PingEvent::Types event_type(app->is_update() ?
41 PingEvent::EVENT_UPDATE_APPLICATION_BEGIN :
42 PingEvent::EVENT_INSTALL_APPLICATION_BEGIN);
43
44 const HRESULT error_code = app->error_code();
45 ASSERT1(SUCCEEDED(error_code));
46
47 return new PingEvent(event_type, GetCompletionResult(*app), error_code, 0);
48 }
49
50 void AppStateWaitingToDownload::Download(
51 App* app,
52 DownloadManagerInterface* download_manager) {
53 CORE_LOG(L3, (_T("[AppStateWaitingToDownload::Download][0x%p]"), app));
54 ASSERT1(app);
55 ASSERT1(download_manager);
56
57 app->SetDownloadStartTime();
58
59 // This is a blocking call on the network.
60 HRESULT hr = download_manager->DownloadApp(app);
61
62 app->LogTextAppendFormat(_T("Download result=0x%08x"), hr);
63 }
64
65 void AppStateWaitingToDownload::Downloading(App* app) {
66 CORE_LOG(L3, (_T("[AppStateWaitingToDownload::Downloading][%p]"), app));
67 ASSERT1(app);
68
69 ChangeState(app, new AppStateDownloading);
70 }
71
72 void AppStateWaitingToDownload::DownloadComplete(App* app) {
73 CORE_LOG(L3, (_T("[AppStateWaitingToDownload::DownloadComplete][%p]"), app));
74 CORE_LOG(L3, (_T("[Did not download anything - likely because all packages ")
75 _T("were cached - or OnProgress callback was never called.]")));
76 ASSERT1(app);
77
78 ChangeState(app, new AppStateDownloadComplete);
79 }
80
81 } // namespace fsm
82
83 } // namespace omaha
84
OLDNEW
« no previous file with comments | « goopdate/app_state_waiting_to_download.h ('k') | goopdate/app_state_waiting_to_install.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698