| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 } | 214 } |
| 215 | 215 |
| 216 void PrivetNotificationService::DeviceCacheFlushed() { | 216 void PrivetNotificationService::DeviceCacheFlushed() { |
| 217 privet_notifications_listener_->DeviceCacheFlushed(); | 217 privet_notifications_listener_->DeviceCacheFlushed(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 // static | 220 // static |
| 221 bool PrivetNotificationService::IsEnabled() { | 221 bool PrivetNotificationService::IsEnabled() { |
| 222 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 222 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 223 return !command_line->HasSwitch(switches::kDisableDeviceDiscovery) && | 223 return !command_line->HasSwitch(switches::kDisableDeviceDiscovery) && |
| 224 !command_line->HasSwitch( | 224 !command_line->HasSwitch(switches::kDisableDeviceDiscoveryNotifications); |
| 225 switches::kDisableDeviceDiscoveryNotifications) && | |
| 226 message_center::IsRichNotificationEnabled(); | |
| 227 } | 225 } |
| 228 | 226 |
| 229 // static | 227 // static |
| 230 bool PrivetNotificationService::IsForced() { | 228 bool PrivetNotificationService::IsForced() { |
| 231 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 229 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 232 return command_line->HasSwitch(switches::kEnableDeviceDiscoveryNotifications); | 230 return command_line->HasSwitch(switches::kEnableDeviceDiscoveryNotifications); |
| 233 } | 231 } |
| 234 | 232 |
| 235 void PrivetNotificationService::PrivetNotify(bool has_multiple, | 233 void PrivetNotificationService::PrivetNotify(bool has_multiple, |
| 236 bool added) { | 234 bool added) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 | 402 |
| 405 void PrivetNotificationDelegate::DisableNotifications() { | 403 void PrivetNotificationDelegate::DisableNotifications() { |
| 406 Profile* profile_obj = Profile::FromBrowserContext(profile_); | 404 Profile* profile_obj = Profile::FromBrowserContext(profile_); |
| 407 | 405 |
| 408 profile_obj->GetPrefs()->SetBoolean( | 406 profile_obj->GetPrefs()->SetBoolean( |
| 409 prefs::kLocalDiscoveryNotificationsEnabled, | 407 prefs::kLocalDiscoveryNotificationsEnabled, |
| 410 false); | 408 false); |
| 411 } | 409 } |
| 412 | 410 |
| 413 } // namespace local_discovery | 411 } // namespace local_discovery |
| OLD | NEW |