| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_WEB_RESOURCE_PROMO_RESOURCE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_WEB_RESOURCE_PROMO_RESOURCE_SERVICE_H_ |
| 6 #define CHROME_BROWSER_WEB_RESOURCE_PROMO_RESOURCE_SERVICE_H_ | 6 #define CHROME_BROWSER_WEB_RESOURCE_PROMO_RESOURCE_SERVICE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 void ScheduleNotificationOnInit(); | 54 void ScheduleNotificationOnInit(); |
| 55 | 55 |
| 56 // If delay_ms is positive, schedule notification with the delay. | 56 // If delay_ms is positive, schedule notification with the delay. |
| 57 // If delay_ms is 0, notify immediately by calling WebResourceStateChange(). | 57 // If delay_ms is 0, notify immediately by calling WebResourceStateChange(). |
| 58 // If delay_ms is negative, do nothing. | 58 // If delay_ms is negative, do nothing. |
| 59 void PostNotification(int64 delay_ms); | 59 void PostNotification(int64 delay_ms); |
| 60 | 60 |
| 61 // Notify listeners that the state of a web resource has changed. | 61 // Notify listeners that the state of a web resource has changed. |
| 62 void PromoResourceStateChange(); | 62 void PromoResourceStateChange(); |
| 63 | 63 |
| 64 // WebResourceService override. | 64 // WebResourceService override to process the parsed information. |
| 65 virtual void Unpack(const base::DictionaryValue& parsed_json) OVERRIDE; | 65 virtual void Unpack(const base::DictionaryValue& parsed_json) OVERRIDE; |
| 66 | 66 |
| 67 // The profile this service belongs to. | 67 // The profile this service belongs to. |
| 68 Profile* profile_; | 68 Profile* profile_; |
| 69 | 69 |
| 70 // Allows the creation of tasks to send a notification. | 70 // Allows the creation of tasks to send a notification. |
| 71 // This allows the PromoResourceService to notify the New Tab Page immediately | 71 // This allows the PromoResourceService to notify the New Tab Page immediately |
| 72 // when a new web resource should be shown or removed. | 72 // when a new web resource should be shown or removed. |
| 73 base::WeakPtrFactory<PromoResourceService> weak_ptr_factory_; | 73 base::WeakPtrFactory<PromoResourceService> weak_ptr_factory_; |
| 74 | 74 |
| 75 // Notification type when an update is done. | 75 // Notification type when an update is done. |
| 76 int notification_type_; | 76 int notification_type_; |
| 77 | 77 |
| 78 // True if a task has been set to update the cache when a new web resource | 78 // True if a task has been set to update the cache when a new web resource |
| 79 // becomes available. | 79 // becomes available. |
| 80 bool web_resource_update_scheduled_; | 80 bool web_resource_update_scheduled_; |
| 81 | 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(PromoResourceService); | 82 DISALLOW_COPY_AND_ASSIGN(PromoResourceService); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 #endif // CHROME_BROWSER_WEB_RESOURCE_PROMO_RESOURCE_SERVICE_H_ | 85 #endif // CHROME_BROWSER_WEB_RESOURCE_PROMO_RESOURCE_SERVICE_H_ |
| OLD | NEW |