Opera 12.15 Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

autoupdater.h 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. /* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
  2. *
  3. * Copyright (C) 1995-2011 Opera Software AS. All rights reserved.
  4. *
  5. * This file is part of the Opera web browser. It may not be distributed
  6. * under any circumstances.
  7. *
  8. * @author Adam Minchinton, Michal Zajaczkowski
  9. */
  10. #ifndef _AUTOUPDATER_H_INCLUDED_
  11. #define _AUTOUPDATER_H_INCLUDED_
  12. #ifdef AUTO_UPDATE_SUPPORT
  13. #define g_autoupdater (&AutoUpdater::GetInstance())
  14. #include "adjunct/autoupdate/autoupdatexml.h"
  15. #include "adjunct/autoupdate/platformupdater.h"
  16. #include "adjunct/autoupdate/file_downloader.h"
  17. #include "adjunct/autoupdate/updatableresource.h"
  18. #include "adjunct/autoupdate/statusxmldownloader.h"
  19. #include "adjunct/desktop_util/version/operaversion.h"
  20. #include "adjunct/autoupdate/scheduler/optaskscheduler.h"
  21. #include "modules/util/adt/oplisteners.h"
  22. #include "modules/prefs/prefsmanager/collections/pc_ui.h"
  23. #include "modules/prefs/prefsmanager/opprefslistener.h"
  24. #ifdef OPERA_CONSOLE
  25. # include "modules/console/opconsoleengine.h"
  26. #endif
  27. class AutoUpdateXML;
  28. class UpdatableResource;
  29. class StatusXMLDownloader;
  30. class StatusXMLDownloaderListener;
  31. #ifndef _MACINTOSH_
  32. namespace opera_update_checker { namespace ipc {
  33. class Channel;
  34. }}
  35. #endif // _MACINTOSH_
  36. enum AutoUpdateError
  37. {
  38. AUNoError, //< No error
  39. AUInternalError, //< wrong initializations of objects etc.
  40. AUInProgressError, //< check for updates while an update is in progress
  41. AUConnectionError, //< no network connection, server not reachable, failed ssl handshake etc.
  42. AUSaveError, //< no permission, not enough disk space
  43. AUValidationError, //< extraction failed, wrong checksum, corrupt/invalid package, wrong format/file, wrong Opera version, XML parsing error
  44. AUUpdateError //< error when updating resources
  45. };
  46. /**
  47. * Enum for the automation level
  48. */
  49. enum LevelOfAutomation
  50. {
  51. NoChecking = 0, ///< Opera shall never automatically connect to opera.com to retrieve updates or information about them.
  52. CheckForUpdates, ///< Opera shall periodically connect to opera.com to get updates to resources, as well as notify the user about available updates to the application.
  53. AutoInstallUpdates ///< Opera shall periodically connect to opera.com to get updates to resources, as well as automatically download and install available security (minor) updates to the application, and notify the user that an update has taken place.
  54. };
  55. /**
  56. * This class is the base class for the auto update functionallity.
  57. *
  58. * It should contain all code to do any platform/product independent
  59. * functionallity such as version comparisons, xml parsing,
  60. * downloading of files etc.
  61. *
  62. * @see platformupdater.h For the interface used to manage updates on the platform.
  63. *
  64. */
  65. class AutoUpdater:
  66. public FileDownloadListener,
  67. public MessageObject,
  68. public OpTimerListener,
  69. public StatusXMLDownloaderListener,
  70. public OpPrefsListener
  71. {
  72. public:
  73. enum ScheduleCheckType
  74. {
  75. // Used when scheduling next update check on browser startup
  76. ScheduleStartup,
  77. // Used when scheduling next update check after previous check completed
  78. ScheduleRunning
  79. };
  80. enum AutoUpdateState
  81. {
  82. AUSUpToDate,
  83. AUSChecking,
  84. AUSUpdateAvailable,
  85. AUSDownloading,
  86. AUSReadyToUpdate,
  87. AUSUpdating,
  88. AUSUnpacking,
  89. AUSReadyToInstall,
  90. AUSErrorDownloading,
  91. AUSError
  92. };
  93. enum CheckerState
  94. {
  95. CheckerOk,
  96. CheckerCouldntLaunch
  97. };
  98. class AutoUpdateListener
  99. {
  100. public:
  101. virtual ~AutoUpdateListener() {}
  102. virtual void OnUpToDate(BOOL silent) = 0;
  103. virtual void OnChecking(BOOL silent) = 0;
  104. virtual void OnUpdateAvailable(UpdatableResource::UpdatableResourceType type, OpFileLength update_size, const uni_char* update_info_url, BOOL silent) = 0;
  105. virtual void OnDownloading(UpdatableResource::UpdatableResourceType type, OpFileLength total_size, OpFileLength downloaded_size, double kbps, unsigned long time_estimate, BOOL silent) = 0;
  106. virtual void OnDownloadingDone(UpdatableResource::UpdatableResourceType type, const OpString& filename, OpFileLength total_size, BOOL silent) = 0;
  107. virtual void OnDownloadingFailed(BOOL silent) = 0;
  108. virtual void OnRestartingDownload(INT32 seconds_until_restart, AutoUpdateError last_error, BOOL silent) = 0;
  109. virtual void OnReadyToUpdate() = 0;
  110. virtual void OnUpdating() = 0;
  111. virtual void OnFinishedUpdating() = 0;
  112. virtual void OnUnpacking() = 0;
  113. virtual void OnReadyToInstallNewVersion(const OpString& version, BOOL silent) = 0;
  114. virtual void OnError(AutoUpdateError error, BOOL silent) = 0;
  115. };
  116. /**
  117. * Initialize the updater. Also call Activate to run it, as this
  118. * does not start the auto updater! Call Activate() when this function
  119. * returns OK.
  120. *
  121. * @return OK if the updater is correctly initialized and ready to go,
  122. * err if there was some problem.
  123. */
  124. virtual OP_STATUS Init(BOOL check_increased_update_check_interval = TRUE);
  125. /**
  126. * Add an autoupdate listener
  127. */
  128. OP_STATUS AddListener(AutoUpdateListener* listener) { return m_listeners.Add(listener); }
  129. /**
  130. * Remove an autoupdate listener
  131. */
  132. OP_STATUS RemoveListener(AutoUpdateListener* listener) { return m_listeners.Remove(listener); }
  133. virtual void StatusXMLDownloaded(StatusXMLDownloader* downloader);
  134. virtual void StatusXMLDownloadFailed(StatusXMLDownloader* downloader, StatusXMLDownloader::DownloadStatus);
  135. /** Signals a change in an integer preference.
  136. * Function from OpPrefsListener interface.
  137. *
  138. * @param id Identity of the collection that has changed the value.
  139. * @param pref Identity of the preference.
  140. * @param newvalue The new value of the preference.
  141. */
  142. virtual void PrefChanged(OpPrefsCollection::Collections id, int pref, int newvalue);
  143. /**
  144. * Activate the updater. AutoUpdater won't check for new updates
  145. * until this function is called. If a new update is due,
  146. * this function will initate it. If it's not due, this
  147. * function will schedule it.
  148. */
  149. OP_STATUS Activate();
  150. /**
  151. * Check for updates right now
  152. */
  153. OP_STATUS CheckForUpdate();
  154. /**
  155. * Called from FileDownloader when file download done
  156. */
  157. virtual void OnFileDownloadDone(FileDownloader* file_downloader, OpFileLength total_size);
  158. /**
  159. * Called from FileDownloader when file download failed
  160. */
  161. virtual void OnFileDownloadFailed(FileDownloader* file_downloader);
  162. /**
  163. * Called from FileDownloader when file download was aborted
  164. */
  165. virtual void OnFileDownloadAborted(FileDownloader* file_downloader);
  166. /**
  167. * Called from FileDownloader when file download progresses
  168. */
  169. virtual void OnFileDownloadProgress(FileDownloader* file_downloader, OpFileLength total_size, OpFileLength downloaded_size, double kbps, unsigned long time_estimate);
  170. /**
  171. * Callback used to signal that the
  172. * user has requested to be reminded later of some upgrade
  173. *
  174. * @param wait Interval to wait before notifying again.
  175. */
  176. void DeferUpdate();
  177. /**
  178. * Callback used to signal that the
  179. * user has requested that an update download should begin.
  180. */
  181. OP_STATUS DownloadUpdate();
  182. /**
  183. * Get download page url (www.opera.com/download)
  184. */
  185. OP_STATUS GetDownloadPageURL(OpString& url);
  186. /**
  187. * Get the Opera version
  188. */
  189. static OperaVersion& GetOperaVersion() { return m_opera_version; }
  190. /**
  191. * Stores the given int preference value and commits the preference store. Does leave trapping and converts it to OP_STATUS.
  192. *
  193. * @param which - The int preference ID to store, i.e. PrefsCollectionUI::TimeOfLastUpdateCheck
  194. * @param val - The new preference value to be stored
  195. *
  196. * @returns - OpStatus::OK saving and commiting the change went well, error code otherwise.
  197. */
  198. OP_STATUS WritePref(PrefsCollectionUI::integerpref which, int val);
  199. AutoUpdater();
  200. /**
  201. * Destructor.
  202. */
  203. virtual ~AutoUpdater();
  204. /** Sets the user initiated flag. @see m_user_initiated. */
  205. void SetIsUserInitited(BOOL val) { m_user_initiated = val; }
  206. protected:
  207. StatusXMLDownloader* m_xml_downloader; ///< Holds the downloader that manages downloading the status xml.
  208. AutoUpdateXML* m_autoupdate_xml;
  209. AutoUpdateServerURL* m_autoupdate_server_url;
  210. /**
  211. * OpTimerListener implementation
  212. */
  213. virtual void OnTimeOut( OpTimer *timer );
  214. /**
  215. * Get download status
  216. */
  217. void GetDownloadStatus(INT32* total_file_count, INT32* downloaded_file_count, INT32* failed_download_count);
  218. /**
  219. * Check all resources
  220. */
  221. BOOL CheckAllResources();
  222. /**
  223. * Get the type of the (possibly) available update
  224. */
  225. UpdatableResource::UpdatableResourceType GetAvailableUpdateType() const;
  226. /**
  227. * Get the version of the (possibly) available update
  228. */
  229. BOOL GetAvailablePackageInfo(OpString* version, OpString* info_url, OpFileLength* size) const;
  230. /**
  231. * Get the total size of the update
  232. */
  233. OpFileLength GetTotalUpdateSize() const;
  234. /**
  235. * Check current update state, and decide on next action
  236. */
  237. virtual OP_STATUS CheckAndUpdateState();
  238. /**
  239. * MessageObject override
  240. */
  241. virtual void HandleCallback(OpMessage msg, MH_PARAM_1 par1, MH_PARAM_2 par2);
  242. private:
  243. /*
  244. * The autoupdate automatic check scheduling works by the following rules. All time values are given in seconds.
  245. *
  246. * Preferences:
  247. *
  248. * PrefsCollectionUI::TimeOfLastUpdateCheck - The timestamp of the last update check, saved after each automatic autoupdate check request is made with success;
  249. * PrefsCollectionUI::UpdateCheckInterval - Number of seconds between automatic update checks. If changed by the autoupdate server in response to an autoupdate
  250. * request, will cause to drop the package update, should any be received with the autoupdate response;
  251. * PrefsCollectionUI::DelayedUpdateCheckInterval - Number of seconds added to PrefsCollectionUI::UpdateCheckInterval while scheduling an autoupdate check, will be
  252. * increased by the autoupdate mechanism when an error occurs during automatic update check, will be returned back to
  253. * 0 after a succesful download of the autoupdate XML response;
  254. *
  255. * Constants:
  256. * These values are mainly used to guard the settings read from preferences.
  257. *
  258. * MAX_UPDATE_CHECK_INTERVAL_SEC - Maximum interval between two automatic checks;
  259. * MIN_UPDATE_CHECK_INTERVAL_SEC - Minimum interval between two automatic checks, used when scheduling a check after the browser has started;
  260. * MIN_UPDATE_CHECK_INTERVAL_RUNNING_SEC - Minimum interval between two automatic checks, used when scheduling a check after a previous check during one browser session;
  261. * UPDATE_CHECK_INTERVAL_DELTA - The number of seconds that will be added to the DelayedUpdateCheckInterval after an unsuccesful autoupdate check;
  262. * AUTOUPDATE_RECHECK_TIMEOUT - The number of seconds that need to pass in order to redownload the autoupdate XML after the browser exited duting downloading of an
  263. * update, most likely as a result of a crash. If the browser is run again before this time elapses, the already downloaded XML response
  264. * is used if possible.
  265. *
  266. * Scheduling an update check:
  267. *
  268. * 1. Update check is scheduled:
  269. * a) at browser startup - AutoUpdater::Activate();
  270. * b) after a succeful check - AutoUpdater::CheckAndUpdateState() for state AUSUpToDate;
  271. * c) after a check error - AutoUpdater::CheckAndUpdateState() for state AUSError.
  272. * 2. The number of seconds to next update check is calculated ad follows:
  273. * The time of last check and time between checks is read from the preferences, see above. The time between checks is the sum of the UpdateCheckInterval and DelayedUpdateCheckInterval values.
  274. * The sum is then normalized so that is falls into the range of [MIN_UPDATE_CHECK_INTERVAL_RUNNING_SEC, MAX_UPDATE_CHECK_INTERVAL_SEC] during normal operation (see 1b and 1c) and
  275. * [MIN_UPDATE_CHECK_INTERVAL_SEC, MAX_UPDATE_CHECK_INTERVAL_SEC] at browser startup (1a). The time of next scheduled check is then calculated by adding the time between checks to the time
  276. * of last check read from preferences (TimeOfLastUpdateCheck). If the time of next scheduled check is in the past, the check is scheduled immediately, otherwise the calculated time of next check
  277. * is used. The minimum scheduled time is 1 second for debug builds and 5 seconds for release builds.
  278. *
  279. */
  280. /**
  281. * Maximal time between two automatic updates
  282. */
  283. static const int MAX_UPDATE_CHECK_INTERVAL_SEC;
  284. /**
  285. * Minimal time between two automatic checks, used when scheduling an update check on browser startup
  286. */
  287. static const int MIN_UPDATE_CHECK_INTERVAL_SEC;
  288. /**
  289. * Minimal time between two automatic checks happening during one browser session
  290. */
  291. static const int MIN_UPDATE_CHECK_INTERVAL_RUNNING_SEC;
  292. /**
  293. * The update check interval will be increased with this value on each update check failure
  294. */
  295. static const int UPDATE_CHECK_INTERVAL_DELTA_SEC;
  296. /**
  297. * Timeout to determine if we should use an already downloaded xml on disk, or check with the server again,
  298. * when e.g. downloading was aborted last time we ran Opera.
  299. * If the current time minus the time of last check is greater than this timeout, we recheck with the server.
  300. */
  301. static const int AUTOUPDATE_RECHECK_TIMEOUT_SEC;
  302. /**
  303. * Retry period in case the core SSL updaters are busy at the moment of autoupdate check. The AutoUpdater class will
  304. * retry the update check attempt within the given time in such a case.
  305. * Value given in seconds.
  306. */
  307. static const int AUTOUPDATE_SSL_UPDATERS_BUSY_RECHECK_TIMEOUT_SEC;
  308. /**
  309. * The base timeout for resource checking, see DSK-336588. During activation of the autoupdate module, we check the
  310. * resource timestamps, see AutpUpdateXML::NeedsResourceCheck(). In case we want to update the resources only (i.e.
  311. * in case any of the resources checked have a zero timestamp), we trigger a resource update check "right after"
  312. * activation of the module.
  313. * The "right after" time is determined by this base time with the DelayedUpdateCheckInterval added to it.
  314. */
  315. static const int AUTOUPDATE_RESOURCE_CHECK_BASE_TIMEOUT_SEC;
  316. /**
  317. * Function that starts the download of the status XML document supplying
  318. * the necessary parameters. When the document is done downloading, the
  319. * StatusXMLDownloaded will be called. The caller of this function can
  320. * just return control and do nothing until this callback arrives.
  321. *
  322. * @return OK if the download is correctly initiated, err otherwise.
  323. */
  324. OP_STATUS DownloadStatusXML();
  325. /**
  326. * Schedules an immediate resource update check. Sets the m_resource_check_only flag to TRUE. If an update
  327. * check is already scheduled, the schedule timer will be deleted and the resource check will be scheduled.
  328. * The update check schedule will be restored after the resource check finishes.
  329. *
  330. * @return OK if the check was scheduled correctly, ERR_NO_ACCESS if a check is currently in progress,
  331. * ERR_NO_MEMORY on OOM.
  332. */
  333. OP_STATUS ScheduleResourceCheck();
  334. /**
  335. * Method encapsulating starting of the timer that triggers an update check.
  336. * Sets the m_resource_check_only flag to FALSE.
  337. *
  338. * @param timeout Timeout in sections until update check
  339. *
  340. * @return OK if the check was scheduled correctly, ERR otherwise.
  341. */
  342. OP_STATUS ScheduleUpdateCheck(ScheduleCheckType schedule_type);
  343. /**
  344. * This method returns the number of seconds to the next update check at the moment
  345. * of the call.
  346. *
  347. * This method is overriden by selftests in order to schedule an immediate check.
  348. *
  349. * @param timeout Timeout in sections until update check
  350. *
  351. * @return The number of seconds that need to pass until the next update check occurs.
  352. */
  353. virtual int CalculateTimeOfNextUpdateCheck(ScheduleCheckType schedule_type);
  354. /**
  355. * This method returns the number of seconds for the initial resource check, if any is
  356. * needed. More information can be found in DSK-336588.
  357. *
  358. * @return The number of seconds that need to pass before we do the resource check.
  359. */
  360. int CalculateTimeOfResourceCheck();
  361. /**
  362. * Function starting downloading of specified types
  363. *
  364. * @param include_resources_requiring_restart TRUE if add types that would require restart to complete update
  365. *
  366. * @return OK if the download was started, ERR otherwise.
  367. */
  368. OP_STATUS DownloadUpdate(BOOL include_resources_requiring_restart);
  369. /**
  370. * Function starting next download
  371. *
  372. * @param previous_download Previous finished download
  373. *
  374. * @return OK if the download started, ERR on failure, ERR_NO_SUCH_RESOURCE if no more files to download.
  375. */
  376. OP_STATUS StartNextDownload(FileDownloader* previous_download);
  377. /**
  378. * Function stopping downloading
  379. *
  380. * @return OK if the downloads were stopped, ERR otherwise.
  381. */
  382. OP_STATUS StopDownloads();
  383. /**
  384. * Function encapsulating starting of the timer that triggers a new download.
  385. * The function will work out how long the timer needs to be set for itself.
  386. *
  387. * @return OK if the check was scheduled correctly, ERR otherwise.
  388. */
  389. OP_STATUS ScheduleDownload();
  390. /**
  391. * Function to start updating the implied types.
  392. *
  393. * @param include_resources_requiring_restart TRUE if add types that would require restart to complete update
  394. *
  395. * @return OK if updating succeeded, ERR otherwise.
  396. */
  397. OP_STATUS StartUpdate(BOOL include_resources_requiring_restart);
  398. /**
  399. * Function to clean up all resources.
  400. */
  401. OP_STATUS CleanupAllResources();
  402. #ifndef _MACINTOSH_
  403. /**
  404. * Tries to run the checker.
  405. */
  406. OP_STATUS TryRunningChecker();
  407. #endif // _MACINTOSH_
  408. /**
  409. * Broadcasts autoupdate events to all the listeners
  410. *
  411. */
  412. void BroadcastOnUpToDate(BOOL silent);
  413. void BroadcastOnChecking(BOOL silent);
  414. void BroadcastOnUpdateAvailable(UpdatableResource::UpdatableResourceType type, OpFileLength update_size, const uni_char* update_info_url, BOOL silent);
  415. void BroadcastOnDownloading(UpdatableResource::UpdatableResourceType type, OpFileLength total_size, OpFileLength downloaded_size, double kbps, unsigned long time_estimate, BOOL silent);
  416. void BroadcastOnDownloadingDone(UpdatableResource::UpdatableResourceType type, const OpString& filename, OpFileLength total_size, BOOL silent);
  417. void BroadcastOnDownloadingFailed(BOOL silent);
  418. void BroadcastOnRestartingDownload(INT32 seconds_until_restart, AutoUpdateError last_error, BOOL silent);
  419. void BroadcastOnReadyToUpdate();
  420. void BroadcastOnUpdating();
  421. void BroadcastOnFinishedUpdating();
  422. void BroadcastOnUnpacking();
  423. void BroadcastOnReadyToInstallNewVersion(const OpString& version, BOOL silent);
  424. void BroadcastOnError(AutoUpdateError error, BOOL silent);
  425. /**
  426. * Set autoupdate set
  427. */
  428. OP_STATUS SetUpdateState(AutoUpdateState update_state);
  429. /**
  430. * Set last error
  431. */
  432. void SetLastError(AutoUpdateError error) { m_last_error = error; }
  433. /**
  434. * Indicates if it is a silently running update.
  435. *
  436. * If the update is triggered by the user (ie using CheckForUpdates() or DownloadUpdate()),
  437. * the update is not silent. Otherwise, it is silent. Exception: if update level is CheckForUpdates,
  438. * automatic updates are silent only until an update is available.
  439. */
  440. BOOL IsSilent() const { return m_silent_update; }
  441. /**
  442. * Reset internal members.
  443. */
  444. void Reset();
  445. #ifdef AUTOUPDATE_PACKAGE_INSTALLATION
  446. /**
  447. * Check if a newer version has been downloaded
  448. *
  449. * Check if we have the autoupdate.txt file
  450. * This means the user have downloaded a newer version, but not installed it yet.
  451. * Dont ask for upgrades in this case.
  452. */
  453. virtual BOOL HasDownloadedNewerVersion();
  454. /**
  455. * Delete the upgrade folder if there is no autoupdate.txt there.
  456. *
  457. */
  458. void DeleteUpgradeFolderIfNeeded();
  459. #endif
  460. /**
  461. * Increases the value stored in the PrefsCollectionUI::DelayedUpdateCheckInterval preference. The value is used
  462. * to increase the interval to the next update check in case of error.
  463. * See more information about calculating the time of next update check above.
  464. *
  465. */
  466. void IncreaseDelayedUpdateCheckInterval();
  467. LevelOfAutomation m_level_of_automation; ///< Holds the level of automation
  468. AutoUpdateState m_update_state; ///< Holds the state of updating (whether an update has been discovered)
  469. OpListeners<AutoUpdateListener> m_listeners; ///< Listener for autoupdate events for external classes
  470. BOOL m_silent_update; ///< Indicates if it is a silently running update
  471. AutoUpdateError m_last_error; ///< Last occurred error
  472. OpTimer* m_update_check_timer; ///< Timer for rescheduling update check
  473. OpTimer* m_download_timer; ///< Timer for rescheduling download
  474. INT32 m_download_countdown; ///< Holds the remaining seconds till restarting download
  475. INT32 m_download_retries; ///< Holds the number retried downloads
  476. BOOL m_activated; ///< Set if the autoupdater has been activated
  477. BOOL m_check_increased_update_check_interval; ///< Set if autoupdater should check if the server is increasing the update check interval. In case it does, any packages should not be downloaded to avoid overloading the server.
  478. BOOL m_include_resources_requiring_restart; ///< When updating include resources that would need restart for update completion
  479. BOOL m_resources_check_only; ///< Determines what update level will be used for the update check, resources only or an full update check.
  480. static OperaVersion m_opera_version; ///< Holds the current Opera version
  481. AutoUpdateState m_state_after_unpacking; ///<Which state to move to once unpacking is done
  482. // AutoUpdater keeps time of last update check, interval, and delay in member variables,
  483. // because prefs, where these values are also stored, may be read only (DSK-353750)
  484. time_t m_time_of_last_update_check; ///< Time of last update check in seconds
  485. INT32 m_update_check_interval; ///< Interval between update checks in seconds
  486. INT32 m_update_check_random_delta; ///< A random time delta (in seconds) added to the check interval in order to have slightly different check time. It's needed by the server to detect UUID/LUT collisions.
  487. INT32 m_update_check_delay; ///< Additional delay for update check in seconds, used when server is not responding
  488. BOOL m_user_initiated; ///< TRUE if the current check is initiated by a user. It should be cleared after the check is done.
  489. #ifndef _MACINTOSH_
  490. opera_update_checker::ipc::Channel* m_channel_to_checker; ///< IPC channel to the checker process.
  491. INT64 m_channel_id; ///< Id of the communication channel to the checker.
  492. OpString m_checker_path; ///< The path to the checker executable.
  493. OpTimer* m_checker_launch_retry_timer; ///< The checker launch retry timer.
  494. unsigned m_checker_launch_retry_count; ///< The counter of the checker launch reties.
  495. CheckerState m_checker_state; ///< The current checker state.
  496. static const unsigned MAX_CHECKER_LAUNCH_RETRIES = 5;
  497. static const unsigned CHECKER_LAUNCH_RETRY_TIME_MS = 10000;
  498. #endif // _MACINTOSH_
  499. };
  500. namespace Console
  501. {
  502. /* Write message to console */
  503. void WriteMessage(const uni_char* message);
  504. /* Write error to console */
  505. void WriteError(const uni_char* error);
  506. };
  507. #endif // AUTO_UPDATE_SUPPORT
  508. #endif // _AUTOUPDATER_H_INCLUDED_