| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/ash/system_tray_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 57 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 58 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 58 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 59 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 59 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 60 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" | 60 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" |
| 61 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 61 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 62 #include "chrome/browser/chromeos/settings/cros_settings.h" | 62 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 63 #include "chrome/browser/lifetime/application_lifetime.h" | 63 #include "chrome/browser/lifetime/application_lifetime.h" |
| 64 #include "chrome/browser/profiles/profile_manager.h" | 64 #include "chrome/browser/profiles/profile_manager.h" |
| 65 #include "chrome/browser/supervised_user/supervised_user_service.h" | 65 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 66 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 66 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 67 #include "chrome/browser/ui/ash/cast_config_delegate_chromeos.h" | |
| 68 #include "chrome/browser/ui/ash/cast_config_delegate_media_router.h" | 67 #include "chrome/browser/ui/ash/cast_config_delegate_media_router.h" |
| 69 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 68 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 70 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" | 69 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" |
| 71 #include "chrome/browser/ui/ash/system_tray_client.h" | 70 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 72 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" | 71 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" |
| 73 #include "chrome/browser/ui/ash/vpn_delegate_chromeos.h" | 72 #include "chrome/browser/ui/ash/vpn_delegate_chromeos.h" |
| 74 #include "chrome/browser/ui/browser.h" | 73 #include "chrome/browser/ui/browser.h" |
| 75 #include "chrome/browser/ui/browser_list.h" | 74 #include "chrome/browser/ui/browser_list.h" |
| 76 #include "chrome/browser/ui/chrome_pages.h" | 75 #include "chrome/browser/ui/chrome_pages.h" |
| 77 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 76 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 93 #include "components/user_manager/user.h" | 92 #include "components/user_manager/user.h" |
| 94 #include "components/user_manager/user_manager.h" | 93 #include "components/user_manager/user_manager.h" |
| 95 #include "components/user_manager/user_type.h" | 94 #include "components/user_manager/user_type.h" |
| 96 #include "content/public/browser/notification_observer.h" | 95 #include "content/public/browser/notification_observer.h" |
| 97 #include "content/public/browser/notification_service.h" | 96 #include "content/public/browser/notification_service.h" |
| 98 #include "content/public/browser/user_metrics.h" | 97 #include "content/public/browser/user_metrics.h" |
| 99 #include "device/bluetooth/bluetooth_adapter.h" | 98 #include "device/bluetooth/bluetooth_adapter.h" |
| 100 #include "device/bluetooth/bluetooth_adapter_factory.h" | 99 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 101 #include "device/bluetooth/bluetooth_device.h" | 100 #include "device/bluetooth/bluetooth_device.h" |
| 102 #include "ui/base/ime/chromeos/extension_ime_util.h" | 101 #include "ui/base/ime/chromeos/extension_ime_util.h" |
| 103 #include "ui/base/ime/chromeos/ime_keyboard.h" | |
| 104 #include "ui/base/ime/chromeos/input_method_manager.h" | 102 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 105 #include "ui/base/l10n/l10n_util.h" | 103 #include "ui/base/l10n/l10n_util.h" |
| 106 #include "ui/base/l10n/time_format.h" | 104 #include "ui/base/l10n/time_format.h" |
| 107 #include "ui/chromeos/ime/input_method_menu_item.h" | 105 #include "ui/chromeos/ime/input_method_menu_item.h" |
| 108 #include "ui/chromeos/ime/input_method_menu_manager.h" | 106 #include "ui/chromeos/ime/input_method_menu_manager.h" |
| 109 | 107 |
| 110 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 108 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 111 #include "chrome/browser/supervised_user/supervised_user_service.h" | 109 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 112 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 110 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 113 #endif | 111 #endif |
| (...skipping 19 matching lines...) Expand all Loading... |
| 133 } | 131 } |
| 134 | 132 |
| 135 void BluetoothSetDiscoveringError() { | 133 void BluetoothSetDiscoveringError() { |
| 136 LOG(ERROR) << "BluetoothSetDiscovering failed."; | 134 LOG(ERROR) << "BluetoothSetDiscovering failed."; |
| 137 } | 135 } |
| 138 | 136 |
| 139 void BluetoothDeviceConnectError( | 137 void BluetoothDeviceConnectError( |
| 140 device::BluetoothDevice::ConnectErrorCode error_code) { | 138 device::BluetoothDevice::ConnectErrorCode error_code) { |
| 141 } | 139 } |
| 142 | 140 |
| 143 std::unique_ptr<ash::CastConfigDelegate> CreateCastConfigDelegate() { | |
| 144 if (CastConfigDelegateMediaRouter::IsEnabled()) | |
| 145 return base::MakeUnique<CastConfigDelegateMediaRouter>(); | |
| 146 return base::MakeUnique<CastConfigDelegateChromeos>(); | |
| 147 } | |
| 148 | |
| 149 void OnAcceptMultiprofilesIntro(bool no_show_again) { | 141 void OnAcceptMultiprofilesIntro(bool no_show_again) { |
| 150 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); | 142 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); |
| 151 prefs->SetBoolean(prefs::kMultiProfileNeverShowIntro, no_show_again); | 143 prefs->SetBoolean(prefs::kMultiProfileNeverShowIntro, no_show_again); |
| 152 UserAddingScreen::Get()->Start(); | 144 UserAddingScreen::Get()->Start(); |
| 153 } | 145 } |
| 154 | 146 |
| 155 } // namespace | 147 } // namespace |
| 156 | 148 |
| 157 SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() | 149 SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() |
| 158 : user_profile_(NULL), | 150 : cast_config_delegate_(base::MakeUnique<CastConfigDelegateMediaRouter>()), |
| 159 search_key_mapped_to_(input_method::kSearchKey), | |
| 160 have_session_start_time_(false), | |
| 161 have_session_length_limit_(false), | |
| 162 should_run_bluetooth_discovery_(false), | |
| 163 session_started_(false), | |
| 164 cast_config_delegate_(nullptr), | |
| 165 networking_config_delegate_(new NetworkingConfigDelegateChromeos()), | 151 networking_config_delegate_(new NetworkingConfigDelegateChromeos()), |
| 166 vpn_delegate_(new VPNDelegateChromeOS), | 152 vpn_delegate_(new VPNDelegateChromeOS), |
| 167 weak_ptr_factory_(this) { | 153 weak_ptr_factory_(this) { |
| 168 // Register notifications on construction so that events such as | 154 // Register notifications on construction so that events such as |
| 169 // PROFILE_CREATED do not get missed if they happen before Initialize(). | 155 // PROFILE_CREATED do not get missed if they happen before Initialize(). |
| 170 registrar_.reset(new content::NotificationRegistrar); | 156 registrar_.reset(new content::NotificationRegistrar); |
| 171 registrar_->Add(this, | 157 registrar_->Add(this, |
| 172 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 158 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
| 173 content::NotificationService::AllSources()); | 159 content::NotificationService::AllSources()); |
| 174 registrar_->Add(this, | 160 registrar_->Add(this, |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 bool SystemTrayDelegateChromeOS::GetBluetoothEnabled() { | 546 bool SystemTrayDelegateChromeOS::GetBluetoothEnabled() { |
| 561 return bluetooth_adapter_ && bluetooth_adapter_->IsPowered(); | 547 return bluetooth_adapter_ && bluetooth_adapter_->IsPowered(); |
| 562 } | 548 } |
| 563 | 549 |
| 564 bool SystemTrayDelegateChromeOS::GetBluetoothDiscovering() { | 550 bool SystemTrayDelegateChromeOS::GetBluetoothDiscovering() { |
| 565 return bluetooth_discovery_session_ && | 551 return bluetooth_discovery_session_ && |
| 566 bluetooth_discovery_session_->IsActive(); | 552 bluetooth_discovery_session_->IsActive(); |
| 567 } | 553 } |
| 568 | 554 |
| 569 ash::CastConfigDelegate* SystemTrayDelegateChromeOS::GetCastConfigDelegate() { | 555 ash::CastConfigDelegate* SystemTrayDelegateChromeOS::GetCastConfigDelegate() { |
| 570 if (!cast_config_delegate_) | |
| 571 cast_config_delegate_ = CreateCastConfigDelegate(); | |
| 572 return cast_config_delegate_.get(); | 556 return cast_config_delegate_.get(); |
| 573 } | 557 } |
| 574 | 558 |
| 575 ash::NetworkingConfigDelegate* | 559 ash::NetworkingConfigDelegate* |
| 576 SystemTrayDelegateChromeOS::GetNetworkingConfigDelegate() const { | 560 SystemTrayDelegateChromeOS::GetNetworkingConfigDelegate() const { |
| 577 return networking_config_delegate_.get(); | 561 return networking_config_delegate_.get(); |
| 578 } | 562 } |
| 579 | 563 |
| 580 bool SystemTrayDelegateChromeOS::GetSessionStartTime( | 564 bool SystemTrayDelegateChromeOS::GetSessionStartTime( |
| 581 base::TimeTicks* session_start_time) { | 565 base::TimeTicks* session_start_time) { |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1061 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 1078 << "ENABLE_SUPERVISED_USERS undefined."; | 1062 << "ENABLE_SUPERVISED_USERS undefined."; |
| 1079 return base::string16(); | 1063 return base::string16(); |
| 1080 } | 1064 } |
| 1081 | 1065 |
| 1082 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1066 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1083 return new SystemTrayDelegateChromeOS(); | 1067 return new SystemTrayDelegateChromeOS(); |
| 1084 } | 1068 } |
| 1085 | 1069 |
| 1086 } // namespace chromeos | 1070 } // namespace chromeos |
| OLD | NEW |