| OLD | NEW |
| (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/goopdate/app_state_download_complete.h" | |
| 17 #include "omaha/base/debug.h" | |
| 18 #include "omaha/base/logging.h" | |
| 19 #include "omaha/goopdate/app_state_ready_to_install.h" | |
| 20 #include "omaha/goopdate/download_complete_ping_event.h" | |
| 21 #include "omaha/goopdate/model.h" | |
| 22 | |
| 23 namespace omaha { | |
| 24 | |
| 25 namespace fsm { | |
| 26 | |
| 27 AppStateDownloadComplete::AppStateDownloadComplete() | |
| 28 : AppState(STATE_DOWNLOAD_COMPLETE) { | |
| 29 } | |
| 30 | |
| 31 const PingEvent* AppStateDownloadComplete::CreatePingEvent( | |
| 32 App* app, | |
| 33 CurrentState previous_state) const { | |
| 34 ASSERT1(app); | |
| 35 UNREFERENCED_PARAMETER(previous_state); | |
| 36 | |
| 37 const PingEvent::Types event_type(app->is_update() ? | |
| 38 PingEvent::EVENT_UPDATE_DOWNLOAD_FINISH : | |
| 39 PingEvent::EVENT_INSTALL_DOWNLOAD_FINISH); | |
| 40 | |
| 41 const HRESULT error_code = app->error_code(); | |
| 42 ASSERT1(SUCCEEDED(error_code)); | |
| 43 | |
| 44 return new DownloadCompletePingEvent(event_type, | |
| 45 GetCompletionResult(*app), | |
| 46 error_code, | |
| 47 0, | |
| 48 app->GetDownloadTimeMs(), | |
| 49 app->num_bytes_downloaded(), | |
| 50 app->GetPackagesTotalSize()); | |
| 51 } | |
| 52 | |
| 53 // TODO(omaha3): When extraction and differential updates are supported, this | |
| 54 // method will need to be copied/moved/changed to handle branches in the flow. | |
| 55 void AppStateDownloadComplete::MarkReadyToInstall(App* app) { | |
| 56 CORE_LOG(L3, | |
| 57 (_T("[AppStateDownloadComplete::MarkReadyToInstall][0x%p]"), app)); | |
| 58 ASSERT1(app); | |
| 59 | |
| 60 ChangeState(app, new AppStateReadyToInstall); | |
| 61 } | |
| 62 | |
| 63 } // namespace fsm | |
| 64 | |
| 65 } // namespace omaha | |
| OLD | NEW |