| 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 <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 9 #include "base/location.h" | 11 #include "base/location.h" |
| 10 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 11 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 12 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
| 13 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
| 16 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 service_discovery_client_ = ServiceDiscoverySharedClient::GetInstance(); | 339 service_discovery_client_ = ServiceDiscoverySharedClient::GetInstance(); |
| 338 device_lister_.reset( | 340 device_lister_.reset( |
| 339 new PrivetDeviceListerImpl(service_discovery_client_.get(), this)); | 341 new PrivetDeviceListerImpl(service_discovery_client_.get(), this)); |
| 340 device_lister_->Start(); | 342 device_lister_->Start(); |
| 341 device_lister_->DiscoverNewDevices(false); | 343 device_lister_->DiscoverNewDevices(false); |
| 342 | 344 |
| 343 scoped_ptr<PrivetHTTPAsynchronousFactory> http_factory( | 345 scoped_ptr<PrivetHTTPAsynchronousFactory> http_factory( |
| 344 PrivetHTTPAsynchronousFactory::CreateInstance( | 346 PrivetHTTPAsynchronousFactory::CreateInstance( |
| 345 profile_->GetRequestContext())); | 347 profile_->GetRequestContext())); |
| 346 | 348 |
| 347 privet_notifications_listener_.reset(new PrivetNotificationsListener( | 349 privet_notifications_listener_.reset( |
| 348 http_factory.Pass(), this)); | 350 new PrivetNotificationsListener(std::move(http_factory), this)); |
| 349 } | 351 } |
| 350 | 352 |
| 351 PrivetNotificationDelegate::PrivetNotificationDelegate( | 353 PrivetNotificationDelegate::PrivetNotificationDelegate( |
| 352 content::BrowserContext* profile) | 354 content::BrowserContext* profile) |
| 353 : profile_(profile) { | 355 : profile_(profile) { |
| 354 } | 356 } |
| 355 | 357 |
| 356 PrivetNotificationDelegate::~PrivetNotificationDelegate() { | 358 PrivetNotificationDelegate::~PrivetNotificationDelegate() { |
| 357 } | 359 } |
| 358 | 360 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 382 | 384 |
| 383 void PrivetNotificationDelegate::DisableNotifications() { | 385 void PrivetNotificationDelegate::DisableNotifications() { |
| 384 Profile* profile_obj = Profile::FromBrowserContext(profile_); | 386 Profile* profile_obj = Profile::FromBrowserContext(profile_); |
| 385 | 387 |
| 386 profile_obj->GetPrefs()->SetBoolean( | 388 profile_obj->GetPrefs()->SetBoolean( |
| 387 prefs::kLocalDiscoveryNotificationsEnabled, | 389 prefs::kLocalDiscoveryNotificationsEnabled, |
| 388 false); | 390 false); |
| 389 } | 391 } |
| 390 | 392 |
| 391 } // namespace local_discovery | 393 } // namespace local_discovery |
| OLD | NEW |