| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 privet_notifications_listener_->DeviceRemoved(name); | 218 privet_notifications_listener_->DeviceRemoved(name); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void PrivetNotificationService::DeviceCacheFlushed() { | 221 void PrivetNotificationService::DeviceCacheFlushed() { |
| 222 privet_notifications_listener_->DeviceCacheFlushed(); | 222 privet_notifications_listener_->DeviceCacheFlushed(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 // static | 225 // static |
| 226 bool PrivetNotificationService::IsEnabled() { | 226 bool PrivetNotificationService::IsEnabled() { |
| 227 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 227 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 228 return !command_line->HasSwitch(switches::kDisableDeviceDiscovery) && | 228 return !command_line->HasSwitch( |
| 229 !command_line->HasSwitch(switches::kDisableDeviceDiscoveryNotifications); | 229 switches::kDisableDeviceDiscoveryNotifications); |
| 230 } | 230 } |
| 231 | 231 |
| 232 // static | 232 // static |
| 233 bool PrivetNotificationService::IsForced() { | 233 bool PrivetNotificationService::IsForced() { |
| 234 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 234 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 235 return command_line->HasSwitch(switches::kEnableDeviceDiscoveryNotifications); | 235 return command_line->HasSwitch(switches::kEnableDeviceDiscoveryNotifications); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void PrivetNotificationService::PrivetNotify(bool has_multiple, | 238 void PrivetNotificationService::PrivetNotify(bool has_multiple, |
| 239 bool added) { | 239 bool added) { |
| (...skipping 167 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 |