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

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

Issue 1352613004: Cleanup: Pass std::string as const reference from ash/ + minor coding style changes in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove const qualifier for int in function arguments Created 5 years, 3 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/test/test_session_state_delegate.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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 if (display_name) 331 if (display_name)
332 *display_name = device_list[i].display_name; 332 *display_name = device_list[i].display_name;
333 return true; 333 return true;
334 } 334 }
335 } 335 }
336 return false; 336 return false;
337 } 337 }
338 338
339 // Updates UI of the clicked bluetooth device to show it is being connected 339 // Updates UI of the clicked bluetooth device to show it is being connected
340 // or disconnected if such an operation is going to be performed underway. 340 // or disconnected if such an operation is going to be performed underway.
341 void UpdateClickedDevice(std::string device_id, views::View* item_container) { 341 void UpdateClickedDevice(const std::string& device_id,
342 views::View* item_container) {
342 base::string16 display_name; 343 base::string16 display_name;
343 if (FoundDevice(device_id, paired_not_connected_devices_, 344 if (FoundDevice(device_id, paired_not_connected_devices_,
344 &display_name)) { 345 &display_name)) {
345 display_name = l10n_util::GetStringFUTF16( 346 display_name = l10n_util::GetStringFUTF16(
346 IDS_ASH_STATUS_TRAY_BLUETOOTH_CONNECTING, display_name); 347 IDS_ASH_STATUS_TRAY_BLUETOOTH_CONNECTING, display_name);
347 348
348 item_container->RemoveAllChildViews(true); 349 item_container->RemoveAllChildViews(true);
349 static_cast<HoverHighlightView*>(item_container) 350 static_cast<HoverHighlightView*>(item_container)
350 ->AddCheckableLabel(display_name, true /* highlight */, false); 351 ->AddCheckableLabel(display_name, true /* highlight */, false);
351 scroll_content()->SizeToPreferredSize(); 352 scroll_content()->SizeToPreferredSize();
(...skipping 15 matching lines...) Expand all
367 ash::UMA_STATUS_AREA_BLUETOOTH_DISABLED : 368 ash::UMA_STATUS_AREA_BLUETOOTH_DISABLED :
368 ash::UMA_STATUS_AREA_BLUETOOTH_ENABLED); 369 ash::UMA_STATUS_AREA_BLUETOOTH_ENABLED);
369 delegate->ToggleBluetooth(); 370 delegate->ToggleBluetooth();
370 } else { 371 } else {
371 if (!delegate->GetBluetoothEnabled()) 372 if (!delegate->GetBluetoothEnabled())
372 return; 373 return;
373 std::map<views::View*, std::string>::iterator find; 374 std::map<views::View*, std::string>::iterator find;
374 find = device_map_.find(sender); 375 find = device_map_.find(sender);
375 if (find == device_map_.end()) 376 if (find == device_map_.end())
376 return; 377 return;
377 std::string device_id = find->second; 378 const std::string device_id = find->second;
378 if (FoundDevice(device_id, connecting_devices_, NULL)) 379 if (FoundDevice(device_id, connecting_devices_, NULL))
379 return; 380 return;
380 UpdateClickedDevice(device_id, sender); 381 UpdateClickedDevice(device_id, sender);
381 delegate->ConnectToBluetoothDevice(device_id); 382 delegate->ConnectToBluetoothDevice(device_id);
382 } 383 }
383 } 384 }
384 385
385 // Overridden from ButtonListener. 386 // Overridden from ButtonListener.
386 void ButtonPressed(views::Button* sender, const ui::Event& event) override { 387 void ButtonPressed(views::Button* sender, const ui::Event& event) override {
387 ash::SystemTrayDelegate* delegate = 388 ash::SystemTrayDelegate* delegate =
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 detailed_->Update(); 464 detailed_->Update();
464 } 465 }
465 466
466 void TrayBluetooth::OnBluetoothDiscoveringChanged() { 467 void TrayBluetooth::OnBluetoothDiscoveringChanged() {
467 if (!detailed_) 468 if (!detailed_)
468 return; 469 return;
469 detailed_->Update(); 470 detailed_->Update();
470 } 471 }
471 472
472 } // namespace ash 473 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/test/test_session_state_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698