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

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

Issue 578293002: Fixed channel switch when user decides to switch to another channel in (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase, fix. Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/help/version_updater_chromeos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_CHROMEOS_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_
6 #define CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_ 6 #define CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/ui/webui/help/version_updater.h" 10 #include "chrome/browser/ui/webui/help/version_updater.h"
11 #include "chromeos/dbus/update_engine_client.h" 11 #include "chromeos/dbus/update_engine_client.h"
12 12
13 class VersionUpdaterCros : public VersionUpdater, 13 class VersionUpdaterCros : public VersionUpdater,
14 public chromeos::UpdateEngineClient::Observer { 14 public chromeos::UpdateEngineClient::Observer {
15 public: 15 public:
16 // VersionUpdater implementation. 16 // VersionUpdater implementation.
17 virtual void CheckForUpdate(const StatusCallback& callback) OVERRIDE; 17 virtual void CheckForUpdate(const StatusCallback& callback) OVERRIDE;
18 virtual void RelaunchBrowser() const OVERRIDE; 18 virtual void RelaunchBrowser() const OVERRIDE;
19 virtual void SetChannel(const std::string& channel, 19 virtual void SetChannel(const std::string& channel,
20 bool is_powerwash_allowed) OVERRIDE; 20 bool is_powerwash_allowed) OVERRIDE;
21 virtual void GetChannel(bool get_current_channel, 21 virtual void GetChannel(bool get_current_channel,
22 const ChannelCallback& callback) OVERRIDE; 22 const ChannelCallback& callback) OVERRIDE;
23 23
24 // Gets the last update status, without triggering a new check or download. 24 // Gets the last update status, without triggering a new check or download.
25 void GetUpdateStatus(const StatusCallback& callback); 25 void GetUpdateStatus(const StatusCallback& callback);
26 26
27 void set_can_update_for_testing(bool can_update_for_testing) {
28 can_update_for_testing_ = can_update_for_testing;
29 }
30
27 protected: 31 protected:
28 friend class VersionUpdater; 32 friend class VersionUpdater;
29 33
30 // Clients must use VersionUpdater::Create(). 34 // Clients must use VersionUpdater::Create().
31 VersionUpdaterCros(); 35 VersionUpdaterCros();
32 virtual ~VersionUpdaterCros(); 36 virtual ~VersionUpdaterCros();
33 37
34 private: 38 private:
35 // UpdateEngineClient::Observer implementation. 39 // UpdateEngineClient::Observer implementation.
36 virtual void UpdateStatusChanged( 40 virtual void UpdateStatusChanged(
37 const chromeos::UpdateEngineClient::Status& status) OVERRIDE; 41 const chromeos::UpdateEngineClient::Status& status) OVERRIDE;
38 42
39 // Callback from UpdateEngineClient::RequestUpdateCheck(). 43 // Callback from UpdateEngineClient::RequestUpdateCheck().
40 void OnUpdateCheck(chromeos::UpdateEngineClient::UpdateCheckResult result); 44 void OnUpdateCheck(chromeos::UpdateEngineClient::UpdateCheckResult result);
41 45
46 // Returns whether an update is allowed. If not, it calls the callback with
47 // the appropriate status.
48 bool EnsureCanUpdate(const StatusCallback& callback);
49
42 // Callback used to communicate update status to the client. 50 // Callback used to communicate update status to the client.
43 StatusCallback callback_; 51 StatusCallback callback_;
44 52
45 // Last state received via UpdateStatusChanged(). 53 // Last state received via UpdateStatusChanged().
46 chromeos::UpdateEngineClient::UpdateStatusOperation last_operation_; 54 chromeos::UpdateEngineClient::UpdateStatusOperation last_operation_;
47 55
56 // True if an update check should be scheduled when the update engine will
James Hawkins 2014/09/22 16:48:31 Optional nit: This is easier to grok for me if you
ygorshenin1 2014/09/22 19:01:54 Done.
57 // be idle.
58 bool check_for_update_when_idle_;
59
60 // True if an update check can be performed in tests.
61 bool can_update_for_testing_;
James Hawkins 2014/09/22 16:48:31 I took a high-level look at what you're trying to
ygorshenin1 2014/09/22 19:01:54 I've made a virtual EnsureCanUpdate() method and o
62
48 base::WeakPtrFactory<VersionUpdaterCros> weak_ptr_factory_; 63 base::WeakPtrFactory<VersionUpdaterCros> weak_ptr_factory_;
49 64
50 DISALLOW_COPY_AND_ASSIGN(VersionUpdaterCros); 65 DISALLOW_COPY_AND_ASSIGN(VersionUpdaterCros);
51 }; 66 };
52 67
53 #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_ 68 #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/help/version_updater_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698