OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/shill_manager_client_stub.h" | 5 #include "chromeos/dbus/shill_manager_client_stub.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 void ShillManagerClientStub::PassStubGeoNetworks( | 516 void ShillManagerClientStub::PassStubGeoNetworks( |
517 const DictionaryValueCallback& callback) const { | 517 const DictionaryValueCallback& callback) const { |
518 callback.Run(DBUS_METHOD_CALL_SUCCESS, stub_geo_networks_); | 518 callback.Run(DBUS_METHOD_CALL_SUCCESS, stub_geo_networks_); |
519 } | 519 } |
520 | 520 |
521 void ShillManagerClientStub::CallNotifyObserversPropertyChanged( | 521 void ShillManagerClientStub::CallNotifyObserversPropertyChanged( |
522 const std::string& property, | 522 const std::string& property, |
523 int delay_ms) { | 523 int delay_ms) { |
524 // Avoid unnecessary delayed task if we have no observers (e.g. during | 524 // Avoid unnecessary delayed task if we have no observers (e.g. during |
525 // initial setup). | 525 // initial setup). |
526 if (observer_list_.size() == 0) | 526 if (!observer_list_.might_have_observers()) |
527 return; | 527 return; |
528 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 528 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
529 chromeos::switches::kEnableStubInteractive)) { | 529 chromeos::switches::kEnableStubInteractive)) { |
530 delay_ms = 0; | 530 delay_ms = 0; |
531 } | 531 } |
532 base::MessageLoop::current()->PostDelayedTask( | 532 base::MessageLoop::current()->PostDelayedTask( |
533 FROM_HERE, | 533 FROM_HERE, |
534 base::Bind(&ShillManagerClientStub::NotifyObserversPropertyChanged, | 534 base::Bind(&ShillManagerClientStub::NotifyObserversPropertyChanged, |
535 weak_ptr_factory_.GetWeakPtr(), | 535 weak_ptr_factory_.GetWeakPtr(), |
536 property), | 536 property), |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 flimflam::kScanningProperty, | 639 flimflam::kScanningProperty, |
640 base::FundamentalValue(false)); | 640 base::FundamentalValue(false)); |
641 } | 641 } |
642 CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); | 642 CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); |
643 CallNotifyObserversPropertyChanged(flimflam::kServiceWatchListProperty, | 643 CallNotifyObserversPropertyChanged(flimflam::kServiceWatchListProperty, |
644 0); | 644 0); |
645 base::MessageLoop::current()->PostTask(FROM_HERE, callback); | 645 base::MessageLoop::current()->PostTask(FROM_HERE, callback); |
646 } | 646 } |
647 | 647 |
648 } // namespace chromeos | 648 } // namespace chromeos |
OLD | NEW |