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

Side by Side Diff: chrome/browser/ui/webui/ntp/ntp_resource_cache.h

Issue 7481023: Adding notifications for new sync types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk. Created 9 years, 4 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_NTP_RESOURCE_CACHE_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_NTP_RESOURCE_CACHE_H_
6 #define CHROME_BROWSER_UI_WEBUI_NTP_NTP_RESOURCE_CACHE_H_ 6 #define CHROME_BROWSER_UI_WEBUI_NTP_NTP_RESOURCE_CACHE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/string16.h"
11 #include "chrome/browser/prefs/pref_change_registrar.h" 12 #include "chrome/browser/prefs/pref_change_registrar.h"
12 #include "chrome/browser/profiles/profile_keyed_service.h" 13 #include "chrome/browser/profiles/profile_keyed_service.h"
13 #include "content/common/notification_observer.h" 14 #include "content/common/notification_observer.h"
14 #include "content/common/notification_registrar.h" 15 #include "content/common/notification_registrar.h"
15 16
16 class Profile; 17 class Profile;
17 class RefCountedMemory; 18 class RefCountedMemory;
18 19
19 // This class keeps a cache of NTP resources (HTML and CSS) so we don't have to 20 // This class keeps a cache of NTP resources (HTML and CSS) so we don't have to
20 // regenerate them all the time. 21 // regenerate them all the time.
21 class NTPResourceCache : public NotificationObserver, 22 class NTPResourceCache : public NotificationObserver,
22 public ProfileKeyedService { 23 public ProfileKeyedService {
23 public: 24 public:
24 explicit NTPResourceCache(Profile* profile); 25 explicit NTPResourceCache(Profile* profile);
25 virtual ~NTPResourceCache(); 26 virtual ~NTPResourceCache();
26 27
27 RefCountedMemory* GetNewTabHTML(bool is_incognito); 28 RefCountedMemory* GetNewTabHTML(bool is_incognito);
28 RefCountedMemory* GetNewTabCSS(bool is_incognito); 29 RefCountedMemory* GetNewTabCSS(bool is_incognito);
29 30
30 // NotificationObserver interface. 31 // NotificationObserver interface.
31 virtual void Observe(int type, 32 virtual void Observe(int type,
32 const NotificationSource& source, 33 const NotificationSource& source,
33 const NotificationDetails& details); 34 const NotificationDetails& details);
34 35
35 private: 36 private:
36 Profile* profile_; 37 Profile* profile_;
37 38
39 // Returns a message describing any newly-added sync types, or an empty
40 // string if all types have already been acknowledged.
41 string16 GetSyncTypeMessage();
42
38 void CreateNewTabIncognitoHTML(); 43 void CreateNewTabIncognitoHTML();
39 scoped_refptr<RefCountedMemory> new_tab_incognito_html_; 44 scoped_refptr<RefCountedMemory> new_tab_incognito_html_;
40 void CreateNewTabHTML(); 45 void CreateNewTabHTML();
41 scoped_refptr<RefCountedMemory> new_tab_html_; 46 scoped_refptr<RefCountedMemory> new_tab_html_;
42 47
43 void CreateNewTabIncognitoCSS(); 48 void CreateNewTabIncognitoCSS();
44 scoped_refptr<RefCountedMemory> new_tab_incognito_css_; 49 scoped_refptr<RefCountedMemory> new_tab_incognito_css_;
45 void CreateNewTabCSS(); 50 void CreateNewTabCSS();
46 scoped_refptr<RefCountedMemory> new_tab_css_; 51 scoped_refptr<RefCountedMemory> new_tab_css_;
47 52
48 NotificationRegistrar registrar_; 53 NotificationRegistrar registrar_;
49 PrefChangeRegistrar pref_change_registrar_; 54 PrefChangeRegistrar pref_change_registrar_;
50 55
51 DISALLOW_COPY_AND_ASSIGN(NTPResourceCache); 56 DISALLOW_COPY_AND_ASSIGN(NTPResourceCache);
52 }; 57 };
53 58
54 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_RESOURCE_CACHE_H_ 59 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_RESOURCE_CACHE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698