| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/system/bluetooth/tray_bluetooth.h" | 5 #include "ash/system/bluetooth/tray_bluetooth.h" |
| 6 | 6 |
| 7 #include "ash/session/session_state_delegate.h" | 7 #include "ash/session/session_state_delegate.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/system/tray/fixed_sized_scroll_view.h" | 9 #include "ash/system/tray/fixed_sized_scroll_view.h" |
| 10 #include "ash/system/tray/hover_highlight_view.h" | 10 #include "ash/system/tray/hover_highlight_view.h" |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 350 |
| 351 item_container->RemoveAllChildViews(true); | 351 item_container->RemoveAllChildViews(true); |
| 352 static_cast<HoverHighlightView*>(item_container)-> | 352 static_cast<HoverHighlightView*>(item_container)-> |
| 353 AddCheckableLabel(display_name, gfx::Font::BOLD, false); | 353 AddCheckableLabel(display_name, gfx::Font::BOLD, false); |
| 354 scroll_content()->SizeToPreferredSize(); | 354 scroll_content()->SizeToPreferredSize(); |
| 355 static_cast<views::View*>(scroller())->Layout(); | 355 static_cast<views::View*>(scroller())->Layout(); |
| 356 } | 356 } |
| 357 } | 357 } |
| 358 | 358 |
| 359 // Overridden from ViewClickListener. | 359 // Overridden from ViewClickListener. |
| 360 virtual void OnViewClicked(views::View* sender) OVERRIDE { | 360 virtual void OnViewClicked(views::View* sender) override { |
| 361 ash::SystemTrayDelegate* delegate = | 361 ash::SystemTrayDelegate* delegate = |
| 362 ash::Shell::GetInstance()->system_tray_delegate(); | 362 ash::Shell::GetInstance()->system_tray_delegate(); |
| 363 if (sender == footer()->content()) { | 363 if (sender == footer()->content()) { |
| 364 TransitionToDefaultView(); | 364 TransitionToDefaultView(); |
| 365 } else if (sender == manage_devices_) { | 365 } else if (sender == manage_devices_) { |
| 366 delegate->ManageBluetoothDevices(); | 366 delegate->ManageBluetoothDevices(); |
| 367 } else if (sender == enable_bluetooth_) { | 367 } else if (sender == enable_bluetooth_) { |
| 368 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 368 Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
| 369 delegate->GetBluetoothEnabled() ? | 369 delegate->GetBluetoothEnabled() ? |
| 370 ash::UMA_STATUS_AREA_BLUETOOTH_DISABLED : | 370 ash::UMA_STATUS_AREA_BLUETOOTH_DISABLED : |
| 371 ash::UMA_STATUS_AREA_BLUETOOTH_ENABLED); | 371 ash::UMA_STATUS_AREA_BLUETOOTH_ENABLED); |
| 372 delegate->ToggleBluetooth(); | 372 delegate->ToggleBluetooth(); |
| 373 } else { | 373 } else { |
| 374 if (!delegate->GetBluetoothEnabled()) | 374 if (!delegate->GetBluetoothEnabled()) |
| 375 return; | 375 return; |
| 376 std::map<views::View*, std::string>::iterator find; | 376 std::map<views::View*, std::string>::iterator find; |
| 377 find = device_map_.find(sender); | 377 find = device_map_.find(sender); |
| 378 if (find == device_map_.end()) | 378 if (find == device_map_.end()) |
| 379 return; | 379 return; |
| 380 std::string device_id = find->second; | 380 std::string device_id = find->second; |
| 381 if (FoundDevice(device_id, connecting_devices_, NULL)) | 381 if (FoundDevice(device_id, connecting_devices_, NULL)) |
| 382 return; | 382 return; |
| 383 UpdateClickedDevice(device_id, sender); | 383 UpdateClickedDevice(device_id, sender); |
| 384 delegate->ConnectToBluetoothDevice(device_id); | 384 delegate->ConnectToBluetoothDevice(device_id); |
| 385 } | 385 } |
| 386 } | 386 } |
| 387 | 387 |
| 388 // Overridden from ButtonListener. | 388 // Overridden from ButtonListener. |
| 389 virtual void ButtonPressed(views::Button* sender, | 389 virtual void ButtonPressed(views::Button* sender, |
| 390 const ui::Event& event) OVERRIDE { | 390 const ui::Event& event) override { |
| 391 ash::SystemTrayDelegate* delegate = | 391 ash::SystemTrayDelegate* delegate = |
| 392 ash::Shell::GetInstance()->system_tray_delegate(); | 392 ash::Shell::GetInstance()->system_tray_delegate(); |
| 393 if (sender == toggle_bluetooth_) | 393 if (sender == toggle_bluetooth_) |
| 394 delegate->ToggleBluetooth(); | 394 delegate->ToggleBluetooth(); |
| 395 else | 395 else |
| 396 NOTREACHED(); | 396 NOTREACHED(); |
| 397 } | 397 } |
| 398 | 398 |
| 399 user::LoginStatus login_; | 399 user::LoginStatus login_; |
| 400 | 400 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 detailed_->Update(); | 467 detailed_->Update(); |
| 468 } | 468 } |
| 469 | 469 |
| 470 void TrayBluetooth::OnBluetoothDiscoveringChanged() { | 470 void TrayBluetooth::OnBluetoothDiscoveringChanged() { |
| 471 if (!detailed_) | 471 if (!detailed_) |
| 472 return; | 472 return; |
| 473 detailed_->Update(); | 473 detailed_->Update(); |
| 474 } | 474 } |
| 475 | 475 |
| 476 } // namespace ash | 476 } // namespace ash |
| OLD | NEW |