| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 | 87 |
| 88 const extensions::Extension* LookupExtensionForRawSsid( | 88 const extensions::Extension* LookupExtensionForRawSsid( |
| 89 extensions::NetworkingConfigService* networking_config_service, | 89 extensions::NetworkingConfigService* networking_config_service, |
| 90 const std::vector<uint8_t>& raw_ssid) { | 90 const std::vector<uint8_t>& raw_ssid) { |
| 91 DCHECK(networking_config_service); | 91 DCHECK(networking_config_service); |
| 92 Profile* profile = GetProfileForPrimaryUser(); | 92 Profile* profile = GetProfileForPrimaryUser(); |
| 93 if (!profile || !networking_config_service) | 93 if (!profile || !networking_config_service) |
| 94 return nullptr; | 94 return nullptr; |
| 95 std::string extension_id; | 95 std::string extension_id; |
| 96 std::string hex_ssid = | 96 std::string hex_ssid = base::HexEncode(raw_ssid.data(), raw_ssid.size()); |
| 97 base::HexEncode(vector_as_array(&raw_ssid), raw_ssid.size()); | |
| 98 extension_id = | 97 extension_id = |
| 99 networking_config_service->LookupExtensionIdForHexSsid(hex_ssid); | 98 networking_config_service->LookupExtensionIdForHexSsid(hex_ssid); |
| 100 if (extension_id.empty()) | 99 if (extension_id.empty()) |
| 101 return nullptr; | 100 return nullptr; |
| 102 return extensions::ExtensionRegistry::Get(profile) | 101 return extensions::ExtensionRegistry::Get(profile) |
| 103 ->GetExtensionById(extension_id, extensions::ExtensionRegistry::ENABLED); | 102 ->GetExtensionById(extension_id, extensions::ExtensionRegistry::ENABLED); |
| 104 } | 103 } |
| 105 | 104 |
| 106 class NetworkPortalNotificationControllerDelegate | 105 class NetworkPortalNotificationControllerDelegate |
| 107 : public message_center::NotificationDelegate { | 106 : public message_center::NotificationDelegate { |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 if (dialog_) | 439 if (dialog_) |
| 441 dialog_->Close(); | 440 dialog_->Close(); |
| 442 } | 441 } |
| 443 | 442 |
| 444 const NetworkPortalWebDialog* | 443 const NetworkPortalWebDialog* |
| 445 NetworkPortalNotificationController::GetDialogForTesting() const { | 444 NetworkPortalNotificationController::GetDialogForTesting() const { |
| 446 return dialog_; | 445 return dialog_; |
| 447 } | 446 } |
| 448 | 447 |
| 449 } // namespace chromeos | 448 } // namespace chromeos |
| OLD | NEW |