| OLD | NEW |
| 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 #include "chrome/browser/chromeos/policy/consumer_enrollment_handler.h" | 5 #include "chrome/browser/chromeos/policy/consumer_enrollment_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 class DesktopNotificationDelegate : public NotificationDelegate { | 69 class DesktopNotificationDelegate : public NotificationDelegate { |
| 70 public: | 70 public: |
| 71 // |button_click_callback| is called when the button in the notification is | 71 // |button_click_callback| is called when the button in the notification is |
| 72 // clicked. | 72 // clicked. |
| 73 DesktopNotificationDelegate(const std::string& id, | 73 DesktopNotificationDelegate(const std::string& id, |
| 74 const base::Closure& button_click_callback); | 74 const base::Closure& button_click_callback); |
| 75 | 75 |
| 76 // NotificationDelegate: | 76 // NotificationDelegate: |
| 77 virtual std::string id() const override; | 77 virtual std::string id() const override; |
| 78 virtual void Display() override; | |
| 79 virtual void ButtonClick(int button_index) override; | 78 virtual void ButtonClick(int button_index) override; |
| 80 virtual void Error() override; | |
| 81 virtual void Close(bool by_user) override; | |
| 82 virtual void Click() override; | |
| 83 | 79 |
| 84 private: | 80 private: |
| 85 virtual ~DesktopNotificationDelegate(); | 81 virtual ~DesktopNotificationDelegate(); |
| 86 | 82 |
| 87 std::string id_; | 83 std::string id_; |
| 88 base::Closure button_click_callback_; | 84 base::Closure button_click_callback_; |
| 89 | 85 |
| 90 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationDelegate); | 86 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationDelegate); |
| 91 }; | 87 }; |
| 92 | 88 |
| 93 DesktopNotificationDelegate::DesktopNotificationDelegate( | 89 DesktopNotificationDelegate::DesktopNotificationDelegate( |
| 94 const std::string& id, | 90 const std::string& id, |
| 95 const base::Closure& button_click_callback) | 91 const base::Closure& button_click_callback) |
| 96 : id_(id), button_click_callback_(button_click_callback) { | 92 : id_(id), button_click_callback_(button_click_callback) { |
| 97 } | 93 } |
| 98 | 94 |
| 99 DesktopNotificationDelegate::~DesktopNotificationDelegate() { | 95 DesktopNotificationDelegate::~DesktopNotificationDelegate() { |
| 100 } | 96 } |
| 101 | 97 |
| 102 std::string DesktopNotificationDelegate::id() const { | 98 std::string DesktopNotificationDelegate::id() const { |
| 103 return id_; | 99 return id_; |
| 104 } | 100 } |
| 105 | 101 |
| 106 void DesktopNotificationDelegate::Display() { | |
| 107 } | |
| 108 | |
| 109 void DesktopNotificationDelegate::ButtonClick(int button_index) { | 102 void DesktopNotificationDelegate::ButtonClick(int button_index) { |
| 110 button_click_callback_.Run(); | 103 button_click_callback_.Run(); |
| 111 } | 104 } |
| 112 | 105 |
| 113 void DesktopNotificationDelegate::Error() { | |
| 114 } | |
| 115 | |
| 116 void DesktopNotificationDelegate::Close(bool by_user) { | |
| 117 } | |
| 118 | |
| 119 void DesktopNotificationDelegate::Click() { | |
| 120 } | |
| 121 | |
| 122 } // namespace | 106 } // namespace |
| 123 | 107 |
| 124 namespace policy { | 108 namespace policy { |
| 125 | 109 |
| 126 ConsumerEnrollmentHandler::ConsumerEnrollmentHandler( | 110 ConsumerEnrollmentHandler::ConsumerEnrollmentHandler( |
| 127 ConsumerManagementService* consumer_management_service, | 111 ConsumerManagementService* consumer_management_service, |
| 128 DeviceManagementService* device_management_service) | 112 DeviceManagementService* device_management_service) |
| 129 : Consumer("consumer_enrollment_handler"), | 113 : Consumer("consumer_enrollment_handler"), |
| 130 consumer_management_service_(consumer_management_service), | 114 consumer_management_service_(consumer_management_service), |
| 131 device_management_service_(device_management_service), | 115 device_management_service_(device_management_service), |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 void ConsumerEnrollmentHandler::TryEnrollmentAgain(Profile* profile) const { | 342 void ConsumerEnrollmentHandler::TryEnrollmentAgain(Profile* profile) const { |
| 359 const GURL base_url(chrome::kChromeUISettingsURL); | 343 const GURL base_url(chrome::kChromeUISettingsURL); |
| 360 const GURL url = base_url.Resolve(kConsumerManagementOverlay); | 344 const GURL url = base_url.Resolve(kConsumerManagementOverlay); |
| 361 | 345 |
| 362 chrome::NavigateParams params(profile, url, ui::PAGE_TRANSITION_LINK); | 346 chrome::NavigateParams params(profile, url, ui::PAGE_TRANSITION_LINK); |
| 363 params.disposition = NEW_FOREGROUND_TAB; | 347 params.disposition = NEW_FOREGROUND_TAB; |
| 364 chrome::Navigate(¶ms); | 348 chrome::Navigate(¶ms); |
| 365 } | 349 } |
| 366 | 350 |
| 367 } // namespace policy | 351 } // namespace policy |
| OLD | NEW |