OLD | NEW |
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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 } | 336 } |
337 #endif | 337 #endif |
338 } | 338 } |
339 | 339 |
340 void PrivetNotificationService::StartLister() { | 340 void PrivetNotificationService::StartLister() { |
341 ReportPrivetUmaEvent(PRIVET_LISTER_STARTED); | 341 ReportPrivetUmaEvent(PRIVET_LISTER_STARTED); |
342 #if defined(ENABLE_MDNS) | 342 #if defined(ENABLE_MDNS) |
343 traffic_detector_ = NULL; | 343 traffic_detector_ = NULL; |
344 #endif // ENABLE_MDNS | 344 #endif // ENABLE_MDNS |
345 service_discovery_client_ = ServiceDiscoverySharedClient::GetInstance(); | 345 service_discovery_client_ = ServiceDiscoverySharedClient::GetInstance(); |
346 device_lister_.reset(new PrivetDeviceListerImpl(service_discovery_client_, | 346 device_lister_.reset( |
347 this)); | 347 new PrivetDeviceListerImpl(service_discovery_client_.get(), this)); |
348 device_lister_->Start(); | 348 device_lister_->Start(); |
349 device_lister_->DiscoverNewDevices(false); | 349 device_lister_->DiscoverNewDevices(false); |
350 | 350 |
351 scoped_ptr<PrivetHTTPAsynchronousFactory> http_factory( | 351 scoped_ptr<PrivetHTTPAsynchronousFactory> http_factory( |
352 PrivetHTTPAsynchronousFactory::CreateInstance( | 352 PrivetHTTPAsynchronousFactory::CreateInstance( |
353 service_discovery_client_.get(), profile_->GetRequestContext())); | 353 service_discovery_client_.get(), profile_->GetRequestContext())); |
354 | 354 |
355 privet_notifications_listener_.reset(new PrivetNotificationsListener( | 355 privet_notifications_listener_.reset(new PrivetNotificationsListener( |
356 http_factory.Pass(), this)); | 356 http_factory.Pass(), this)); |
357 } | 357 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 | 407 |
408 void PrivetNotificationDelegate::DisableNotifications() { | 408 void PrivetNotificationDelegate::DisableNotifications() { |
409 Profile* profile_obj = Profile::FromBrowserContext(profile_); | 409 Profile* profile_obj = Profile::FromBrowserContext(profile_); |
410 | 410 |
411 profile_obj->GetPrefs()->SetBoolean( | 411 profile_obj->GetPrefs()->SetBoolean( |
412 prefs::kLocalDiscoveryNotificationsEnabled, | 412 prefs::kLocalDiscoveryNotificationsEnabled, |
413 false); | 413 false); |
414 } | 414 } |
415 | 415 |
416 } // namespace local_discovery | 416 } // namespace local_discovery |
OLD | NEW |