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

Side by Side Diff: chrome/browser/chromeos/net/network_portal_notification_controller.cc

Issue 687183004: Remove the OnError method from notification delegates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 #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
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,
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698