OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 | 12 |
| 13 namespace content { |
| 14 class BrowserContext; |
| 15 } |
| 16 |
13 // Interface implemented to expose per-platform updating functionality. | 17 // Interface implemented to expose per-platform updating functionality. |
14 class VersionUpdater { | 18 class VersionUpdater { |
15 public: | 19 public: |
16 // Update process state machine. | 20 // Update process state machine. |
17 enum Status { | 21 enum Status { |
18 CHECKING, | 22 CHECKING, |
19 UPDATING, | 23 UPDATING, |
20 NEARLY_UPDATED, | 24 NEARLY_UPDATED, |
21 UPDATED, | 25 UPDATED, |
22 FAILED, | 26 FAILED, |
(...skipping 25 matching lines...) Expand all Loading... |
48 | 52 |
49 #if defined(OS_MACOSX) | 53 #if defined(OS_MACOSX) |
50 // Used to show or hide the promote UI elements. | 54 // Used to show or hide the promote UI elements. |
51 typedef base::Callback<void(PromotionState)> PromoteCallback; | 55 typedef base::Callback<void(PromotionState)> PromoteCallback; |
52 #endif | 56 #endif |
53 | 57 |
54 virtual ~VersionUpdater() {} | 58 virtual ~VersionUpdater() {} |
55 | 59 |
56 // Sub-classes must implement this method to create the respective | 60 // Sub-classes must implement this method to create the respective |
57 // specialization. | 61 // specialization. |
58 static VersionUpdater* Create(); | 62 static VersionUpdater* Create(content::BrowserContext* context); |
59 | 63 |
60 // Begins the update process by checking for update availability. | 64 // Begins the update process by checking for update availability. |
61 // |status_callback| is called for each status update. |promote_callback| can | 65 // |status_callback| is called for each status update. |promote_callback| can |
62 // be used to show or hide the promote UI elements. | 66 // be used to show or hide the promote UI elements. |
63 virtual void CheckForUpdate(const StatusCallback& status_callback | 67 virtual void CheckForUpdate(const StatusCallback& status_callback |
64 #if defined(OS_MACOSX) | 68 #if defined(OS_MACOSX) |
65 , const PromoteCallback& promote_callback | 69 , const PromoteCallback& promote_callback |
66 #endif | 70 #endif |
67 ) = 0; | 71 ) = 0; |
68 | 72 |
69 #if defined(OS_MACOSX) | 73 #if defined(OS_MACOSX) |
70 // Make updates available for all users. | 74 // Make updates available for all users. |
71 virtual void PromoteUpdater() const = 0; | 75 virtual void PromoteUpdater() const = 0; |
72 #endif | 76 #endif |
73 | 77 |
74 // Relaunches the browser, generally after being updated. | 78 // Relaunches the browser, generally after being updated. |
75 virtual void RelaunchBrowser() const = 0; | 79 virtual void RelaunchBrowser() const = 0; |
76 | 80 |
77 #if defined(OS_CHROMEOS) | 81 #if defined(OS_CHROMEOS) |
78 virtual void SetChannel(const std::string& channel, | 82 virtual void SetChannel(const std::string& channel, |
79 bool is_powerwash_allowed) = 0; | 83 bool is_powerwash_allowed) = 0; |
80 virtual void GetChannel(bool get_current_channel, | 84 virtual void GetChannel(bool get_current_channel, |
81 const ChannelCallback& callback) = 0; | 85 const ChannelCallback& callback) = 0; |
82 #endif | 86 #endif |
83 }; | 87 }; |
84 | 88 |
85 #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_H_ | 89 #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_H_ |
OLD | NEW |