2014-10-31 18:17:05 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
2014-04-25 09:49:37 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2013-06-02 12:23:04 +00:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2019-06-19 20:56:58 +00:00
|
|
|
#ifndef SHELL_BROWSER_AUTO_UPDATER_H_
|
|
|
|
#define SHELL_BROWSER_AUTO_UPDATER_H_
|
2013-06-02 12:23:04 +00:00
|
|
|
|
2016-06-10 13:55:42 +00:00
|
|
|
#include <map>
|
2013-06-03 02:34:42 +00:00
|
|
|
#include <string>
|
|
|
|
|
2016-03-08 04:38:49 +00:00
|
|
|
#include "base/macros.h"
|
2016-03-09 11:03:42 +00:00
|
|
|
#include "build/build_config.h"
|
2013-06-02 12:23:04 +00:00
|
|
|
|
2015-10-23 07:40:56 +00:00
|
|
|
namespace base {
|
|
|
|
class Time;
|
|
|
|
}
|
|
|
|
|
2020-07-28 18:04:34 +00:00
|
|
|
namespace gin {
|
2019-10-18 00:31:29 +00:00
|
|
|
class Arguments;
|
|
|
|
}
|
|
|
|
|
2013-06-02 12:23:04 +00:00
|
|
|
namespace auto_updater {
|
|
|
|
|
2015-10-23 07:40:56 +00:00
|
|
|
class Delegate {
|
|
|
|
public:
|
|
|
|
// An error happened.
|
2021-06-01 01:46:25 +00:00
|
|
|
virtual void OnError(const std::string& message) {}
|
2015-10-23 07:40:56 +00:00
|
|
|
|
2021-06-01 01:46:25 +00:00
|
|
|
virtual void OnError(const std::string& message,
|
2018-04-18 01:44:10 +00:00
|
|
|
const int code,
|
2017-07-27 01:52:19 +00:00
|
|
|
const std::string& domain) {}
|
2017-07-27 01:10:09 +00:00
|
|
|
|
2015-10-23 07:40:56 +00:00
|
|
|
// Checking to see if there is an update
|
|
|
|
virtual void OnCheckingForUpdate() {}
|
|
|
|
|
|
|
|
// There is an update available and it is being downloaded
|
|
|
|
virtual void OnUpdateAvailable() {}
|
|
|
|
|
|
|
|
// There is no available update.
|
|
|
|
virtual void OnUpdateNotAvailable() {}
|
|
|
|
|
|
|
|
// There is a new update which has been downloaded.
|
|
|
|
virtual void OnUpdateDownloaded(const std::string& release_notes,
|
|
|
|
const std::string& release_name,
|
|
|
|
const base::Time& release_date,
|
|
|
|
const std::string& update_url) {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~Delegate() {}
|
|
|
|
};
|
2013-06-02 12:23:04 +00:00
|
|
|
|
|
|
|
class AutoUpdater {
|
|
|
|
public:
|
2016-06-10 13:55:42 +00:00
|
|
|
typedef std::map<std::string, std::string> HeaderMap;
|
|
|
|
|
2013-06-02 12:23:04 +00:00
|
|
|
// Gets/Sets the delegate.
|
2015-10-23 07:40:56 +00:00
|
|
|
static Delegate* GetDelegate();
|
|
|
|
static void SetDelegate(Delegate* delegate);
|
2013-06-02 12:23:04 +00:00
|
|
|
|
2016-07-14 12:04:48 +00:00
|
|
|
static std::string GetFeedURL();
|
2019-10-18 00:31:29 +00:00
|
|
|
// FIXME(zcbenz): We should not do V8 in this file, this method should only
|
|
|
|
// accept C++ struct as parameter, and atom_api_auto_updater.cc is responsible
|
|
|
|
// for parsing the parameter from JavaScript.
|
2020-07-28 18:04:34 +00:00
|
|
|
static void SetFeedURL(gin::Arguments* args);
|
2013-06-03 02:34:42 +00:00
|
|
|
static void CheckForUpdates();
|
2015-10-23 07:40:56 +00:00
|
|
|
static void QuitAndInstall();
|
2013-06-02 12:23:04 +00:00
|
|
|
|
|
|
|
private:
|
2015-10-23 07:40:56 +00:00
|
|
|
static Delegate* delegate_;
|
2013-06-02 12:23:04 +00:00
|
|
|
|
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(AutoUpdater);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace auto_updater
|
|
|
|
|
2019-06-19 20:56:58 +00:00
|
|
|
#endif // SHELL_BROWSER_AUTO_UPDATER_H_
|