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 d61afa4f55a612d8a2cdaadfb4f6530d936e04cf..d4f1e2ba73cf473b727336daa3a1c21555a5208e 100644 |
--- a/chrome/browser/chromeos/policy/consumer_management_service.h |
+++ b/chrome/browser/chromeos/policy/consumer_management_service.h |
@@ -12,11 +12,14 @@ |
#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" |
#include "google_apis/gaia/oauth2_token_service.h" |
+class NotificationUIManager; |
bartfab (slow)
2014/08/20 13:55:52
Nit: Not used.
davidyu
2014/08/21 04:08:25
Done.
|
class PrefRegistrySimple; |
class Profile; |
class ProfileOAuth2TokenService; |
@@ -25,6 +28,10 @@ namespace chromeos { |
class CryptohomeClient; |
} |
+namespace content { |
+class WebContents; |
bartfab (slow)
2014/08/20 13:55:51
Nit: This is unnecessary, because WebContents is u
davidyu
2014/08/21 04:08:25
Done.
davidyu
2014/08/21 04:08:26
Done.
|
+} |
+ |
namespace cryptohome { |
class BaseReply; |
} |
@@ -117,6 +124,37 @@ class ConsumerManagementService : public content::NotificationObserver, |
} |
private: |
+ class DesktopNotificationDelegate : public NotificationDelegate { |
+ public: |
+ // |display_callback| is called when the notification is displayed. |
bartfab (slow)
2014/08/20 13:55:52
There is no |display_callback|?
davidyu
2014/08/21 04:08:25
Done.
|
+ // |button_click_callback| is called when the button of notification |
bartfab (slow)
2014/08/20 13:55:51
Nit: s/of/in the/
davidyu
2014/08/21 04:08:25
Done.
|
+ // clicked. |
bartfab (slow)
2014/08/20 13:55:51
Nit: s/clicked/is clicked/
davidyu
2014/08/21 04:08:25
Done.
|
+ DesktopNotificationDelegate( |
+ const std::string& id, |
+ const base::Closure& button_click_callback); |
oshima
2014/08/20 13:24:01
virtual dtor
davidyu
2014/08/21 04:08:25
Done.
|
+ |
+ // NotificationDelegate implementation. |
oshima
2014/08/20 13:24:01
// NotificationDelegate:
is new style.
davidyu
2014/08/21 04:08:25
Done.
|
+ virtual std::string id() const OVERRIDE { |
bartfab (slow)
2014/08/20 13:55:51
Nit: The style guide forbids inlining virtual func
davidyu
2014/08/21 04:08:25
Done.
|
+ return id_; |
+ }; |
+ virtual content::WebContents* GetWebContents() const OVERRIDE { |
bartfab (slow)
2014/08/20 13:55:52
Nit: The style guide forbids inlining virtual func
davidyu
2014/08/21 04:08:25
Done.
|
+ return NULL; |
+ } |
+ |
+ // message_center::NotificationDelegate implementation. |
oshima
2014/08/20 13:24:01
is this dup?
bartfab (slow)
2014/08/20 13:55:51
Nit: That's the same NotificationDelegate as refer
davidyu
2014/08/21 04:08:25
Done.
|
+ virtual void Display() OVERRIDE {} |
bartfab (slow)
2014/08/20 13:55:51
Nit: The style guide forbids inlining virtual func
davidyu
2014/08/21 04:08:26
Done.
|
+ virtual void ButtonClick(int button_index) OVERRIDE; |
+ virtual void Error() OVERRIDE {} |
bartfab (slow)
2014/08/20 13:55:51
Nit: The style guide forbids inlining virtual func
davidyu
2014/08/21 04:08:26
Done.
|
+ virtual void Close(bool by_user) OVERRIDE {} |
bartfab (slow)
2014/08/20 13:55:52
Nit: The style guide forbids inlining virtual func
davidyu
2014/08/21 04:08:25
Done.
|
+ virtual void Click() OVERRIDE {} |
bartfab (slow)
2014/08/20 13:55:51
Nit: The style guide forbids inlining virtual func
davidyu
2014/08/21 04:08:25
Done.
|
+ |
+ private: |
+ std::string id_; |
+ base::Closure button_click_callback_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DesktopNotificationDelegate); |
+ }; |
+ |
void OnGetBootAttributeDone( |
const GetOwnerCallback& callback, |
chromeos::DBusMethodCallStatus call_status, |
@@ -155,11 +193,29 @@ 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); |
+ |
+ // Opens the settings page. |
+ void OpenSettingsPage(Profile* profile) const; |
+ |
+ // Opens the enrollment confirmation dialog in the settings page. |
+ void TryEnrollmentAgain(Profile* profile) const; |
+ |
+ // Shows a desktop notification with a button. |
+ void ShowDesktopNotification( |
+ Profile* profile, |
+ const std::string& id, |
+ const std::string& origin_url, |
+ const base::string16& title, |
+ const base::string16& body, |
+ const base::string16& button_label, |
+ const base::Closure& button_click_callback) const; |
chromeos::CryptohomeClient* client_; |
std::string enrolling_account_id_; |
bartfab (slow)
2014/08/20 13:55:51
Now that there is an |enrolling_profile_|, we can
davidyu
2014/08/21 04:08:25
Done.
|
+ Profile* enrolling_profile_; |
bartfab (slow)
2014/08/20 13:55:52
Now that there is an |enrolling_profile_|, we can
davidyu
2014/08/21 04:08:25
Done.
|
ProfileOAuth2TokenService* enrolling_token_service_; |
bool is_observing_token_service_; |