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_
10 #include "base/callback.h"
11 #include "base/strings/string16.h"
17 // Interface implemented to expose per-platform updating functionality.
18 class VersionUpdater
{
20 // Update process state machine.
28 FAILED_CONNECTION_TYPE_DISALLOWED
,
32 #if defined(OS_MACOSX)
39 #endif // defined(OS_MACOSX)
41 // TODO(jhawkins): Use a delegate interface instead of multiple callback
43 #if defined(OS_CHROMEOS)
44 typedef base::Callback
<void(const std::string
&)> ChannelCallback
;
47 // Used to update the client of status changes. int parameter is the progress
48 // and should only be non-zero for the UPDATING state.
49 // base::string16 parameter is a message explaining a failure.
50 typedef base::Callback
<void(Status
, int, const base::string16
&)>
53 #if defined(OS_MACOSX)
54 // Used to show or hide the promote UI elements.
55 typedef base::Callback
<void(PromotionState
)> PromoteCallback
;
58 virtual ~VersionUpdater() {}
60 // Sub-classes must implement this method to create the respective
62 static VersionUpdater
* Create(content::WebContents
* web_contents
);
64 // Begins the update process by checking for update availability.
65 // |status_callback| is called for each status update. |promote_callback| can
66 // be used to show or hide the promote UI elements.
67 virtual void CheckForUpdate(const StatusCallback
& status_callback
68 #if defined(OS_MACOSX)
69 , const PromoteCallback
& promote_callback
73 #if defined(OS_MACOSX)
74 // Make updates available for all users.
75 virtual void PromoteUpdater() const = 0;
78 // Relaunches the browser, generally after being updated.
79 virtual void RelaunchBrowser() const = 0;
81 #if defined(OS_CHROMEOS)
82 virtual void SetChannel(const std::string
& channel
,
83 bool is_powerwash_allowed
) = 0;
84 virtual void GetChannel(bool get_current_channel
,
85 const ChannelCallback
& callback
) = 0;
89 #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_H_