| 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 24 matching lines...) Expand all Loading... |
| 35 #include "ui/message_center/notifier_settings.h" | 35 #include "ui/message_center/notifier_settings.h" |
| 36 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
| 37 | 37 |
| 38 using message_center::Notification; | 38 using message_center::Notification; |
| 39 | 39 |
| 40 namespace chromeos { | 40 namespace chromeos { |
| 41 | 41 |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 bool IsPortalNotificationEnabled() { | 44 bool IsPortalNotificationEnabled() { |
| 45 return !CommandLine::ForCurrentProcess()->HasSwitch( | 45 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 46 switches::kDisableNetworkPortalNotification); | 46 switches::kDisableNetworkPortalNotification); |
| 47 } | 47 } |
| 48 | 48 |
| 49 | 49 |
| 50 void CloseNotification() { | 50 void CloseNotification() { |
| 51 message_center::MessageCenter::Get()->RemoveNotification( | 51 message_center::MessageCenter::Get()->RemoveNotification( |
| 52 NetworkPortalNotificationController::kNotificationId, false); | 52 NetworkPortalNotificationController::kNotificationId, false); |
| 53 } | 53 } |
| 54 | 54 |
| 55 class NetworkPortalNotificationControllerDelegate | 55 class NetworkPortalNotificationControllerDelegate |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 NetworkPortalNotificationController::USER_ACTION_METRIC_COUNT); | 94 NetworkPortalNotificationController::USER_ACTION_METRIC_COUNT); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void NetworkPortalNotificationControllerDelegate::Click() { | 97 void NetworkPortalNotificationControllerDelegate::Click() { |
| 98 clicked_ = true; | 98 clicked_ = true; |
| 99 UMA_HISTOGRAM_ENUMERATION( | 99 UMA_HISTOGRAM_ENUMERATION( |
| 100 NetworkPortalNotificationController::kUserActionMetric, | 100 NetworkPortalNotificationController::kUserActionMetric, |
| 101 NetworkPortalNotificationController::USER_ACTION_METRIC_CLICKED, | 101 NetworkPortalNotificationController::USER_ACTION_METRIC_CLICKED, |
| 102 NetworkPortalNotificationController::USER_ACTION_METRIC_COUNT); | 102 NetworkPortalNotificationController::USER_ACTION_METRIC_COUNT); |
| 103 | 103 |
| 104 if (CommandLine::ForCurrentProcess()->HasSwitch( | 104 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 105 chromeos::switches::kEnableCaptivePortalBypassProxy)) { | 105 chromeos::switches::kEnableCaptivePortalBypassProxy)) { |
| 106 if (controller_) | 106 if (controller_) |
| 107 controller_->ShowDialog(); | 107 controller_->ShowDialog(); |
| 108 } else { | 108 } else { |
| 109 Profile* profile = ProfileManager::GetActiveUserProfile(); | 109 Profile* profile = ProfileManager::GetActiveUserProfile(); |
| 110 if (!profile) | 110 if (!profile) |
| 111 return; | 111 return; |
| 112 chrome::ScopedTabbedBrowserDisplayer displayer( | 112 chrome::ScopedTabbedBrowserDisplayer displayer( |
| 113 profile, chrome::HOST_DESKTOP_TYPE_ASH); | 113 profile, chrome::HOST_DESKTOP_TYPE_ASH); |
| 114 GURL url(captive_portal::CaptivePortalDetector::kDefaultURL); | 114 GURL url(captive_portal::CaptivePortalDetector::kDefaultURL); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 void NetworkPortalNotificationController::OnDialogDestroyed( | 202 void NetworkPortalNotificationController::OnDialogDestroyed( |
| 203 const NetworkPortalWebDialog* dialog) { | 203 const NetworkPortalWebDialog* dialog) { |
| 204 if (dialog == dialog_) { | 204 if (dialog == dialog_) { |
| 205 dialog_ = nullptr; | 205 dialog_ = nullptr; |
| 206 ProfileHelper::Get()->ClearSigninProfile(base::Closure()); | 206 ProfileHelper::Get()->ClearSigninProfile(base::Closure()); |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 } // namespace chromeos | 210 } // namespace chromeos |
| OLD | NEW |