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 #include <algorithm> | 9 #include <algorithm> |
9 #include <set> | 10 #include <set> |
10 #include <string> | 11 #include <string> |
11 #include <utility> | 12 #include <utility> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "ash/ash_switches.h" | 15 #include "ash/ash_switches.h" |
15 #include "ash/desktop_background/desktop_background_controller.h" | 16 #include "ash/desktop_background/desktop_background_controller.h" |
16 #include "ash/metrics/user_metrics_recorder.h" | 17 #include "ash/metrics/user_metrics_recorder.h" |
17 #include "ash/session/session_state_delegate.h" | 18 #include "ash/session/session_state_delegate.h" |
(...skipping 12 matching lines...) Expand all Loading... |
30 #include "ash/system/tray/system_tray_notifier.h" | 31 #include "ash/system/tray/system_tray_notifier.h" |
31 #include "ash/system/tray_accessibility.h" | 32 #include "ash/system/tray_accessibility.h" |
32 #include "ash/system/user/login_status.h" | 33 #include "ash/system/user/login_status.h" |
33 #include "ash/system/user/update_observer.h" | 34 #include "ash/system/user/update_observer.h" |
34 #include "ash/system/user/user_observer.h" | 35 #include "ash/system/user/user_observer.h" |
35 #include "ash/volume_control_delegate.h" | 36 #include "ash/volume_control_delegate.h" |
36 #include "ash/wm/lock_state_controller.h" | 37 #include "ash/wm/lock_state_controller.h" |
37 #include "base/bind_helpers.h" | 38 #include "base/bind_helpers.h" |
38 #include "base/callback.h" | 39 #include "base/callback.h" |
39 #include "base/logging.h" | 40 #include "base/logging.h" |
| 41 #include "base/memory/ptr_util.h" |
40 #include "base/memory/weak_ptr.h" | 42 #include "base/memory/weak_ptr.h" |
41 #include "base/strings/stringprintf.h" | 43 #include "base/strings/stringprintf.h" |
42 #include "base/strings/utf_string_conversions.h" | 44 #include "base/strings/utf_string_conversions.h" |
43 #include "base/sys_info.h" | 45 #include "base/sys_info.h" |
44 #include "base/time/time.h" | 46 #include "base/time/time.h" |
45 #include "chrome/browser/browser_process.h" | 47 #include "chrome/browser/browser_process.h" |
46 #include "chrome/browser/chrome_notification_types.h" | 48 #include "chrome/browser/chrome_notification_types.h" |
47 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 49 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
48 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 50 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
49 #include "chrome/browser/chromeos/bluetooth/bluetooth_pairing_dialog.h" | 51 #include "chrome/browser/chromeos/bluetooth/bluetooth_pairing_dialog.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 162 } |
161 | 163 |
162 void BluetoothSetDiscoveringError() { | 164 void BluetoothSetDiscoveringError() { |
163 LOG(ERROR) << "BluetoothSetDiscovering failed."; | 165 LOG(ERROR) << "BluetoothSetDiscovering failed."; |
164 } | 166 } |
165 | 167 |
166 void BluetoothDeviceConnectError( | 168 void BluetoothDeviceConnectError( |
167 device::BluetoothDevice::ConnectErrorCode error_code) { | 169 device::BluetoothDevice::ConnectErrorCode error_code) { |
168 } | 170 } |
169 | 171 |
170 scoped_ptr<ash::CastConfigDelegate> CreateCastConfigDelegate() { | 172 std::unique_ptr<ash::CastConfigDelegate> CreateCastConfigDelegate() { |
171 if (CastConfigDelegateMediaRouter::IsEnabled()) | 173 if (CastConfigDelegateMediaRouter::IsEnabled()) |
172 return make_scoped_ptr(new CastConfigDelegateMediaRouter()); | 174 return base::WrapUnique(new CastConfigDelegateMediaRouter()); |
173 return make_scoped_ptr(new CastConfigDelegateChromeos()); | 175 return base::WrapUnique(new CastConfigDelegateChromeos()); |
174 } | 176 } |
175 | 177 |
176 void ShowSettingsSubPageForActiveUser(const std::string& sub_page) { | 178 void ShowSettingsSubPageForActiveUser(const std::string& sub_page) { |
177 chrome::ShowSettingsSubPageForProfile( | 179 chrome::ShowSettingsSubPageForProfile( |
178 ProfileManager::GetActiveUserProfile(), sub_page); | 180 ProfileManager::GetActiveUserProfile(), sub_page); |
179 } | 181 } |
180 | 182 |
181 void OnAcceptMultiprofilesIntro(bool no_show_again) { | 183 void OnAcceptMultiprofilesIntro(bool no_show_again) { |
182 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); | 184 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); |
183 prefs->SetBoolean(prefs::kMultiProfileNeverShowIntro, no_show_again); | 185 prefs->SetBoolean(prefs::kMultiProfileNeverShowIntro, no_show_again); |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 input_method::InputMethodDescriptor ime = | 694 input_method::InputMethodDescriptor ime = |
693 manager->GetActiveIMEState()->GetCurrentInputMethod(); | 695 manager->GetActiveIMEState()->GetCurrentInputMethod(); |
694 ExtractIMEInfo(ime, *util, info); | 696 ExtractIMEInfo(ime, *util, info); |
695 info->selected = true; | 697 info->selected = true; |
696 } | 698 } |
697 | 699 |
698 void SystemTrayDelegateChromeOS::GetAvailableIMEList(ash::IMEInfoList* list) { | 700 void SystemTrayDelegateChromeOS::GetAvailableIMEList(ash::IMEInfoList* list) { |
699 input_method::InputMethodManager* manager = | 701 input_method::InputMethodManager* manager = |
700 input_method::InputMethodManager::Get(); | 702 input_method::InputMethodManager::Get(); |
701 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); | 703 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); |
702 scoped_ptr<input_method::InputMethodDescriptors> ime_descriptors( | 704 std::unique_ptr<input_method::InputMethodDescriptors> ime_descriptors( |
703 manager->GetActiveIMEState()->GetActiveInputMethods()); | 705 manager->GetActiveIMEState()->GetActiveInputMethods()); |
704 std::string current = | 706 std::string current = |
705 manager->GetActiveIMEState()->GetCurrentInputMethod().id(); | 707 manager->GetActiveIMEState()->GetCurrentInputMethod().id(); |
706 for (size_t i = 0; i < ime_descriptors->size(); i++) { | 708 for (size_t i = 0; i < ime_descriptors->size(); i++) { |
707 input_method::InputMethodDescriptor& ime = ime_descriptors->at(i); | 709 input_method::InputMethodDescriptor& ime = ime_descriptors->at(i); |
708 ash::IMEInfo info; | 710 ash::IMEInfo info; |
709 ExtractIMEInfo(ime, *util, &info); | 711 ExtractIMEInfo(ime, *util, &info); |
710 info.selected = ime.id() == current; | 712 info.selected = ime.id() == current; |
711 list->push_back(info); | 713 list->push_back(info); |
712 } | 714 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 SystemTrayDelegateChromeOS::GetNetworkingConfigDelegate() const { | 791 SystemTrayDelegateChromeOS::GetNetworkingConfigDelegate() const { |
790 return networking_config_delegate_.get(); | 792 return networking_config_delegate_.get(); |
791 } | 793 } |
792 | 794 |
793 ash::VolumeControlDelegate* | 795 ash::VolumeControlDelegate* |
794 SystemTrayDelegateChromeOS::GetVolumeControlDelegate() const { | 796 SystemTrayDelegateChromeOS::GetVolumeControlDelegate() const { |
795 return volume_control_delegate_.get(); | 797 return volume_control_delegate_.get(); |
796 } | 798 } |
797 | 799 |
798 void SystemTrayDelegateChromeOS::SetVolumeControlDelegate( | 800 void SystemTrayDelegateChromeOS::SetVolumeControlDelegate( |
799 scoped_ptr<ash::VolumeControlDelegate> delegate) { | 801 std::unique_ptr<ash::VolumeControlDelegate> delegate) { |
800 volume_control_delegate_.swap(delegate); | 802 volume_control_delegate_.swap(delegate); |
801 } | 803 } |
802 | 804 |
803 bool SystemTrayDelegateChromeOS::GetSessionStartTime( | 805 bool SystemTrayDelegateChromeOS::GetSessionStartTime( |
804 base::TimeTicks* session_start_time) { | 806 base::TimeTicks* session_start_time) { |
805 *session_start_time = session_start_time_; | 807 *session_start_time = session_start_time_; |
806 return have_session_start_time_; | 808 return have_session_start_time_; |
807 } | 809 } |
808 | 810 |
809 bool SystemTrayDelegateChromeOS::GetSessionLengthLimit( | 811 bool SystemTrayDelegateChromeOS::GetSessionLengthLimit( |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 GetSystemTrayNotifier()->NotifyRefreshBluetooth(); | 1208 GetSystemTrayNotifier()->NotifyRefreshBluetooth(); |
1207 } | 1209 } |
1208 | 1210 |
1209 void SystemTrayDelegateChromeOS::DeviceRemoved( | 1211 void SystemTrayDelegateChromeOS::DeviceRemoved( |
1210 device::BluetoothAdapter* adapter, | 1212 device::BluetoothAdapter* adapter, |
1211 device::BluetoothDevice* device) { | 1213 device::BluetoothDevice* device) { |
1212 GetSystemTrayNotifier()->NotifyRefreshBluetooth(); | 1214 GetSystemTrayNotifier()->NotifyRefreshBluetooth(); |
1213 } | 1215 } |
1214 | 1216 |
1215 void SystemTrayDelegateChromeOS::OnStartBluetoothDiscoverySession( | 1217 void SystemTrayDelegateChromeOS::OnStartBluetoothDiscoverySession( |
1216 scoped_ptr<device::BluetoothDiscoverySession> discovery_session) { | 1218 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session) { |
1217 // If the discovery session was returned after a request to stop discovery | 1219 // If the discovery session was returned after a request to stop discovery |
1218 // (e.g. the user dismissed the Bluetooth detailed view before the call | 1220 // (e.g. the user dismissed the Bluetooth detailed view before the call |
1219 // returned), don't claim the discovery session and let it clean up. | 1221 // returned), don't claim the discovery session and let it clean up. |
1220 if (!should_run_bluetooth_discovery_) | 1222 if (!should_run_bluetooth_discovery_) |
1221 return; | 1223 return; |
1222 VLOG(1) << "Claiming new Bluetooth device discovery session."; | 1224 VLOG(1) << "Claiming new Bluetooth device discovery session."; |
1223 bluetooth_discovery_session_ = std::move(discovery_session); | 1225 bluetooth_discovery_session_ = std::move(discovery_session); |
1224 GetSystemTrayNotifier()->NotifyBluetoothDiscoveringChanged(); | 1226 GetSystemTrayNotifier()->NotifyBluetoothDiscoveringChanged(); |
1225 } | 1227 } |
1226 | 1228 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1331 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
1330 << "ENABLE_SUPERVISED_USERS undefined."; | 1332 << "ENABLE_SUPERVISED_USERS undefined."; |
1331 return base::string16(); | 1333 return base::string16(); |
1332 } | 1334 } |
1333 | 1335 |
1334 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1336 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1335 return new SystemTrayDelegateChromeOS(); | 1337 return new SystemTrayDelegateChromeOS(); |
1336 } | 1338 } |
1337 | 1339 |
1338 } // namespace chromeos | 1340 } // namespace chromeos |
OLD | NEW |