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

Side by Side Diff: remoting/host/setup/daemon_controller_delegate_mac.mm

Issue 810133003: replace NULL->nullptr in src/remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 <CoreFoundation/CoreFoundation.h> 5 #include <CoreFoundation/CoreFoundation.h>
6 6
7 #include "remoting/host/setup/daemon_controller_delegate_mac.h" 7 #include "remoting/host/setup/daemon_controller_delegate_mac.h"
8 8
9 #include <launch.h> 9 #include <launch.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // We can only have one callback registered at a time. This is enforced by the 164 // We can only have one callback registered at a time. This is enforced by the
165 // UX flow of the web-app. 165 // UX flow of the web-app.
166 DCHECK(current_callback_.is_null()); 166 DCHECK(current_callback_.is_null());
167 current_callback_ = done; 167 current_callback_ = done;
168 168
169 CFNotificationCenterAddObserver( 169 CFNotificationCenterAddObserver(
170 CFNotificationCenterGetDistributedCenter(), 170 CFNotificationCenterGetDistributedCenter(),
171 this, 171 this,
172 &DaemonControllerDelegateMac::PreferencePaneCallback, 172 &DaemonControllerDelegateMac::PreferencePaneCallback,
173 CFSTR(UPDATE_SUCCEEDED_NOTIFICATION_NAME), 173 CFSTR(UPDATE_SUCCEEDED_NOTIFICATION_NAME),
174 NULL, 174 nullptr,
175 CFNotificationSuspensionBehaviorDeliverImmediately); 175 CFNotificationSuspensionBehaviorDeliverImmediately);
176 CFNotificationCenterAddObserver( 176 CFNotificationCenterAddObserver(
177 CFNotificationCenterGetDistributedCenter(), 177 CFNotificationCenterGetDistributedCenter(),
178 this, 178 this,
179 &DaemonControllerDelegateMac::PreferencePaneCallback, 179 &DaemonControllerDelegateMac::PreferencePaneCallback,
180 CFSTR(UPDATE_FAILED_NOTIFICATION_NAME), 180 CFSTR(UPDATE_FAILED_NOTIFICATION_NAME),
181 NULL, 181 nullptr,
182 CFNotificationSuspensionBehaviorDeliverImmediately); 182 CFNotificationSuspensionBehaviorDeliverImmediately);
183 } 183 }
184 184
185 void DaemonControllerDelegateMac::DeregisterForPreferencePaneNotifications() { 185 void DaemonControllerDelegateMac::DeregisterForPreferencePaneNotifications() {
186 CFNotificationCenterRemoveObserver( 186 CFNotificationCenterRemoveObserver(
187 CFNotificationCenterGetDistributedCenter(), 187 CFNotificationCenterGetDistributedCenter(),
188 this, 188 this,
189 CFSTR(UPDATE_SUCCEEDED_NOTIFICATION_NAME), 189 CFSTR(UPDATE_SUCCEEDED_NOTIFICATION_NAME),
190 NULL); 190 nullptr);
191 CFNotificationCenterRemoveObserver( 191 CFNotificationCenterRemoveObserver(
192 CFNotificationCenterGetDistributedCenter(), 192 CFNotificationCenterGetDistributedCenter(),
193 this, 193 this,
194 CFSTR(UPDATE_FAILED_NOTIFICATION_NAME), 194 CFSTR(UPDATE_FAILED_NOTIFICATION_NAME),
195 NULL); 195 nullptr);
196 } 196 }
197 197
198 void DaemonControllerDelegateMac::PreferencePaneCallbackDelegate( 198 void DaemonControllerDelegateMac::PreferencePaneCallbackDelegate(
199 CFStringRef name) { 199 CFStringRef name) {
200 DaemonController::AsyncResult result = DaemonController::RESULT_FAILED; 200 DaemonController::AsyncResult result = DaemonController::RESULT_FAILED;
201 if (CFStringCompare(name, CFSTR(UPDATE_SUCCEEDED_NOTIFICATION_NAME), 0) == 201 if (CFStringCompare(name, CFSTR(UPDATE_SUCCEEDED_NOTIFICATION_NAME), 0) ==
202 kCFCompareEqualTo) { 202 kCFCompareEqualTo) {
203 result = DaemonController::RESULT_OK; 203 result = DaemonController::RESULT_OK;
204 } else if (CFStringCompare(name, CFSTR(UPDATE_FAILED_NOTIFICATION_NAME), 0) == 204 } else if (CFStringCompare(name, CFSTR(UPDATE_FAILED_NOTIFICATION_NAME), 0) ==
205 kCFCompareEqualTo) { 205 kCFCompareEqualTo) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 LOG(ERROR) << "Failed to get directory for local preference panes."; 244 LOG(ERROR) << "Failed to get directory for local preference panes.";
245 return false; 245 return false;
246 } 246 }
247 pane_path = pane_path.Append("PreferencePanes").Append(kPrefPaneFileName); 247 pane_path = pane_path.Append("PreferencePanes").Append(kPrefPaneFileName);
248 248
249 FSRef pane_path_ref; 249 FSRef pane_path_ref;
250 if (!base::mac::FSRefFromPath(pane_path.value(), &pane_path_ref)) { 250 if (!base::mac::FSRefFromPath(pane_path.value(), &pane_path_ref)) {
251 LOG(ERROR) << "Failed to create FSRef"; 251 LOG(ERROR) << "Failed to create FSRef";
252 return false; 252 return false;
253 } 253 }
254 OSStatus status = LSOpenFSRef(&pane_path_ref, NULL); 254 OSStatus status = LSOpenFSRef(&pane_path_ref, nullptr);
255 if (status != noErr) { 255 if (status != noErr) {
256 OSSTATUS_LOG(ERROR, status) << "LSOpenFSRef failed for path: " 256 OSSTATUS_LOG(ERROR, status) << "LSOpenFSRef failed for path: "
257 << pane_path.value(); 257 << pane_path.value();
258 return false; 258 return false;
259 } 259 }
260 260
261 CFNotificationCenterRef center = 261 CFNotificationCenterRef center =
262 CFNotificationCenterGetDistributedCenter(); 262 CFNotificationCenterGetDistributedCenter();
263 base::ScopedCFTypeRef<CFStringRef> service_name(CFStringCreateWithCString( 263 base::ScopedCFTypeRef<CFStringRef> service_name(CFStringCreateWithCString(
264 kCFAllocatorDefault, remoting::kServiceName, kCFStringEncodingUTF8)); 264 kCFAllocatorDefault, remoting::kServiceName, kCFStringEncodingUTF8));
265 CFNotificationCenterPostNotification(center, service_name, NULL, NULL, 265 CFNotificationCenterPostNotification(center, service_name, nullptr, nullptr,
266 TRUE); 266 TRUE);
267 return true; 267 return true;
268 } 268 }
269 269
270 // static 270 // static
271 void DaemonControllerDelegateMac::PreferencePaneCallback( 271 void DaemonControllerDelegateMac::PreferencePaneCallback(
272 CFNotificationCenterRef center, 272 CFNotificationCenterRef center,
273 void* observer, 273 void* observer,
274 CFStringRef name, 274 CFStringRef name,
275 const void* object, 275 const void* object,
276 CFDictionaryRef user_info) { 276 CFDictionaryRef user_info) {
277 DaemonControllerDelegateMac* self = 277 DaemonControllerDelegateMac* self =
278 reinterpret_cast<DaemonControllerDelegateMac*>(observer); 278 reinterpret_cast<DaemonControllerDelegateMac*>(observer);
279 if (!self) { 279 if (!self) {
280 LOG(WARNING) << "Ignoring notification with NULL observer: " << name; 280 LOG(WARNING) << "Ignoring notification with nullptr observer: " << name;
281 return; 281 return;
282 } 282 }
283 283
284 self->PreferencePaneCallbackDelegate(name); 284 self->PreferencePaneCallbackDelegate(name);
285 } 285 }
286 286
287 scoped_refptr<DaemonController> DaemonController::Create() { 287 scoped_refptr<DaemonController> DaemonController::Create() {
288 scoped_ptr<DaemonController::Delegate> delegate( 288 scoped_ptr<DaemonController::Delegate> delegate(
289 new DaemonControllerDelegateMac()); 289 new DaemonControllerDelegateMac());
290 return new DaemonController(delegate.Pass()); 290 return new DaemonController(delegate.Pass());
291 } 291 }
292 292
293 } // namespace remoting 293 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/setup/daemon_controller.cc ('k') | remoting/host/setup/daemon_controller_delegate_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698