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

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

Issue 10272004: Move RefCountedMemory class to base namespace. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 7 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) 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_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/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "chrome/browser/prefs/pref_change_registrar.h" 13 #include "chrome/browser/prefs/pref_change_registrar.h"
14 #include "chrome/browser/profiles/profile_keyed_service.h" 14 #include "chrome/browser/profiles/profile_keyed_service.h"
15 #include "content/public/browser/notification_observer.h" 15 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 16 #include "content/public/browser/notification_registrar.h"
17 17
18 class Profile; 18 class Profile;
19
20 namespace base {
19 class RefCountedMemory; 21 class RefCountedMemory;
22 }
20 23
21 // This class keeps a cache of NTP resources (HTML and CSS) so we don't have to 24 // This class keeps a cache of NTP resources (HTML and CSS) so we don't have to
22 // regenerate them all the time. 25 // regenerate them all the time.
23 class NTPResourceCache : public content::NotificationObserver, 26 class NTPResourceCache : public content::NotificationObserver,
24 public ProfileKeyedService { 27 public ProfileKeyedService {
25 public: 28 public:
26 explicit NTPResourceCache(Profile* profile); 29 explicit NTPResourceCache(Profile* profile);
27 virtual ~NTPResourceCache(); 30 virtual ~NTPResourceCache();
28 31
29 RefCountedMemory* GetNewTabHTML(bool is_incognito); 32 base::RefCountedMemory* GetNewTabHTML(bool is_incognito);
30 RefCountedMemory* GetNewTabCSS(bool is_incognito); 33 base::RefCountedMemory* GetNewTabCSS(bool is_incognito);
31 34
32 // content::NotificationObserver interface. 35 // content::NotificationObserver interface.
33 virtual void Observe(int type, 36 virtual void Observe(int type,
34 const content::NotificationSource& source, 37 const content::NotificationSource& source,
35 const content::NotificationDetails& details) OVERRIDE; 38 const content::NotificationDetails& details) OVERRIDE;
36 39
37 private: 40 private:
38 Profile* profile_; 41 Profile* profile_;
39 42
40 void CreateNewTabHTML(); 43 void CreateNewTabHTML();
41 scoped_refptr<RefCountedMemory> new_tab_html_; 44 scoped_refptr<base::RefCountedMemory> new_tab_html_;
42 45
43 // Helper to determine if the resource cache should be invalidated. 46 // Helper to determine if the resource cache should be invalidated.
44 // This is called on every page load, and can be used to check values that 47 // This is called on every page load, and can be used to check values that
45 // don't generate a notification when changed (e.g., system preferences). 48 // don't generate a notification when changed (e.g., system preferences).
46 bool NewTabCacheNeedsRefresh(); 49 bool NewTabCacheNeedsRefresh();
47 50
48 #if !defined(OS_ANDROID) 51 #if !defined(OS_ANDROID)
49 // Returns a message describing any newly-added sync types, or an empty 52 // Returns a message describing any newly-added sync types, or an empty
50 // string if all types have already been acknowledged. 53 // string if all types have already been acknowledged.
51 string16 GetSyncTypeMessage(); 54 string16 GetSyncTypeMessage();
52 55
53 void CreateNewTabIncognitoHTML(); 56 void CreateNewTabIncognitoHTML();
54 scoped_refptr<RefCountedMemory> new_tab_incognito_html_; 57 scoped_refptr<base::RefCountedMemory> new_tab_incognito_html_;
55 58
56 void CreateNewTabIncognitoCSS(); 59 void CreateNewTabIncognitoCSS();
57 scoped_refptr<RefCountedMemory> new_tab_incognito_css_; 60 scoped_refptr<base::RefCountedMemory> new_tab_incognito_css_;
58 void CreateNewTabCSS(); 61 void CreateNewTabCSS();
59 scoped_refptr<RefCountedMemory> new_tab_css_; 62 scoped_refptr<base::RefCountedMemory> new_tab_css_;
60 63
61 content::NotificationRegistrar registrar_; 64 content::NotificationRegistrar registrar_;
62 PrefChangeRegistrar pref_change_registrar_; 65 PrefChangeRegistrar pref_change_registrar_;
63 #endif 66 #endif
64 67
65 bool is_swipe_tracking_from_scroll_events_enabled_; 68 bool is_swipe_tracking_from_scroll_events_enabled_;
66 69
67 DISALLOW_COPY_AND_ASSIGN(NTPResourceCache); 70 DISALLOW_COPY_AND_ASSIGN(NTPResourceCache);
68 }; 71 };
69 72
70 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_RESOURCE_CACHE_H_ 73 #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