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

Unified Diff: chrome/browser/chromeos/policy/consumer_management_service.h

Issue 468873002: Show a desktop notification when the enrollment is completed or failed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/policy/consumer_management_service.h
diff --git a/chrome/browser/chromeos/policy/consumer_management_service.h b/chrome/browser/chromeos/policy/consumer_management_service.h
index d1cb6998398c4b90e3bdddd2abae2cc624c0bcc9..a647429c300e82360299b743189b41c2aaa8d905 100644
--- a/chrome/browser/chromeos/policy/consumer_management_service.h
+++ b/chrome/browser/chromeos/policy/consumer_management_service.h
@@ -12,6 +12,8 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/strings/string16.h"
+#include "chrome/browser/notifications/notification_delegate.h"
#include "chromeos/dbus/dbus_method_call_status.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -117,6 +119,32 @@ class ConsumerManagementService : public content::NotificationObserver,
}
private:
+ class DesktopNotificationDelegate : public NotificationDelegate {
oshima 2014/08/21 22:47:07 Looks like you're not using this in the header. In
bartfab (slow) 2014/08/21 23:35:45 I have seen inlining of virtual methods done in .c
oshima 2014/08/22 00:44:05 http://www.chromium.org/developers/coding-style/cp
davidyu 2014/08/22 04:23:10 Moved to .cc.
bartfab (slow) 2014/08/25 13:07:30 In addition to the Dos and Don'ts you linked to, t
oshima 2014/08/25 13:42:04 That line describe the rule for accessor method. T
+ public:
+ // |button_click_callback| is called when the button in the notification is
+ // clicked.
+ DesktopNotificationDelegate(
+ const std::string& id,
+ const base::Closure& button_click_callback);
+
+ virtual ~DesktopNotificationDelegate();
+
+ // NotificationDelegate:
+ virtual std::string id() const OVERRIDE;
+ virtual content::WebContents* GetWebContents() const OVERRIDE;
+ virtual void Display() OVERRIDE;
+ virtual void ButtonClick(int button_index) OVERRIDE;
+ virtual void Error() OVERRIDE;
+ virtual void Close(bool by_user) OVERRIDE;
+ virtual void Click() OVERRIDE;
+
+ private:
+ std::string id_;
+ base::Closure button_click_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(DesktopNotificationDelegate);
+ };
+
void OnGetBootAttributeDone(
const GetOwnerCallback& callback,
chromeos::DBusMethodCallStatus call_status,
@@ -155,13 +183,21 @@ class ConsumerManagementService : public content::NotificationObserver,
void EndEnrollment(ConsumerEnrollmentState state);
// Shows a desktop notification and resets the enrollment state.
- void ShowDesktopNotificationAndResetState(ConsumerEnrollmentState state);
+ void ShowDesktopNotificationAndResetState(ConsumerEnrollmentState state,
+ Profile* profile);
- chromeos::CryptohomeClient* client_;
+ // Opens the settings page.
+ void OpenSettingsPage(Profile* profile) const;
- std::string enrolling_account_id_;
- ProfileOAuth2TokenService* enrolling_token_service_;
+ // Opens the enrollment confirmation dialog in the settings page.
+ void TryEnrollmentAgain(Profile* profile) const;
+
+ // Returns the sign-in authenticated account ID of the profile.
+ const std::string& GetAccountIdFromProfile(Profile* profile) const;
bartfab (slow) 2014/08/21 12:04:25 Nit 1: "sign-in authenticated account ID" is reall
davidyu 2014/08/22 04:23:10 Done.
+
+ chromeos::CryptohomeClient* client_;
+ Profile* enrolling_profile_;
scoped_ptr<OAuth2TokenService::Request> token_request_;
content::NotificationRegistrar registrar_;
base::WeakPtrFactory<ConsumerManagementService> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698