| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/system/system_notifier.h" | 10 #include "ash/system/system_notifier.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 bool is_wifi = NetworkTypePattern::WiFi().MatchesType(network->type()); | 330 bool is_wifi = NetworkTypePattern::WiFi().MatchesType(network->type()); |
| 331 scoped_ptr<Notification> notification(new Notification( | 331 scoped_ptr<Notification> notification(new Notification( |
| 332 message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, | 332 message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, |
| 333 l10n_util::GetStringUTF16( | 333 l10n_util::GetStringUTF16( |
| 334 is_wifi ? IDS_PORTAL_DETECTION_NOTIFICATION_TITLE_WIFI | 334 is_wifi ? IDS_PORTAL_DETECTION_NOTIFICATION_TITLE_WIFI |
| 335 : IDS_PORTAL_DETECTION_NOTIFICATION_TITLE_WIRED), | 335 : IDS_PORTAL_DETECTION_NOTIFICATION_TITLE_WIRED), |
| 336 l10n_util::GetStringFUTF16( | 336 l10n_util::GetStringFUTF16( |
| 337 is_wifi ? IDS_PORTAL_DETECTION_NOTIFICATION_MESSAGE_WIFI | 337 is_wifi ? IDS_PORTAL_DETECTION_NOTIFICATION_MESSAGE_WIFI |
| 338 : IDS_PORTAL_DETECTION_NOTIFICATION_MESSAGE_WIRED, | 338 : IDS_PORTAL_DETECTION_NOTIFICATION_MESSAGE_WIRED, |
| 339 base::UTF8ToUTF16(network->name())), | 339 base::UTF8ToUTF16(network->name())), |
| 340 icon, base::string16(), notifier_id, data, delegate.get())); | 340 icon, base::string16(), GURL(), notifier_id, data, delegate.get())); |
| 341 notification->SetSystemPriority(); | 341 notification->SetSystemPriority(); |
| 342 return notification.Pass(); | 342 return notification.Pass(); |
| 343 } | 343 } |
| 344 | 344 |
| 345 scoped_ptr<message_center::Notification> NetworkPortalNotificationController:: | 345 scoped_ptr<message_center::Notification> NetworkPortalNotificationController:: |
| 346 CreateCaptivePortalNotificationForExtension( | 346 CreateCaptivePortalNotificationForExtension( |
| 347 const NetworkState* network, | 347 const NetworkState* network, |
| 348 extensions::NetworkingConfigService* networking_config_service, | 348 extensions::NetworkingConfigService* networking_config_service, |
| 349 const extensions::Extension* extension) { | 349 const extensions::Extension* extension) { |
| 350 message_center::RichNotificationData data; | 350 message_center::RichNotificationData data; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 379 data.buttons.push_back( | 379 data.buttons.push_back( |
| 380 message_center::ButtonInfo(l10n_util::GetStringFUTF16( | 380 message_center::ButtonInfo(l10n_util::GetStringFUTF16( |
| 381 IDS_PORTAL_DETECTION_NOTIFICATION_BUTTON_EXTENSION_RETRY, | 381 IDS_PORTAL_DETECTION_NOTIFICATION_BUTTON_EXTENSION_RETRY, |
| 382 base::UTF8ToUTF16(extension->name())))); | 382 base::UTF8ToUTF16(extension->name())))); |
| 383 data.buttons.push_back(message_center::ButtonInfo(l10n_util::GetStringUTF16( | 383 data.buttons.push_back(message_center::ButtonInfo(l10n_util::GetStringUTF16( |
| 384 IDS_PORTAL_DETECTION_NOTIFICATION_BUTTON_PORTAL))); | 384 IDS_PORTAL_DETECTION_NOTIFICATION_BUTTON_PORTAL))); |
| 385 } | 385 } |
| 386 scoped_ptr<Notification> notification(new Notification( | 386 scoped_ptr<Notification> notification(new Notification( |
| 387 message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, | 387 message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, |
| 388 l10n_util::GetStringUTF16(IDS_PORTAL_DETECTION_NOTIFICATION_TITLE_WIFI), | 388 l10n_util::GetStringUTF16(IDS_PORTAL_DETECTION_NOTIFICATION_TITLE_WIFI), |
| 389 notificationText, icon, base::string16() /* display_source */, | 389 notificationText, icon, base::string16() /* display_source */, GURL(), |
| 390 notifier_id, data, delegate.get())); | 390 notifier_id, data, delegate.get())); |
| 391 notification->SetSystemPriority(); | 391 notification->SetSystemPriority(); |
| 392 return notification.Pass(); | 392 return notification.Pass(); |
| 393 } | 393 } |
| 394 | 394 |
| 395 scoped_ptr<Notification> NetworkPortalNotificationController::GetNotification( | 395 scoped_ptr<Notification> NetworkPortalNotificationController::GetNotification( |
| 396 const NetworkState* network, | 396 const NetworkState* network, |
| 397 const NetworkPortalDetector::CaptivePortalState& state) { | 397 const NetworkPortalDetector::CaptivePortalState& state) { |
| 398 base::string16 notificationText; | 398 base::string16 notificationText; |
| 399 Profile* profile = GetProfileForPrimaryUser(); | 399 Profile* profile = GetProfileForPrimaryUser(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 426 if (dialog_) | 426 if (dialog_) |
| 427 dialog_->Close(); | 427 dialog_->Close(); |
| 428 } | 428 } |
| 429 | 429 |
| 430 const NetworkPortalWebDialog* | 430 const NetworkPortalWebDialog* |
| 431 NetworkPortalNotificationController::GetDialogForTesting() const { | 431 NetworkPortalNotificationController::GetDialogForTesting() const { |
| 432 return dialog_; | 432 return dialog_; |
| 433 } | 433 } |
| 434 | 434 |
| 435 } // namespace chromeos | 435 } // namespace chromeos |
| OLD | NEW |