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

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

Issue 1143343005: chrome/browser: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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/location.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/single_thread_task_runner.h"
13 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/thread_task_runner_handle.h"
14 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/local_discovery/privet_device_lister_impl.h" 17 #include "chrome/browser/local_discovery/privet_device_lister_impl.h"
16 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h" 18 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h"
17 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" 19 #include "chrome/browser/local_discovery/service_discovery_shared_client.h"
18 #include "chrome/browser/notifications/notification.h" 20 #include "chrome/browser/notifications/notification.h"
19 #include "chrome/browser/notifications/notification_ui_manager.h" 21 #include "chrome/browser/notifications/notification_ui_manager.h"
20 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/signin/signin_manager_factory.h" 23 #include "chrome/browser/signin/signin_manager_factory.h"
22 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_finder.h" 25 #include "chrome/browser/ui/browser_finder.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 191
190 PrivetNotificationsListener::DeviceContext::DeviceContext() { 192 PrivetNotificationsListener::DeviceContext::DeviceContext() {
191 } 193 }
192 194
193 PrivetNotificationsListener::DeviceContext::~DeviceContext() { 195 PrivetNotificationsListener::DeviceContext::~DeviceContext() {
194 } 196 }
195 197
196 PrivetNotificationService::PrivetNotificationService( 198 PrivetNotificationService::PrivetNotificationService(
197 content::BrowserContext* profile) 199 content::BrowserContext* profile)
198 : profile_(profile) { 200 : profile_(profile) {
199 base::MessageLoop::current()->PostDelayedTask( 201 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
200 FROM_HERE, 202 FROM_HERE, base::Bind(&PrivetNotificationService::Start, AsWeakPtr()),
201 base::Bind(&PrivetNotificationService::Start, AsWeakPtr()),
202 base::TimeDelta::FromSeconds(kStartDelaySeconds + 203 base::TimeDelta::FromSeconds(kStartDelaySeconds +
203 base::RandInt(0, kStartDelaySeconds/4))); 204 base::RandInt(0, kStartDelaySeconds / 4)));
204 } 205 }
205 206
206 PrivetNotificationService::~PrivetNotificationService() { 207 PrivetNotificationService::~PrivetNotificationService() {
207 } 208 }
208 209
209 void PrivetNotificationService::DeviceChanged( 210 void PrivetNotificationService::DeviceChanged(
210 bool added, 211 bool added,
211 const std::string& name, 212 const std::string& name,
212 const DeviceDescription& description) { 213 const DeviceDescription& description) {
213 privet_notifications_listener_->DeviceChanged(added, name, description); 214 privet_notifications_listener_->DeviceChanged(added, name, description);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 385
385 void PrivetNotificationDelegate::DisableNotifications() { 386 void PrivetNotificationDelegate::DisableNotifications() {
386 Profile* profile_obj = Profile::FromBrowserContext(profile_); 387 Profile* profile_obj = Profile::FromBrowserContext(profile_);
387 388
388 profile_obj->GetPrefs()->SetBoolean( 389 profile_obj->GetPrefs()->SetBoolean(
389 prefs::kLocalDiscoveryNotificationsEnabled, 390 prefs::kLocalDiscoveryNotificationsEnabled,
390 false); 391 false);
391 } 392 }
392 393
393 } // namespace local_discovery 394 } // namespace local_discovery
OLDNEW
« no previous file with comments | « chrome/browser/local_discovery/privet_http_unittest.cc ('k') | chrome/browser/local_discovery/privet_traffic_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698