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

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

Issue 2829763002: [Ash] Remove HoverHighlightView::AddLabelDeprecated() (Closed)
Patch Set: Created 3 years, 8 months 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 | « no previous file | ash/system/network/network_state_list_detailed_view.cc » ('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/resources/grit/ash_resources.h" 7 #include "ash/resources/grit/ash_resources.h"
8 #include "ash/resources/vector_icons/vector_icons.h" 8 #include "ash/resources/vector_icons/vector_icons.h"
9 #include "ash/session/session_state_delegate.h" 9 #include "ash/session/session_state_delegate.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 281
282 // If Bluetooth is disabled, show a panel which only indicates that it is 282 // If Bluetooth is disabled, show a panel which only indicates that it is
283 // disabled, instead of the scroller with Bluetooth devices. 283 // disabled, instead of the scroller with Bluetooth devices.
284 if (bluetooth_enabled) { 284 if (bluetooth_enabled) {
285 HideDisabledPanel(); 285 HideDisabledPanel();
286 } else { 286 } else {
287 ShowDisabledPanel(); 287 ShowDisabledPanel();
288 return; 288 return;
289 } 289 }
290 290
291 // Add paired devices (and their section header in MD) in the list. 291 // Add paired devices and their section header to the list.
292 size_t num_paired_devices = connected_devices_.size() + 292 size_t num_paired_devices = connected_devices_.size() +
293 connecting_devices_.size() + 293 connecting_devices_.size() +
294 paired_not_connected_devices_.size(); 294 paired_not_connected_devices_.size();
295 if (num_paired_devices > 0) { 295 if (num_paired_devices > 0) {
296 AddSubHeader(IDS_ASH_STATUS_TRAY_BLUETOOTH_PAIRED_DEVICES); 296 AddSubHeader(IDS_ASH_STATUS_TRAY_BLUETOOTH_PAIRED_DEVICES);
297 AppendSameTypeDevicesToScrollList(connected_devices_, true, true, 297 AppendSameTypeDevicesToScrollList(connected_devices_, true, true,
298 bluetooth_enabled); 298 bluetooth_enabled);
299 AppendSameTypeDevicesToScrollList(connecting_devices_, true, false, 299 AppendSameTypeDevicesToScrollList(connecting_devices_, true, false,
300 bluetooth_enabled); 300 bluetooth_enabled);
301 AppendSameTypeDevicesToScrollList(paired_not_connected_devices_, false, 301 AppendSameTypeDevicesToScrollList(paired_not_connected_devices_, false,
302 false, bluetooth_enabled); 302 false, bluetooth_enabled);
303 } 303 }
304 304
305 // Add paired devices (and their section header in MD) in the list. 305 // Add unpaired devices to the list. If at least one paired device is
306 // present, also add a section header above the unpaired devices.
306 if (discovered_not_paired_devices_.size() > 0) { 307 if (discovered_not_paired_devices_.size() > 0) {
307 if (num_paired_devices > 0) 308 if (num_paired_devices > 0)
308 AddSubHeader(IDS_ASH_STATUS_TRAY_BLUETOOTH_UNPAIRED_DEVICES); 309 AddSubHeader(IDS_ASH_STATUS_TRAY_BLUETOOTH_UNPAIRED_DEVICES);
309 AppendSameTypeDevicesToScrollList(discovered_not_paired_devices_, false, 310 AppendSameTypeDevicesToScrollList(discovered_not_paired_devices_, false,
310 false, bluetooth_enabled); 311 false, bluetooth_enabled);
311 } 312 }
312 313
313 // Show user Bluetooth state if there is no bluetooth devices in list. 314 // Show user Bluetooth state if there is no bluetooth devices in list.
314 if (device_map_.size() == 0) { 315 if (device_map_.size() == 0 && bluetooth_available && bluetooth_enabled) {
315 if (bluetooth_available && bluetooth_enabled) { 316 scroll_content()->AddChildView(TrayPopupUtils::CreateInfoLabelRowView(
316 HoverHighlightView* container = new HoverHighlightView(this); 317 IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERING));
317 container->AddLabelDeprecated(
318 l10n_util::GetStringUTF16(
319 IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERING),
320 gfx::ALIGN_LEFT, false);
321 scroll_content()->AddChildView(container);
322 }
323 } 318 }
324 319
325 // Focus the device which was focused before the device-list update. 320 // Focus the device which was focused before the device-list update.
326 if (!focused_device_address.empty()) 321 if (!focused_device_address.empty())
327 FocusDeviceByAddress(focused_device_address); 322 FocusDeviceByAddress(focused_device_address);
328 323
329 scroll_content()->InvalidateLayout(); 324 scroll_content()->InvalidateLayout();
330 } 325 }
331 326
332 void AppendSameTypeDevicesToScrollList(const BluetoothDeviceList& list, 327 void AppendSameTypeDevicesToScrollList(const BluetoothDeviceList& list,
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 detailed_->Update(); 642 detailed_->Update();
648 } 643 }
649 644
650 void TrayBluetooth::OnBluetoothDiscoveringChanged() { 645 void TrayBluetooth::OnBluetoothDiscoveringChanged() {
651 if (!detailed_) 646 if (!detailed_)
652 return; 647 return;
653 detailed_->Update(); 648 detailed_->Update();
654 } 649 }
655 650
656 } // namespace ash 651 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/system/network/network_state_list_detailed_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698