Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1712)

Unified Diff: chrome/browser/web_resource/promo_resource_service.h

Issue 8851007: WIP / Do not commit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/web_resource/promo_resource_service.h
diff --git a/chrome/browser/web_resource/promo_resource_service.h b/chrome/browser/web_resource/promo_resource_service.h
index 67f10607b287c93ee9a969f85792fbe984b824bf..b50c2f41c0c8ceac2f85a79c400cffddfc693d81 100644
--- a/chrome/browser/web_resource/promo_resource_service.h
+++ b/chrome/browser/web_resource/promo_resource_service.h
@@ -8,12 +8,13 @@
#include <string>
+#include "base/memory/weak_ptr.h"
#include "chrome/browser/web_resource/notification_promo.h"
#include "chrome/browser/web_resource/web_resource_service.h"
#include "chrome/common/chrome_version_info.h"
namespace base {
- class DictionaryValue;
+class DictionaryValue;
}
class AppsPromoLogoFetcher;
@@ -81,8 +82,6 @@ class PromoResourceService
// so we can fetch new data if the locale changes.
std::string GetPromoLocale();
- void Init();
-
// Returns true if |builds_targeted| includes the release channel Chrome
// belongs to. For testing purposes, you can override the current channel
// with set_channel.
@@ -98,6 +97,14 @@ class PromoResourceService
// if the promo service or Chrome locale has changed.
void ScheduleNotificationOnInit();
+ // If delay_ms is positive, schedule notification with the delay.
+ // If delay_ms is 0, notify immediately by calling WebResourceStateChange().
+ // If delay_ms is negative, do nothing.
+ void PostNotification(int64 delay_ms);
+
+ // Notify listeners that the state of a web resource has changed.
+ void PromoResourceStateChange();
+
// Overrides the current Chrome release channel for testing purposes.
void set_channel(chrome::VersionInfo::Channel channel) { channel_ = channel; }
@@ -239,6 +246,18 @@ class PromoResourceService
// Overrides the current Chrome release channel for testing purposes.
chrome::VersionInfo::Channel channel_;
+ // Allows the creation of tasks to send a notification.
+ // This allows the PromoResourceService to notify the New Tab Page immediately
+ // when a new web resource should be shown or removed.
+ base::WeakPtrFactory<PromoResourceService> weak_ptr_factory_;
+
+ // Notification type when an update is done.
+ int notification_type_;
+
+ // True if a task has been set to update the cache when a new web resource
+ // becomes available.
+ bool web_resource_update_scheduled_;
+
// A helper that downloads the promo logo.
scoped_ptr<AppsPromoLogoFetcher> apps_promo_logo_fetcher_;
« no previous file with comments | « chrome/browser/ui/webui/tab_modal_dialog_ui.cc ('k') | chrome/browser/web_resource/promo_resource_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698