| 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/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
| 9 #include "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
| 10 #include "ash/system/tray/tray_constants.h" | 10 #include "ash/system/tray/tray_constants.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 views::View* header_text_; | 213 views::View* header_text_; |
| 214 views::View* add_device_; | 214 views::View* add_device_; |
| 215 TrayPopupHeaderButton* toggle_bluetooth_; | 215 TrayPopupHeaderButton* toggle_bluetooth_; |
| 216 views::View* settings_; | 216 views::View* settings_; |
| 217 | 217 |
| 218 DISALLOW_COPY_AND_ASSIGN(BluetoothDetailedView); | 218 DISALLOW_COPY_AND_ASSIGN(BluetoothDetailedView); |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 } // namespace tray | 221 } // namespace tray |
| 222 | 222 |
| 223 TrayBluetooth::TrayBluetooth() { | 223 TrayBluetooth::TrayBluetooth() |
| 224 : default_(NULL), |
| 225 detailed_(NULL) { |
| 224 } | 226 } |
| 225 | 227 |
| 226 TrayBluetooth::~TrayBluetooth() { | 228 TrayBluetooth::~TrayBluetooth() { |
| 227 } | 229 } |
| 228 | 230 |
| 229 views::View* TrayBluetooth::CreateTrayView(user::LoginStatus status) { | 231 views::View* TrayBluetooth::CreateTrayView(user::LoginStatus status) { |
| 230 return NULL; | 232 return NULL; |
| 231 } | 233 } |
| 232 | 234 |
| 233 views::View* TrayBluetooth::CreateDefaultView(user::LoginStatus status) { | 235 views::View* TrayBluetooth::CreateDefaultView(user::LoginStatus status) { |
| 234 default_.reset(new tray::BluetoothDefaultView(this)); | 236 CHECK(default_ == NULL); |
| 235 return default_.get(); | 237 default_ = new tray::BluetoothDefaultView(this); |
| 238 return default_; |
| 236 } | 239 } |
| 237 | 240 |
| 238 views::View* TrayBluetooth::CreateDetailedView(user::LoginStatus status) { | 241 views::View* TrayBluetooth::CreateDetailedView(user::LoginStatus status) { |
| 239 if (!Shell::GetInstance()->tray_delegate()->GetBluetoothAvailable()) | 242 if (!Shell::GetInstance()->tray_delegate()->GetBluetoothAvailable()) |
| 240 return NULL; | 243 return NULL; |
| 241 detailed_.reset(new tray::BluetoothDetailedView(status)); | 244 CHECK(detailed_ == NULL); |
| 242 return detailed_.get(); | 245 detailed_ = new tray::BluetoothDetailedView(status); |
| 246 return detailed_; |
| 243 } | 247 } |
| 244 | 248 |
| 245 void TrayBluetooth::DestroyTrayView() { | 249 void TrayBluetooth::DestroyTrayView() { |
| 246 } | 250 } |
| 247 | 251 |
| 248 void TrayBluetooth::DestroyDefaultView() { | 252 void TrayBluetooth::DestroyDefaultView() { |
| 249 default_.reset(); | 253 default_ = NULL; |
| 250 } | 254 } |
| 251 | 255 |
| 252 void TrayBluetooth::DestroyDetailedView() { | 256 void TrayBluetooth::DestroyDetailedView() { |
| 253 detailed_.reset(); | 257 detailed_ = NULL; |
| 254 } | 258 } |
| 255 | 259 |
| 256 void TrayBluetooth::UpdateAfterLoginStatusChange(user::LoginStatus status) { | 260 void TrayBluetooth::UpdateAfterLoginStatusChange(user::LoginStatus status) { |
| 257 } | 261 } |
| 258 | 262 |
| 259 void TrayBluetooth::OnBluetoothRefresh() { | 263 void TrayBluetooth::OnBluetoothRefresh() { |
| 260 BluetoothDeviceList list; | 264 BluetoothDeviceList list; |
| 261 Shell::GetInstance()->tray_delegate()->GetAvailableBluetoothDevices(&list); | 265 Shell::GetInstance()->tray_delegate()->GetAvailableBluetoothDevices(&list); |
| 262 if (default_.get()) | 266 if (default_) |
| 263 default_->UpdateLabel(); | 267 default_->UpdateLabel(); |
| 264 else if (detailed_.get()) | 268 else if (detailed_) |
| 265 detailed_->Update(list); | 269 detailed_->Update(list); |
| 266 } | 270 } |
| 267 | 271 |
| 268 } // namespace internal | 272 } // namespace internal |
| 269 } // namespace ash | 273 } // namespace ash |
| OLD | NEW |