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

Side by Side Diff: chromeos/dbus/system_clock_client.cc

Issue 2413963002: Replace FOR_EACH_OBSERVER in chromeos/ with range-based for (Closed)
Patch Set: Run the script again with '/mg' Created 4 years, 2 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 | « chromeos/dbus/shill_client_helper.cc ('k') | chromeos/dbus/update_engine_client.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) 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/system_clock_client.h" 5 #include "chromeos/dbus/system_clock_client.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 if (service_is_available) 77 if (service_is_available)
78 GetCanSet(); 78 GetCanSet();
79 else 79 else
80 LOG(ERROR) << "Failed to wait for D-Bus service availability"; 80 LOG(ERROR) << "Failed to wait for D-Bus service availability";
81 } 81 }
82 82
83 // Called when a TimeUpdated signal is received. 83 // Called when a TimeUpdated signal is received.
84 void TimeUpdatedReceived(dbus::Signal* signal) { 84 void TimeUpdatedReceived(dbus::Signal* signal) {
85 VLOG(1) << "TimeUpdated signal received: " << signal->ToString(); 85 VLOG(1) << "TimeUpdated signal received: " << signal->ToString();
86 dbus::MessageReader reader(signal); 86 dbus::MessageReader reader(signal);
87 FOR_EACH_OBSERVER(Observer, observers_, SystemClockUpdated()); 87 for (auto& observer : observers_)
88 observer.SystemClockUpdated();
88 89
89 // Check if the system clock can be changed now. 90 // Check if the system clock can be changed now.
90 GetCanSet(); 91 GetCanSet();
91 } 92 }
92 93
93 // Called when the TimeUpdated signal is initially connected. 94 // Called when the TimeUpdated signal is initially connected.
94 void TimeUpdatedConnected(const std::string& interface_name, 95 void TimeUpdatedConnected(const std::string& interface_name,
95 const std::string& signal_name, 96 const std::string& signal_name,
96 bool success) { 97 bool success) {
97 LOG_IF(ERROR, !success) 98 LOG_IF(ERROR, !success)
(...skipping 14 matching lines...) Expand all
112 return; 113 return;
113 } 114 }
114 115
115 // Nothing to do if the CanSetTime response hasn't changed. 116 // Nothing to do if the CanSetTime response hasn't changed.
116 if (can_set_time_initialized_ && can_set_time_ == can_set_time) 117 if (can_set_time_initialized_ && can_set_time_ == can_set_time)
117 return; 118 return;
118 119
119 can_set_time_initialized_ = true; 120 can_set_time_initialized_ = true;
120 can_set_time_ = can_set_time; 121 can_set_time_ = can_set_time;
121 122
122 FOR_EACH_OBSERVER( 123 for (auto& observer : observers_)
123 Observer, observers_, SystemClockCanSetTimeChanged(can_set_time)); 124 observer.SystemClockCanSetTimeChanged(can_set_time);
124 } 125 }
125 126
126 // Check whether the time can be set. 127 // Check whether the time can be set.
127 void GetCanSet() { 128 void GetCanSet() {
128 dbus::MethodCall method_call(system_clock::kSystemClockInterface, 129 dbus::MethodCall method_call(system_clock::kSystemClockInterface,
129 system_clock::kSystemClockCanSet); 130 system_clock::kSystemClockCanSet);
130 dbus::MessageWriter writer(&method_call); 131 dbus::MessageWriter writer(&method_call);
131 system_clock_proxy_->CallMethod( 132 system_clock_proxy_->CallMethod(
132 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 133 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
133 base::Bind(&SystemClockClientImpl::OnGetCanSet, 134 base::Bind(&SystemClockClientImpl::OnGetCanSet,
(...skipping 13 matching lines...) Expand all
147 }; 148 };
148 149
149 // static 150 // static
150 SystemClockClient* SystemClockClient::Create() { 151 SystemClockClient* SystemClockClient::Create() {
151 return new SystemClockClientImpl(); 152 return new SystemClockClientImpl();
152 } 153 }
153 154
154 SystemClockClient::SystemClockClient() {} 155 SystemClockClient::SystemClockClient() {}
155 156
156 } // namespace chromeos 157 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/shill_client_helper.cc ('k') | chromeos/dbus/update_engine_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698