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

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

Issue 7248038: Profiles: Make NTPResourceCache a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add files 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 "content/common/notification_observer.h" 13 #include "content/common/notification_observer.h"
13 #include "content/common/notification_registrar.h" 14 #include "content/common/notification_registrar.h"
14 15
15 class Profile; 16 class Profile;
16 class RefCountedBytes; 17 class RefCountedBytes;
17 18
18 // 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
19 // regenerate them all the time. 20 // regenerate them all the time.
20 class NTPResourceCache : public NotificationObserver { 21 class NTPResourceCache : public NotificationObserver,
22 public ProfileKeyedService {
21 public: 23 public:
22 explicit NTPResourceCache(Profile* profile); 24 explicit NTPResourceCache(Profile* profile);
23 virtual ~NTPResourceCache(); 25 virtual ~NTPResourceCache();
24 26
25 RefCountedBytes* GetNewTabHTML(bool is_incognito); 27 RefCountedBytes* GetNewTabHTML(bool is_incognito);
26 RefCountedBytes* GetNewTabCSS(bool is_incognito); 28 RefCountedBytes* GetNewTabCSS(bool is_incognito);
27 29
28 // NotificationObserver interface. 30 // NotificationObserver interface.
29 virtual void Observe(NotificationType type, 31 virtual void Observe(NotificationType type,
30 const NotificationSource& source, 32 const NotificationSource& source,
(...skipping 12 matching lines...) Expand all
43 void CreateNewTabCSS(); 45 void CreateNewTabCSS();
44 scoped_refptr<RefCountedBytes> new_tab_css_; 46 scoped_refptr<RefCountedBytes> new_tab_css_;
45 47
46 NotificationRegistrar registrar_; 48 NotificationRegistrar registrar_;
47 PrefChangeRegistrar pref_change_registrar_; 49 PrefChangeRegistrar pref_change_registrar_;
48 50
49 DISALLOW_COPY_AND_ASSIGN(NTPResourceCache); 51 DISALLOW_COPY_AND_ASSIGN(NTPResourceCache);
50 }; 52 };
51 53
52 #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_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698