Chromium Code Reviews| 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/net/network_portal_notification_controller.h" | 5 #include "chrome/browser/chromeos/net/network_portal_notification_controller.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/system_notifier.h" | 8 #include "ash/system/system_notifier.h" |
| 9 #include "ash/system/tray/system_tray_notifier.h" | 9 #include "ash/system/tray/system_tray_notifier.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 NetworkPortalNotificationController::kNotificationId, false); | 48 NetworkPortalNotificationController::kNotificationId, false); |
| 49 } | 49 } |
| 50 | 50 |
| 51 class NetworkPortalNotificationControllerDelegate | 51 class NetworkPortalNotificationControllerDelegate |
| 52 : public message_center::NotificationDelegate { | 52 : public message_center::NotificationDelegate { |
| 53 public: | 53 public: |
| 54 NetworkPortalNotificationControllerDelegate(): clicked_(false) {} | 54 NetworkPortalNotificationControllerDelegate(): clicked_(false) {} |
| 55 | 55 |
| 56 // Overridden from message_center::NotificationDelegate: | 56 // Overridden from message_center::NotificationDelegate: |
| 57 virtual void Display() override; | 57 virtual void Display() override; |
| 58 virtual void Error() override; | |
| 59 virtual void Close(bool by_user) override; | 58 virtual void Close(bool by_user) override; |
| 60 virtual void Click() override; | 59 virtual void Click() override; |
| 61 | 60 |
| 62 private: | 61 private: |
| 63 virtual ~NetworkPortalNotificationControllerDelegate() {} | 62 virtual ~NetworkPortalNotificationControllerDelegate() {} |
| 64 | 63 |
| 65 bool clicked_; | 64 bool clicked_; |
| 66 | 65 |
| 67 DISALLOW_COPY_AND_ASSIGN(NetworkPortalNotificationControllerDelegate); | 66 DISALLOW_COPY_AND_ASSIGN(NetworkPortalNotificationControllerDelegate); |
| 68 }; | 67 }; |
| 69 | 68 |
| 70 void NetworkPortalNotificationControllerDelegate::Display() { | 69 void NetworkPortalNotificationControllerDelegate::Display() { |
| 71 UMA_HISTOGRAM_ENUMERATION( | 70 UMA_HISTOGRAM_ENUMERATION( |
| 72 NetworkPortalNotificationController::kNotificationMetric, | 71 NetworkPortalNotificationController::kNotificationMetric, |
| 73 NetworkPortalNotificationController::NOTIFICATION_METRIC_DISPLAYED, | 72 NetworkPortalNotificationController::NOTIFICATION_METRIC_DISPLAYED, |
| 74 NetworkPortalNotificationController::NOTIFICATION_METRIC_COUNT); | 73 NetworkPortalNotificationController::NOTIFICATION_METRIC_COUNT); |
| 75 } | 74 } |
| 76 | 75 |
| 77 void NetworkPortalNotificationControllerDelegate::Error() { | |
| 78 UMA_HISTOGRAM_ENUMERATION( | |
| 79 NetworkPortalNotificationController::kNotificationMetric, | |
| 80 NetworkPortalNotificationController::NOTIFICATION_METRIC_ERROR, | |
|
Lei Zhang
2014/10/29 22:19:25
NotificationMetric is useless with this removal. A
Peter Beverloo
2014/10/30 15:02:07
Done. I presume you mean NOTIFICATION_METRIC_ERROR
Lei Zhang
2014/10/30 19:18:46
Err, yes. :)
| |
| 81 NetworkPortalNotificationController::NOTIFICATION_METRIC_COUNT); | |
| 82 } | |
| 83 | |
| 84 void NetworkPortalNotificationControllerDelegate::Close(bool by_user) { | 76 void NetworkPortalNotificationControllerDelegate::Close(bool by_user) { |
| 85 if (clicked_) | 77 if (clicked_) |
| 86 return; | 78 return; |
| 87 NetworkPortalNotificationController::UserActionMetric metric = | 79 NetworkPortalNotificationController::UserActionMetric metric = |
| 88 by_user | 80 by_user |
| 89 ? NetworkPortalNotificationController::USER_ACTION_METRIC_CLOSED | 81 ? NetworkPortalNotificationController::USER_ACTION_METRIC_CLOSED |
| 90 : NetworkPortalNotificationController::USER_ACTION_METRIC_IGNORED; | 82 : NetworkPortalNotificationController::USER_ACTION_METRIC_IGNORED; |
| 91 UMA_HISTOGRAM_ENUMERATION( | 83 UMA_HISTOGRAM_ENUMERATION( |
| 92 NetworkPortalNotificationController::kUserActionMetric, | 84 NetworkPortalNotificationController::kUserActionMetric, |
| 93 metric, | 85 metric, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 if (ash::Shell::HasInstance()) { | 167 if (ash::Shell::HasInstance()) { |
| 176 ash::Shell::GetInstance() | 168 ash::Shell::GetInstance() |
| 177 ->system_tray_notifier() | 169 ->system_tray_notifier() |
| 178 ->NotifyOnCaptivePortalDetected(network->path()); | 170 ->NotifyOnCaptivePortalDetected(network->path()); |
| 179 } | 171 } |
| 180 | 172 |
| 181 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); | 173 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); |
| 182 } | 174 } |
| 183 | 175 |
| 184 } // namespace chromeos | 176 } // namespace chromeos |
| OLD | NEW |