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

Side by Side Diff: chrome/browser/local_discovery/privet_notifications.cc

Issue 948413006: Move callback and host port args into Start method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_sdc
Patch Set: Created 5 years, 9 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 "chrome/browser/local_discovery/privet_notifications.h" 5 #include "chrome/browser/local_discovery/privet_notifications.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/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 linked_ptr<DeviceContext> device_context(new DeviceContext); 99 linked_ptr<DeviceContext> device_context(new DeviceContext);
100 100
101 device_context->notification_may_be_active = false; 101 device_context->notification_may_be_active = false;
102 device_context->registered = !description.id.empty(); 102 device_context->registered = !description.id.empty();
103 103
104 devices_seen_.insert(make_pair(name, device_context)); 104 devices_seen_.insert(make_pair(name, device_context));
105 105
106 if (!device_context->registered) { 106 if (!device_context->registered) {
107 device_context->privet_http_resolution = 107 device_context->privet_http_resolution =
108 privet_http_factory_->CreatePrivetHTTP( 108 privet_http_factory_->CreatePrivetHTTP(name);
109 name, 109 device_context->privet_http_resolution->Start(
110 description.address, 110 description.address,
111 base::Bind(&PrivetNotificationsListener::CreateInfoOperation, 111 base::Bind(&PrivetNotificationsListener::CreateInfoOperation,
112 base::Unretained(this))); 112 base::Unretained(this)));
113
114 device_context->privet_http_resolution->Start();
115 } 113 }
116 } 114 }
117 115
118 void PrivetNotificationsListener::CreateInfoOperation( 116 void PrivetNotificationsListener::CreateInfoOperation(
119 scoped_ptr<PrivetHTTPClient> http_client) { 117 scoped_ptr<PrivetHTTPClient> http_client) {
120 if (!http_client) { 118 if (!http_client) {
121 // Do nothing if resolution fails. 119 // Do nothing if resolution fails.
122 return; 120 return;
123 } 121 }
124 122
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 389
392 void PrivetNotificationDelegate::DisableNotifications() { 390 void PrivetNotificationDelegate::DisableNotifications() {
393 Profile* profile_obj = Profile::FromBrowserContext(profile_); 391 Profile* profile_obj = Profile::FromBrowserContext(profile_);
394 392
395 profile_obj->GetPrefs()->SetBoolean( 393 profile_obj->GetPrefs()->SetBoolean(
396 prefs::kLocalDiscoveryNotificationsEnabled, 394 prefs::kLocalDiscoveryNotificationsEnabled,
397 false); 395 false);
398 } 396 }
399 397
400 } // namespace local_discovery 398 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698