OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/services/gcm/push_messaging_service_impl.h" | 5 #include "chrome/browser/services/gcm/push_messaging_service_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 registry->RegisterIntegerPref( | 53 registry->RegisterIntegerPref( |
54 prefs::kPushMessagingRegistrationCount, | 54 prefs::kPushMessagingRegistrationCount, |
55 0, | 55 0, |
56 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 56 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
57 } | 57 } |
58 | 58 |
59 // static | 59 // static |
60 void PushMessagingServiceImpl::InitializeForProfile(Profile* profile) { | 60 void PushMessagingServiceImpl::InitializeForProfile(Profile* profile) { |
61 // TODO(mvanouwerkerk): Make sure to remove this check at the same time as | 61 // TODO(mvanouwerkerk): Make sure to remove this check at the same time as |
62 // push graduates from experimental in Blink. | 62 // push graduates from experimental in Blink. |
63 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 63 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
64 switches::kEnableExperimentalWebPlatformFeatures)) { | 64 switches::kEnableExperimentalWebPlatformFeatures)) { |
65 return; | 65 return; |
66 } | 66 } |
67 | 67 |
68 // TODO(johnme): Consider whether push should be enabled in incognito. | 68 // TODO(johnme): Consider whether push should be enabled in incognito. |
69 if (!profile || profile->IsOffTheRecord()) | 69 if (!profile || profile->IsOffTheRecord()) |
70 return; | 70 return; |
71 | 71 |
72 // TODO(johnme): If push becomes enabled in incognito (and this still uses a | 72 // TODO(johnme): If push becomes enabled in incognito (and this still uses a |
73 // pref), be careful that this pref is read from the right profile, as prefs | 73 // pref), be careful that this pref is read from the right profile, as prefs |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 } | 479 } |
480 | 480 |
481 void PushMessagingServiceImpl::AddAppHandlerIfNecessary() { | 481 void PushMessagingServiceImpl::AddAppHandlerIfNecessary() { |
482 if (gcm_profile_service_->driver()->GetAppHandler( | 482 if (gcm_profile_service_->driver()->GetAppHandler( |
483 kPushMessagingApplicationIdPrefix) != this) | 483 kPushMessagingApplicationIdPrefix) != this) |
484 gcm_profile_service_->driver()->AddAppHandler( | 484 gcm_profile_service_->driver()->AddAppHandler( |
485 kPushMessagingApplicationIdPrefix, this); | 485 kPushMessagingApplicationIdPrefix, this); |
486 } | 486 } |
487 | 487 |
488 } // namespace gcm | 488 } // namespace gcm |
OLD | NEW |