forked from adamlaska/electron
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauto_updater.h
More file actions
79 lines (58 loc) · 2.04 KB
/
auto_updater.h
File metadata and controls
79 lines (58 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_BROWSER_AUTO_UPDATER_H_
#define ELECTRON_SHELL_BROWSER_AUTO_UPDATER_H_
#include <map>
#include <string>
#include "build/build_config.h"
namespace base {
class Time;
}
namespace gin {
class Arguments;
}
namespace auto_updater {
class Delegate {
public:
// An error happened.
virtual void OnError(const std::string& message) {}
virtual void OnError(const std::string& message,
const int code,
const std::string& domain) {}
// 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() {}
};
class AutoUpdater {
public:
typedef std::map<std::string, std::string> HeaderMap;
AutoUpdater() = delete;
// disable copy
AutoUpdater(const AutoUpdater&) = delete;
AutoUpdater& operator=(const AutoUpdater&) = delete;
// Gets/Sets the delegate.
static Delegate* GetDelegate();
static void SetDelegate(Delegate* delegate);
static std::string GetFeedURL();
// 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.
static void SetFeedURL(gin::Arguments* args);
static void CheckForUpdates();
static void QuitAndInstall();
private:
static Delegate* delegate_;
};
} // namespace auto_updater
#endif // ELECTRON_SHELL_BROWSER_AUTO_UPDATER_H_