Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 2446403003: chromeos: Convert bluetooth pairing dialog to work with mash, part 1 (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
30 #include "ash/common/system/user/user_observer.h" 30 #include "ash/common/system/user/user_observer.h"
31 #include "ash/common/wm_shell.h" 31 #include "ash/common/wm_shell.h"
32 #include "ash/shell.h" 32 #include "ash/shell.h"
33 #include "ash/system/chromeos/rotation/tray_rotation_lock.h" 33 #include "ash/system/chromeos/rotation/tray_rotation_lock.h"
34 #include "ash/wm/lock_state_controller.h" 34 #include "ash/wm/lock_state_controller.h"
35 #include "base/bind_helpers.h" 35 #include "base/bind_helpers.h"
36 #include "base/callback.h" 36 #include "base/callback.h"
37 #include "base/logging.h" 37 #include "base/logging.h"
38 #include "base/memory/ptr_util.h" 38 #include "base/memory/ptr_util.h"
39 #include "base/memory/weak_ptr.h" 39 #include "base/memory/weak_ptr.h"
40 #include "base/metrics/user_metrics.h"
40 #include "base/strings/stringprintf.h" 41 #include "base/strings/stringprintf.h"
41 #include "base/strings/utf_string_conversions.h" 42 #include "base/strings/utf_string_conversions.h"
42 #include "base/sys_info.h" 43 #include "base/sys_info.h"
43 #include "base/time/time.h" 44 #include "base/time/time.h"
44 #include "chrome/browser/browser_process.h" 45 #include "chrome/browser/browser_process.h"
45 #include "chrome/browser/chrome_notification_types.h" 46 #include "chrome/browser/chrome_notification_types.h"
46 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" 47 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
47 #include "chrome/browser/chromeos/bluetooth/bluetooth_pairing_dialog.h" 48 #include "chrome/browser/chromeos/bluetooth/bluetooth_pairing_dialog.h"
48 #include "chrome/browser/chromeos/events/system_key_event_listener.h" 49 #include "chrome/browser/chromeos/events/system_key_event_listener.h"
49 #include "chrome/browser/chromeos/input_method/input_method_switch_recorder.h" 50 #include "chrome/browser/chromeos/input_method/input_method_switch_recorder.h"
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 void SystemTrayDelegateChromeOS::ConnectToBluetoothDevice( 469 void SystemTrayDelegateChromeOS::ConnectToBluetoothDevice(
469 const std::string& address) { 470 const std::string& address) {
470 device::BluetoothDevice* device = bluetooth_adapter_->GetDevice(address); 471 device::BluetoothDevice* device = bluetooth_adapter_->GetDevice(address);
471 if (!device || device->IsConnecting() || 472 if (!device || device->IsConnecting() ||
472 (device->IsConnected() && device->IsPaired())) { 473 (device->IsConnected() && device->IsPaired())) {
473 return; 474 return;
474 } 475 }
475 if (device->IsPaired() && !device->IsConnectable()) 476 if (device->IsPaired() && !device->IsConnectable())
476 return; 477 return;
477 if (device->IsPaired() || !device->IsPairable()) { 478 if (device->IsPaired() || !device->IsPairable()) {
478 ash::WmShell::Get()->RecordUserMetricsAction( 479 base::RecordAction(
479 ash::UMA_STATUS_AREA_BLUETOOTH_CONNECT_KNOWN_DEVICE); 480 base::UserMetricsAction("StatusArea_Bluetooth_Connect_Known"));
480 device->Connect(NULL, 481 device->Connect(NULL,
481 base::Bind(&base::DoNothing), 482 base::Bind(&base::DoNothing),
482 base::Bind(&BluetoothDeviceConnectError)); 483 base::Bind(&BluetoothDeviceConnectError));
483 } else { // Show paring dialog for the unpaired device. 484 return;
484 ash::WmShell::Get()->RecordUserMetricsAction(
485 ash::UMA_STATUS_AREA_BLUETOOTH_CONNECT_UNKNOWN_DEVICE);
486 BluetoothPairingDialog* dialog =
487 new BluetoothPairingDialog(GetNativeWindow(), device);
488 // The dialog deletes itself on close.
489 dialog->Show();
490 } 485 }
486 // Show pairing dialog for the unpaired device.
487 base::RecordAction(
488 base::UserMetricsAction("StatusArea_Bluetooth_Connect_Unknown"));
489 BluetoothPairingDialog* dialog = new BluetoothPairingDialog(device);
490 // The dialog deletes itself on close.
491 dialog->ShowInContainer(SystemTrayClient::GetDialogParentContainerId());
491 } 492 }
492 493
493 bool SystemTrayDelegateChromeOS::IsBluetoothDiscovering() { 494 bool SystemTrayDelegateChromeOS::IsBluetoothDiscovering() {
494 return bluetooth_adapter_ && bluetooth_adapter_->IsDiscovering(); 495 return bluetooth_adapter_ && bluetooth_adapter_->IsDiscovering();
495 } 496 }
496 497
497 void SystemTrayDelegateChromeOS::GetCurrentIME(ash::IMEInfo* info) { 498 void SystemTrayDelegateChromeOS::GetCurrentIME(ash::IMEInfo* info) {
498 input_method::InputMethodManager* manager = 499 input_method::InputMethodManager* manager =
499 input_method::InputMethodManager::Get(); 500 input_method::InputMethodManager::Get();
500 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); 501 input_method::InputMethodUtil* util = manager->GetInputMethodUtil();
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " 1108 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while "
1108 << "ENABLE_SUPERVISED_USERS undefined."; 1109 << "ENABLE_SUPERVISED_USERS undefined.";
1109 return base::string16(); 1110 return base::string16();
1110 } 1111 }
1111 1112
1112 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1113 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1113 return new SystemTrayDelegateChromeOS(); 1114 return new SystemTrayDelegateChromeOS();
1114 } 1115 }
1115 1116
1116 } // namespace chromeos 1117 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698