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

Side by Side Diff: ash/system/bluetooth/tray_bluetooth.cc

Issue 683473005: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 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
« no previous file with comments | « ash/system/bluetooth/tray_bluetooth.h ('k') | ash/system/chromeos/tray_tracing.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 class BluetoothDefaultView : public TrayItemMore { 65 class BluetoothDefaultView : public TrayItemMore {
66 public: 66 public:
67 BluetoothDefaultView(SystemTrayItem* owner, bool show_more) 67 BluetoothDefaultView(SystemTrayItem* owner, bool show_more)
68 : TrayItemMore(owner, show_more) { 68 : TrayItemMore(owner, show_more) {
69 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 69 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
70 SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_BLUETOOTH).ToImageSkia()); 70 SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_BLUETOOTH).ToImageSkia());
71 UpdateLabel(); 71 UpdateLabel();
72 } 72 }
73 73
74 virtual ~BluetoothDefaultView() {} 74 ~BluetoothDefaultView() override {}
75 75
76 void UpdateLabel() { 76 void UpdateLabel() {
77 ash::SystemTrayDelegate* delegate = 77 ash::SystemTrayDelegate* delegate =
78 ash::Shell::GetInstance()->system_tray_delegate(); 78 ash::Shell::GetInstance()->system_tray_delegate();
79 if (delegate->GetBluetoothAvailable()) { 79 if (delegate->GetBluetoothAvailable()) {
80 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 80 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
81 const base::string16 label = 81 const base::string16 label =
82 rb.GetLocalizedString(delegate->GetBluetoothEnabled() ? 82 rb.GetLocalizedString(delegate->GetBluetoothEnabled() ?
83 IDS_ASH_STATUS_TRAY_BLUETOOTH_ENABLED : 83 IDS_ASH_STATUS_TRAY_BLUETOOTH_ENABLED :
84 IDS_ASH_STATUS_TRAY_BLUETOOTH_DISABLED); 84 IDS_ASH_STATUS_TRAY_BLUETOOTH_DISABLED);
(...skipping 15 matching lines...) Expand all
100 public: 100 public:
101 BluetoothDetailedView(SystemTrayItem* owner, user::LoginStatus login) 101 BluetoothDetailedView(SystemTrayItem* owner, user::LoginStatus login)
102 : TrayDetailsView(owner), 102 : TrayDetailsView(owner),
103 login_(login), 103 login_(login),
104 manage_devices_(NULL), 104 manage_devices_(NULL),
105 toggle_bluetooth_(NULL), 105 toggle_bluetooth_(NULL),
106 enable_bluetooth_(NULL) { 106 enable_bluetooth_(NULL) {
107 CreateItems(); 107 CreateItems();
108 } 108 }
109 109
110 virtual ~BluetoothDetailedView() { 110 ~BluetoothDetailedView() override {
111 // Stop discovering bluetooth devices when exiting BT detailed view. 111 // Stop discovering bluetooth devices when exiting BT detailed view.
112 BluetoothStopDiscovering(); 112 BluetoothStopDiscovering();
113 } 113 }
114 114
115 void Update() { 115 void Update() {
116 BluetoothStartDiscovering(); 116 BluetoothStartDiscovering();
117 UpdateBluetoothDeviceList(); 117 UpdateBluetoothDeviceList();
118 118
119 // Update UI. 119 // Update UI.
120 UpdateDeviceScrollList(); 120 UpdateDeviceScrollList();
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 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 void ButtonPressed(views::Button* sender, const ui::Event& event) override {
390 const ui::Event& event) override {
391 ash::SystemTrayDelegate* delegate = 390 ash::SystemTrayDelegate* delegate =
392 ash::Shell::GetInstance()->system_tray_delegate(); 391 ash::Shell::GetInstance()->system_tray_delegate();
393 if (sender == toggle_bluetooth_) 392 if (sender == toggle_bluetooth_)
394 delegate->ToggleBluetooth(); 393 delegate->ToggleBluetooth();
395 else 394 else
396 NOTREACHED(); 395 NOTREACHED();
397 } 396 }
398 397
399 user::LoginStatus login_; 398 user::LoginStatus login_;
400 399
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 detailed_->Update(); 466 detailed_->Update();
468 } 467 }
469 468
470 void TrayBluetooth::OnBluetoothDiscoveringChanged() { 469 void TrayBluetooth::OnBluetoothDiscoveringChanged() {
471 if (!detailed_) 470 if (!detailed_)
472 return; 471 return;
473 detailed_->Update(); 472 detailed_->Update();
474 } 473 }
475 474
476 } // namespace ash 475 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/bluetooth/tray_bluetooth.h ('k') | ash/system/chromeos/tray_tracing.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698