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

Side by Side Diff: chrome/browser/chromeos/policy/consumer_management_notifier.h

Issue 751703003: Implemented consumer management unenrollment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dcpm
Patch Set: Rebase. Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_CHROMEOS_POLICY_CONSUMER_MANAGEMENT_NOTIFIER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_MANAGEMENT_NOTIFIER_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_MANAGEMENT_NOTIFIER_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_MANAGEMENT_NOTIFIER_H_
7 7
8 #include <string>
9
10 #include "base/callback_forward.h"
8 #include "base/macros.h" 11 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/chromeos/policy/consumer_management_service.h" 13 #include "chrome/browser/chromeos/policy/consumer_management_service.h"
11 #include "components/keyed_service/core/keyed_service.h" 14 #include "components/keyed_service/core/keyed_service.h"
12 15
13 class Profile; 16 class Profile;
14 17
15 namespace policy { 18 namespace policy {
16 19
17 class ConsumerManagementStage; 20 class ConsumerManagementStage;
18 21
19 // ConsumerManagementNotifier observes ConsumerManagementService and shows 22 // ConsumerManagementNotifier observes ConsumerManagementService and shows
20 // a desktop notification to the device owner if consumer enrollment or 23 // a desktop notification to the device owner if consumer enrollment or
21 // unenrollment suceeds or fails. 24 // unenrollment suceeds or fails.
22 class ConsumerManagementNotifier 25 class ConsumerManagementNotifier
23 : public KeyedService, 26 : public KeyedService,
24 public ConsumerManagementService::Observer { 27 public ConsumerManagementService::Observer {
25 public: 28 public:
26 ConsumerManagementNotifier( 29 ConsumerManagementNotifier(
27 Profile* profile, 30 Profile* profile,
28 ConsumerManagementService* consumer_management_service); 31 ConsumerManagementService* consumer_management_service);
29 ~ConsumerManagementNotifier() override; 32 ~ConsumerManagementNotifier() override;
30 33
31 void Shutdown() override; 34 void Shutdown() override;
32 35
33 // ConsumerManagementService::Observer: 36 // ConsumerManagementService::Observer:
34 void OnConsumerManagementStatusChanged() override; 37 void OnConsumerManagementStatusChanged() override;
35 38
36 private: 39 private:
40 // Shows a notification based on |stage|.
41 void ShowNotification(const ConsumerManagementStage& stage);
42
37 // Shows a desktop notification. 43 // Shows a desktop notification.
38 void ShowDesktopNotification(const ConsumerManagementStage& stage); 44 void ShowDesktopNotification(
45 const std::string& notification_id,
46 const std::string& notification_url,
47 int title_message_id,
48 int body_message_id,
49 int button_label_message_id,
50 const base::Closure& button_click_callback);
39 51
40 // Opens the settings page. 52 // Opens the settings page.
41 void OpenSettingsPage() const; 53 void OpenSettingsPage() const;
42 54
43 // Opens the enrollment confirmation dialog in the settings page. 55 // Opens the enrollment/unenrollment confirmation dialog in the settings page.
44 void TryEnrollmentAgain() const; 56 void TryAgain() const;
45 57
46 Profile* profile_; 58 Profile* profile_;
47 ConsumerManagementService* consumer_management_service_; 59 ConsumerManagementService* consumer_management_service_;
48 60
49 base::WeakPtrFactory<ConsumerManagementNotifier> weak_ptr_factory_; 61 base::WeakPtrFactory<ConsumerManagementNotifier> weak_ptr_factory_;
50 62
51 DISALLOW_COPY_AND_ASSIGN(ConsumerManagementNotifier); 63 DISALLOW_COPY_AND_ASSIGN(ConsumerManagementNotifier);
52 }; 64 };
53 65
54 } // namespace policy 66 } // namespace policy
55 67
56 #endif // CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_MANAGEMENT_NOTIFIER_H_ 68 #endif // CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_MANAGEMENT_NOTIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698