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

Side by Side Diff: chrome/browser/ui/ash/system_tray_client.h

Issue 2925973002: Migrate upgrade notifications to observer (Closed)
Patch Set: Fix test failure Created 3 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_ASH_SYSTEM_TRAY_CLIENT_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_CLIENT_H_
6 #define CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_CLIENT_H_ 6 #define CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_CLIENT_H_
7 7
8 #include "ash/public/interfaces/system_tray.mojom.h" 8 #include "ash/public/interfaces/system_tray.mojom.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "chrome/browser/chromeos/system/system_clock_observer.h" 10 #include "chrome/browser/chromeos/system/system_clock_observer.h"
11 #include "chrome/browser/upgrade_observer.h" 11 #include "chrome/browser/upgrade_observer.h"
12 #include "components/policy/core/common/cloud/cloud_policy_store.h" 12 #include "components/policy/core/common/cloud/cloud_policy_store.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
15 #include "mojo/public/cpp/bindings/binding.h" 13 #include "mojo/public/cpp/bindings/binding.h"
16 14
17 namespace ash { 15 namespace ash {
18 enum class LoginStatus; 16 enum class LoginStatus;
19 } 17 }
20 18
21 namespace views { 19 namespace views {
22 class Widget; 20 class Widget;
23 class WidgetDelegate; 21 class WidgetDelegate;
24 } 22 }
25 23
26 // Handles method calls delegated back to chrome from ash. Also notifies ash of 24 // Handles method calls delegated back to chrome from ash. Also notifies ash of
27 // relevant state changes in chrome. 25 // relevant state changes in chrome.
28 // TODO: Consider renaming this to SystemTrayClientChromeOS. 26 // TODO: Consider renaming this to SystemTrayClientChromeOS.
29 class SystemTrayClient : public ash::mojom::SystemTrayClient, 27 class SystemTrayClient : public ash::mojom::SystemTrayClient,
30 public chromeos::system::SystemClockObserver, 28 public chromeos::system::SystemClockObserver,
31 public policy::CloudPolicyStore::Observer, 29 public policy::CloudPolicyStore::Observer,
32 public content::NotificationObserver,
33 public UpgradeObserver { 30 public UpgradeObserver {
34 public: 31 public:
35 SystemTrayClient(); 32 SystemTrayClient();
36 ~SystemTrayClient() override; 33 ~SystemTrayClient() override;
37 34
38 static SystemTrayClient* Get(); 35 static SystemTrayClient* Get();
39 36
40 // Returns the login state based on the user type, lock screen status, etc. 37 // Returns the login state based on the user type, lock screen status, etc.
41 static ash::LoginStatus GetUserLoginStatus(); 38 static ash::LoginStatus GetUserLoginStatus();
42 39
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 91
95 // Requests that ash show the update available icon. 92 // Requests that ash show the update available icon.
96 void HandleUpdateAvailable(); 93 void HandleUpdateAvailable();
97 94
98 // Requests that ash show the update over cellular available icon. 95 // Requests that ash show the update over cellular available icon.
99 void HandleUpdateOverCellularAvailable(); 96 void HandleUpdateOverCellularAvailable();
100 97
101 // chromeos::system::SystemClockObserver: 98 // chromeos::system::SystemClockObserver:
102 void OnSystemClockChanged(chromeos::system::SystemClock* clock) override; 99 void OnSystemClockChanged(chromeos::system::SystemClock* clock) override;
103 100
104 // UpgradeObserver: 101 // UpgradeObserver implementation.
105 void OnUpdateOverCellularAvailable() override; 102 void OnUpdateOverCellularAvailable() override;
106 103
104 // UpgradeObserver implementation.
sky 2017/06/07 23:01:41 Generally we group overrides, and don't have newli
weidongg 2017/06/08 02:28:42 Done.
105 void OnUpgradeRecommended() override;
106
107 // policy::CloudPolicyStore::Observer 107 // policy::CloudPolicyStore::Observer
108 void OnStoreLoaded(policy::CloudPolicyStore* store) override; 108 void OnStoreLoaded(policy::CloudPolicyStore* store) override;
109 void OnStoreError(policy::CloudPolicyStore* store) override; 109 void OnStoreError(policy::CloudPolicyStore* store) override;
110 110
111 void UpdateEnterpriseDomain(); 111 void UpdateEnterpriseDomain();
112 112
113 // content::NotificationObserver:
114 void Observe(int type,
115 const content::NotificationSource& source,
116 const content::NotificationDetails& details) override;
117
118 // System tray mojo service in ash. 113 // System tray mojo service in ash.
119 ash::mojom::SystemTrayPtr system_tray_; 114 ash::mojom::SystemTrayPtr system_tray_;
120 115
121 // Binds this object to the client interface. 116 // Binds this object to the client interface.
122 mojo::Binding<ash::mojom::SystemTrayClient> binding_; 117 mojo::Binding<ash::mojom::SystemTrayClient> binding_;
123 118
124 // Whether an Adobe Flash component update is available. 119 // Whether an Adobe Flash component update is available.
125 bool flash_update_available_ = false; 120 bool flash_update_available_ = false;
126 121
127 // Avoid sending ash an empty enterprise domain at startup and suppress 122 // Avoid sending ash an empty enterprise domain at startup and suppress
128 // duplicate IPCs during the session. 123 // duplicate IPCs during the session.
129 std::string last_enterprise_domain_; 124 std::string last_enterprise_domain_;
130 bool last_active_directory_managed_ = false; 125 bool last_active_directory_managed_ = false;
131 126
132 content::NotificationRegistrar registrar_;
133
134 DISALLOW_COPY_AND_ASSIGN(SystemTrayClient); 127 DISALLOW_COPY_AND_ASSIGN(SystemTrayClient);
135 }; 128 };
136 129
137 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_CLIENT_H_ 130 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698