Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: chrome/browser/ui/webui/help/version_updater.h

Issue 2795603002: Add an update warning for downloading over mobile data (Closed)
Patch Set: Ignore this as I uploaded a new CL Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "build/build_config.h" 12 #include "build/build_config.h"
13 13
14 #if defined(OS_CHROMEOS) 14 #if defined(OS_CHROMEOS)
15 #include "third_party/cros_system_api/dbus/update_engine/dbus-constants.h" 15 #include "third_party/cros_system_api/dbus/update_engine/dbus-constants.h"
16 #endif // defined(OS_CHROMEOS) 16 #endif // defined(OS_CHROMEOS)
17 17
18 namespace content { 18 namespace content {
19 class WebContents; 19 class WebContents;
20 } 20 }
21 21
22 // Interface implemented to expose per-platform updating functionality. 22 // Interface implemented to expose per-platform updating functionality.
23 class VersionUpdater { 23 class VersionUpdater {
24 public: 24 public:
25 // Update process state machine. 25 // Update process state machine.
26 enum Status { 26 enum Status {
27 CHECKING, 27 CHECKING,
28 NEED_PERMISSION_TO_UPDATE,
28 UPDATING, 29 UPDATING,
29 NEARLY_UPDATED, 30 NEARLY_UPDATED,
30 UPDATED, 31 UPDATED,
31 FAILED, 32 FAILED,
32 FAILED_OFFLINE, 33 FAILED_OFFLINE,
33 FAILED_CONNECTION_TYPE_DISALLOWED, 34 FAILED_CONNECTION_TYPE_DISALLOWED,
34 DISABLED, 35 DISABLED,
35 DISABLED_BY_ADMIN 36 DISABLED_BY_ADMIN
36 }; 37 };
37 38
38 // Promotion state (Mac-only). 39 // Promotion state (Mac-only).
39 enum PromotionState { 40 enum PromotionState {
40 PROMOTE_HIDDEN, 41 PROMOTE_HIDDEN,
41 PROMOTE_ENABLED, 42 PROMOTE_ENABLED,
42 PROMOTE_DISABLED, 43 PROMOTE_DISABLED,
43 PROMOTED, 44 PROMOTED,
44 }; 45 };
45 46
46 // TODO(jhawkins): Use a delegate interface instead of multiple callback 47 // TODO(jhawkins): Use a delegate interface instead of multiple callback
47 // types. 48 // types.
48 #if defined(OS_CHROMEOS) 49 #if defined(OS_CHROMEOS)
49 typedef base::Callback<void(const std::string&)> ChannelCallback; 50 typedef base::Callback<void(const std::string&)> ChannelCallback;
50 typedef base::Callback<void(update_engine::EndOfLifeStatus status)> 51 typedef base::Callback<void(update_engine::EndOfLifeStatus status)>
51 EolStatusCallback; 52 EolStatusCallback;
52 #endif 53 #endif
53 54
54 // Used to update the client of status changes. int parameter is the progress 55 // Used to update the client of status changes. int parameter is the progress
55 // and should only be non-zero for the UPDATING state. 56 // and should only be non-zero for the UPDATING state.
57 // std::string parameter is the version of the available update and should be
58 // empty string when update is not available.
59 // int64_t parameter is the size in bytes of the available update and should
60 // be 0 when update is not available.
56 // base::string16 parameter is a message explaining a failure. 61 // base::string16 parameter is a message explaining a failure.
57 typedef base::Callback<void(Status, int, const base::string16&)> 62 typedef base::Callback<void(Status,
63 int,
64 const std::string&,
65 const int64_t,
66 const base::string16&)>
58 StatusCallback; 67 StatusCallback;
59 68
60 // Used to show or hide the promote UI elements. Mac-only. 69 // Used to show or hide the promote UI elements. Mac-only.
61 typedef base::Callback<void(PromotionState)> PromoteCallback; 70 typedef base::Callback<void(PromotionState)> PromoteCallback;
62 71
63 virtual ~VersionUpdater() {} 72 virtual ~VersionUpdater() {}
64 73
65 // Sub-classes must implement this method to create the respective 74 // Sub-classes must implement this method to create the respective
66 // specialization. |web_contents| may be null, in which case any required UX 75 // specialization. |web_contents| may be null, in which case any required UX
67 // (e.g., UAC to elevate on Windows) may not be associated with any existing 76 // (e.g., UAC to elevate on Windows) may not be associated with any existing
68 // browser windows. 77 // browser windows.
69 static VersionUpdater* Create(content::WebContents* web_contents); 78 static VersionUpdater* Create(content::WebContents* web_contents);
70 79
71 // Begins the update process by checking for update availability. 80 // Begins the update process by checking for update availability.
72 // |status_callback| is called for each status update. |promote_callback| 81 // |status_callback| is called for each status update. |promote_callback|
73 // (which is only used on the Mac) can be used to show or hide the promote UI 82 // (which is only used on the Mac) can be used to show or hide the promote UI
74 // elements. 83 // elements.
75 virtual void CheckForUpdate(const StatusCallback& status_callback, 84 virtual void CheckForUpdate(const StatusCallback& status_callback,
76 const PromoteCallback& promote_callback) = 0; 85 const PromoteCallback& promote_callback) = 0;
77 86
87 // Set the update over cellular target in preferences maintained by update
88 // engine. The preferences are latter used by update engine to match the given
89 // target with the server head and to allow update over cellular to this given
90 // target.
91 virtual void SetUpdateOverCellularTarget(const StatusCallback& callback,
92 const std::string& target_version,
93 int64_t target_size) = 0;
94
78 #if defined(OS_MACOSX) 95 #if defined(OS_MACOSX)
79 // Make updates available for all users. 96 // Make updates available for all users.
80 virtual void PromoteUpdater() const = 0; 97 virtual void PromoteUpdater() const = 0;
81 #endif 98 #endif
82 99
83 #if defined(OS_CHROMEOS) 100 #if defined(OS_CHROMEOS)
84 virtual void SetChannel(const std::string& channel, 101 virtual void SetChannel(const std::string& channel,
85 bool is_powerwash_allowed) = 0; 102 bool is_powerwash_allowed) = 0;
86 virtual void GetChannel(bool get_current_channel, 103 virtual void GetChannel(bool get_current_channel,
87 const ChannelCallback& callback) = 0; 104 const ChannelCallback& callback) = 0;
88 virtual void GetEolStatus(const EolStatusCallback& callback) = 0; 105 virtual void GetEolStatus(const EolStatusCallback& callback) = 0;
89 #endif 106 #endif
90 }; 107 };
91 108
92 #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_H_ 109 #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/help/help_handler.cc ('k') | chrome/browser/ui/webui/help/version_updater_basic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698