NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / webui / help / version_updater.h
blob190ada756cc2eb9997f2bd804b54fd5b6144f825
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_H_
6 #define CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "base/strings/string16.h"
13 // Interface implemented to expose per-platform updating functionality.
14 class VersionUpdater {
15 public:
16 // Update process state machine.
17 enum Status {
18 CHECKING,
19 UPDATING,
20 NEARLY_UPDATED,
21 UPDATED,
22 FAILED,
23 FAILED_OFFLINE,
24 FAILED_CONNECTION_TYPE_DISALLOWED,
25 DISABLED,
28 #if defined(OS_MACOSX)
29 // Promotion state.
30 enum PromotionState {
31 PROMOTE_HIDDEN,
32 PROMOTE_ENABLED,
33 PROMOTE_DISABLED
35 #endif // defined(OS_MACOSX)
37 // TODO(jhawkins): Use a delegate interface instead of multiple callback
38 // types.
39 #if defined(OS_CHROMEOS)
40 typedef base::Callback<void(const std::string&)> ChannelCallback;
41 #endif
43 // Used to update the client of status changes. int parameter is the progress
44 // and should only be non-zero for the UPDATING state.
45 // base::string16 parameter is a message explaining a failure.
46 typedef base::Callback<void(Status, int, const base::string16&)>
47 StatusCallback;
49 #if defined(OS_MACOSX)
50 // Used to show or hide the promote UI elements.
51 typedef base::Callback<void(PromotionState)> PromoteCallback;
52 #endif
54 virtual ~VersionUpdater() {}
56 // Sub-classes must implement this method to create the respective
57 // specialization.
58 static VersionUpdater* Create();
60 // Begins the update process by checking for update availability.
61 // |status_callback| is called for each status update. |promote_callback| can
62 // be used to show or hide the promote UI elements.
63 virtual void CheckForUpdate(const StatusCallback& status_callback
64 #if defined(OS_MACOSX)
65 , const PromoteCallback& promote_callback
66 #endif
67 ) = 0;
69 #if defined(OS_MACOSX)
70 // Make updates available for all users.
71 virtual void PromoteUpdater() const = 0;
72 #endif
74 // Relaunches the browser, generally after being updated.
75 virtual void RelaunchBrowser() const = 0;
77 #if defined(OS_CHROMEOS)
78 virtual void SetChannel(const std::string& channel,
79 bool is_powerwash_allowed) = 0;
80 virtual void GetChannel(bool get_current_channel,
81 const ChannelCallback& callback) = 0;
82 #endif
85 #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_H_