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

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

Issue 7397021: Re-land r93365 - add RefCountedString (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 9 years, 5 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 "chrome/browser/prefs/pref_change_registrar.h" 11 #include "chrome/browser/prefs/pref_change_registrar.h"
12 #include "chrome/browser/profiles/profile_keyed_service.h" 12 #include "chrome/browser/profiles/profile_keyed_service.h"
13 #include "content/common/notification_observer.h" 13 #include "content/common/notification_observer.h"
14 #include "content/common/notification_registrar.h" 14 #include "content/common/notification_registrar.h"
15 15
16 class Profile; 16 class Profile;
17 class RefCountedBytes; 17 class RefCountedMemory;
18 18
19 // This class keeps a cache of NTP resources (HTML and CSS) so we don't have to 19 // This class keeps a cache of NTP resources (HTML and CSS) so we don't have to
20 // regenerate them all the time. 20 // regenerate them all the time.
21 class NTPResourceCache : public NotificationObserver, 21 class NTPResourceCache : public NotificationObserver,
22 public ProfileKeyedService { 22 public ProfileKeyedService {
23 public: 23 public:
24 explicit NTPResourceCache(Profile* profile); 24 explicit NTPResourceCache(Profile* profile);
25 virtual ~NTPResourceCache(); 25 virtual ~NTPResourceCache();
26 26
27 RefCountedBytes* GetNewTabHTML(bool is_incognito); 27 RefCountedMemory* GetNewTabHTML(bool is_incognito);
28 RefCountedBytes* GetNewTabCSS(bool is_incognito); 28 RefCountedMemory* GetNewTabCSS(bool is_incognito);
29 29
30 // NotificationObserver interface. 30 // NotificationObserver interface.
31 virtual void Observe(int type, 31 virtual void Observe(int type,
32 const NotificationSource& source, 32 const NotificationSource& source,
33 const NotificationDetails& details); 33 const NotificationDetails& details);
34 34
35 private: 35 private:
36 Profile* profile_; 36 Profile* profile_;
37 37
38 void CreateNewTabIncognitoHTML(); 38 void CreateNewTabIncognitoHTML();
39 scoped_refptr<RefCountedBytes> new_tab_incognito_html_; 39 scoped_refptr<RefCountedMemory> new_tab_incognito_html_;
40 void CreateNewTabHTML(); 40 void CreateNewTabHTML();
41 scoped_refptr<RefCountedBytes> new_tab_html_; 41 scoped_refptr<RefCountedMemory> new_tab_html_;
42 42
43 void CreateNewTabIncognitoCSS(); 43 void CreateNewTabIncognitoCSS();
44 scoped_refptr<RefCountedBytes> new_tab_incognito_css_; 44 scoped_refptr<RefCountedMemory> new_tab_incognito_css_;
45 void CreateNewTabCSS(); 45 void CreateNewTabCSS();
46 scoped_refptr<RefCountedBytes> new_tab_css_; 46 scoped_refptr<RefCountedMemory> new_tab_css_;
47 47
48 NotificationRegistrar registrar_; 48 NotificationRegistrar registrar_;
49 PrefChangeRegistrar pref_change_registrar_; 49 PrefChangeRegistrar pref_change_registrar_;
50 50
51 DISALLOW_COPY_AND_ASSIGN(NTPResourceCache); 51 DISALLOW_COPY_AND_ASSIGN(NTPResourceCache);
52 }; 52 };
53 53
54 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_RESOURCE_CACHE_H_ 54 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_RESOURCE_CACHE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui.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