OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/web_resource/promo_resource_service.h" | 5 #include "chrome/browser/web_resource/promo_resource_service.h" |
6 | 6 |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 case platform_util::CHANNEL_BETA: | 105 case platform_util::CHANNEL_BETA: |
106 return (BETA_BUILD & builds_allowed) != 0; | 106 return (BETA_BUILD & builds_allowed) != 0; |
107 case platform_util::CHANNEL_STABLE: | 107 case platform_util::CHANNEL_STABLE: |
108 return (STABLE_BUILD & builds_allowed) != 0; | 108 return (STABLE_BUILD & builds_allowed) != 0; |
109 default: | 109 default: |
110 return false; | 110 return false; |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 PromoResourceService::PromoResourceService(Profile* profile) | 114 PromoResourceService::PromoResourceService(Profile* profile) |
115 : WebResourceService(profile, | 115 : WebResourceService(profile->GetPrefs(), |
116 profile->GetPrefs(), | |
117 PromoResourceService::kDefaultPromoResourceServer, | 116 PromoResourceService::kDefaultPromoResourceServer, |
118 true, // append locale to URL | 117 true, // append locale to URL |
119 NotificationType::PROMO_RESOURCE_STATE_CHANGED, | 118 NotificationType::PROMO_RESOURCE_STATE_CHANGED, |
120 prefs::kNTPPromoResourceCacheUpdate, | 119 prefs::kNTPPromoResourceCacheUpdate, |
121 kStartResourceFetchDelay, | 120 kStartResourceFetchDelay, |
122 kCacheUpdateDelay), | 121 kCacheUpdateDelay), |
123 web_resource_cache_(NULL), | 122 web_resource_cache_(NULL), |
124 channel_(platform_util::CHANNEL_UNKNOWN) { | 123 channel_(platform_util::CHANNEL_UNKNOWN) { |
125 Init(); | 124 Init(); |
126 } | 125 } |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 base::ThreadRestrictions::ScopedAllowIO allow_io; | 476 base::ThreadRestrictions::ScopedAllowIO allow_io; |
478 platform_util::Channel channel = platform_util::GetChannel(); | 477 platform_util::Channel channel = platform_util::GetChannel(); |
479 is_promo_build = PromoResourceService::IsBuildTargeted( | 478 is_promo_build = PromoResourceService::IsBuildTargeted( |
480 channel, prefs->GetInteger(prefs::kNTPPromoBuild)); | 479 channel, prefs->GetInteger(prefs::kNTPPromoBuild)); |
481 } | 480 } |
482 | 481 |
483 return !promo_closed && !is_synced && is_promo_build; | 482 return !promo_closed && !is_synced && is_promo_build; |
484 } | 483 } |
485 | 484 |
486 } // namespace PromoResourceServiceUtil | 485 } // namespace PromoResourceServiceUtil |
OLD | NEW |