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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 void PrivetNotificationService::DeviceRemoved(const std::string& name) { | 217 void PrivetNotificationService::DeviceRemoved(const std::string& name) { |
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 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
228 return !command_line->HasSwitch( | 228 return !command_line->HasSwitch( |
229 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 base::CommandLine* command_line = base::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) { |
240 base::string16 product_name = l10n_util::GetStringUTF16( | 240 base::string16 product_name = l10n_util::GetStringUTF16( |
241 IDS_LOCAL_DISOCVERY_SERVICE_NAME_PRINTER); | 241 IDS_LOCAL_DISOCVERY_SERVICE_NAME_PRINTER); |
242 | 242 |
243 int title_resource = has_multiple ? | 243 int title_resource = has_multiple ? |
244 IDS_LOCAL_DISOCVERY_NOTIFICATION_TITLE_PRINTER_MULTIPLE : | 244 IDS_LOCAL_DISOCVERY_NOTIFICATION_TITLE_PRINTER_MULTIPLE : |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 392 |
393 void PrivetNotificationDelegate::DisableNotifications() { | 393 void PrivetNotificationDelegate::DisableNotifications() { |
394 Profile* profile_obj = Profile::FromBrowserContext(profile_); | 394 Profile* profile_obj = Profile::FromBrowserContext(profile_); |
395 | 395 |
396 profile_obj->GetPrefs()->SetBoolean( | 396 profile_obj->GetPrefs()->SetBoolean( |
397 prefs::kLocalDiscoveryNotificationsEnabled, | 397 prefs::kLocalDiscoveryNotificationsEnabled, |
398 false); | 398 false); |
399 } | 399 } |
400 | 400 |
401 } // namespace local_discovery | 401 } // namespace local_discovery |
OLD | NEW |