| 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 "chromeos/dbus/update_engine_client.h" | 5 #include "chromeos/dbus/update_engine_client.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 376 |
| 377 // Called when the status update signal is initially connected. | 377 // Called when the status update signal is initially connected. |
| 378 void StatusUpdateConnected(const std::string& interface_name, | 378 void StatusUpdateConnected(const std::string& interface_name, |
| 379 const std::string& signal_name, | 379 const std::string& signal_name, |
| 380 bool success) { | 380 bool success) { |
| 381 LOG_IF(WARNING, !success) | 381 LOG_IF(WARNING, !success) |
| 382 << "Failed to connect to status updated signal."; | 382 << "Failed to connect to status updated signal."; |
| 383 } | 383 } |
| 384 | 384 |
| 385 dbus::ObjectProxy* update_engine_proxy_; | 385 dbus::ObjectProxy* update_engine_proxy_; |
| 386 ObserverList<Observer> observers_; | 386 base::ObserverList<Observer> observers_; |
| 387 Status last_status_; | 387 Status last_status_; |
| 388 | 388 |
| 389 // Note: This should remain the last member so it'll be destroyed and | 389 // Note: This should remain the last member so it'll be destroyed and |
| 390 // invalidate its weak pointers before any other members are destroyed. | 390 // invalidate its weak pointers before any other members are destroyed. |
| 391 base::WeakPtrFactory<UpdateEngineClientImpl> weak_ptr_factory_; | 391 base::WeakPtrFactory<UpdateEngineClientImpl> weak_ptr_factory_; |
| 392 | 392 |
| 393 DISALLOW_COPY_AND_ASSIGN(UpdateEngineClientImpl); | 393 DISALLOW_COPY_AND_ASSIGN(UpdateEngineClientImpl); |
| 394 }; | 394 }; |
| 395 | 395 |
| 396 // The UpdateEngineClient implementation used on Linux desktop, | 396 // The UpdateEngineClient implementation used on Linux desktop, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 FOR_EACH_OBSERVER(Observer, observers_, UpdateStatusChanged(last_status_)); | 518 FOR_EACH_OBSERVER(Observer, observers_, UpdateStatusChanged(last_status_)); |
| 519 if (last_status_.status != UPDATE_STATUS_IDLE) { | 519 if (last_status_.status != UPDATE_STATUS_IDLE) { |
| 520 base::MessageLoop::current()->PostDelayedTask( | 520 base::MessageLoop::current()->PostDelayedTask( |
| 521 FROM_HERE, | 521 FROM_HERE, |
| 522 base::Bind(&UpdateEngineClientFakeImpl::StateTransition, | 522 base::Bind(&UpdateEngineClientFakeImpl::StateTransition, |
| 523 weak_factory_.GetWeakPtr()), | 523 weak_factory_.GetWeakPtr()), |
| 524 base::TimeDelta::FromMilliseconds(delay_ms)); | 524 base::TimeDelta::FromMilliseconds(delay_ms)); |
| 525 } | 525 } |
| 526 } | 526 } |
| 527 | 527 |
| 528 ObserverList<Observer> observers_; | 528 base::ObserverList<Observer> observers_; |
| 529 Status last_status_; | 529 Status last_status_; |
| 530 | 530 |
| 531 base::WeakPtrFactory<UpdateEngineClientFakeImpl> weak_factory_; | 531 base::WeakPtrFactory<UpdateEngineClientFakeImpl> weak_factory_; |
| 532 | 532 |
| 533 DISALLOW_COPY_AND_ASSIGN(UpdateEngineClientFakeImpl); | 533 DISALLOW_COPY_AND_ASSIGN(UpdateEngineClientFakeImpl); |
| 534 }; | 534 }; |
| 535 | 535 |
| 536 UpdateEngineClient::UpdateEngineClient() { | 536 UpdateEngineClient::UpdateEngineClient() { |
| 537 } | 537 } |
| 538 | 538 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 565 auto cix = std::find(kReleaseChannelsList, | 565 auto cix = std::find(kReleaseChannelsList, |
| 566 kReleaseChannelsList + arraysize(kReleaseChannelsList), | 566 kReleaseChannelsList + arraysize(kReleaseChannelsList), |
| 567 current_channel); | 567 current_channel); |
| 568 auto tix = std::find(kReleaseChannelsList, | 568 auto tix = std::find(kReleaseChannelsList, |
| 569 kReleaseChannelsList + arraysize(kReleaseChannelsList), | 569 kReleaseChannelsList + arraysize(kReleaseChannelsList), |
| 570 target_channel); | 570 target_channel); |
| 571 return tix > cix; | 571 return tix > cix; |
| 572 } | 572 } |
| 573 | 573 |
| 574 } // namespace chromeos | 574 } // namespace chromeos |
| OLD | NEW |