| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DOM_UI_NTP_RESOURCE_CACHE_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_NTP_RESOURCE_CACHE_H_ |
| 6 #define CHROME_BROWSER_DOM_UI_NTP_RESOURCE_CACHE_H_ | 6 #define CHROME_BROWSER_DOM_UI_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/ref_counted.h" | 10 #include "base/ref_counted.h" |
| 11 #include "chrome/common/notification_observer.h" | 11 #include "chrome/common/notification_observer.h" |
| 12 #include "chrome/common/notification_registrar.h" | 12 #include "chrome/common/notification_registrar.h" |
| 13 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 13 | 14 |
| 14 class Profile; | 15 class Profile; |
| 15 class RefCountedBytes; | 16 class RefCountedBytes; |
| 16 | 17 |
| 17 // This class keeps a cache of NTP resources (HTML and CSS) so we don't have to | 18 // This class keeps a cache of NTP resources (HTML and CSS) so we don't have to |
| 18 // regenerate them all the time. | 19 // regenerate them all the time. |
| 19 class NTPResourceCache : public NotificationObserver { | 20 class NTPResourceCache : public NotificationObserver { |
| 20 public: | 21 public: |
| 21 explicit NTPResourceCache(Profile* profile); | 22 explicit NTPResourceCache(Profile* profile); |
| 22 virtual ~NTPResourceCache(); | 23 virtual ~NTPResourceCache() {} |
| 23 | 24 |
| 24 RefCountedBytes* GetNewTabHTML(bool is_off_the_record); | 25 RefCountedBytes* GetNewTabHTML(bool is_off_the_record); |
| 25 RefCountedBytes* GetNewTabCSS(bool is_off_the_record); | 26 RefCountedBytes* GetNewTabCSS(bool is_off_the_record); |
| 26 | 27 |
| 27 // NotificationObserver interface. | 28 // NotificationObserver interface. |
| 28 virtual void Observe(NotificationType type, | 29 virtual void Observe(NotificationType type, |
| 29 const NotificationSource& source, | 30 const NotificationSource& source, |
| 30 const NotificationDetails& details); | 31 const NotificationDetails& details); |
| 31 | 32 |
| 32 private: | 33 private: |
| 33 Profile* profile_; | 34 Profile* profile_; |
| 34 | 35 |
| 35 void CreateNewTabIncognitoHTML(); | 36 void CreateNewTabIncognitoHTML(); |
| 36 scoped_refptr<RefCountedBytes> new_tab_incognito_html_; | 37 scoped_refptr<RefCountedBytes> new_tab_incognito_html_; |
| 37 void CreateNewTabHTML(); | 38 void CreateNewTabHTML(); |
| 38 scoped_refptr<RefCountedBytes> new_tab_html_; | 39 scoped_refptr<RefCountedBytes> new_tab_html_; |
| 39 | 40 |
| 40 void CreateNewTabIncognitoCSS(); | 41 void CreateNewTabIncognitoCSS(); |
| 41 scoped_refptr<RefCountedBytes> new_tab_incognito_css_; | 42 scoped_refptr<RefCountedBytes> new_tab_incognito_css_; |
| 42 void CreateNewTabCSS(); | 43 void CreateNewTabCSS(); |
| 43 scoped_refptr<RefCountedBytes> new_tab_css_; | 44 scoped_refptr<RefCountedBytes> new_tab_css_; |
| 44 | 45 |
| 45 NotificationRegistrar registrar_; | 46 NotificationRegistrar registrar_; |
| 47 PrefChangeRegistrar pref_change_registrar_; |
| 46 | 48 |
| 47 DISALLOW_COPY_AND_ASSIGN(NTPResourceCache); | 49 DISALLOW_COPY_AND_ASSIGN(NTPResourceCache); |
| 48 }; | 50 }; |
| 49 | 51 |
| 50 #endif // CHROME_BROWSER_DOM_UI_NTP_RESOURCE_CACHE_H_ | 52 #endif // CHROME_BROWSER_DOM_UI_NTP_RESOURCE_CACHE_H_ |
| OLD | NEW |