OLD | NEW |
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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 class NTPResourceCache : public content::NotificationObserver, | 29 class NTPResourceCache : public content::NotificationObserver, |
30 public KeyedService { | 30 public KeyedService { |
31 public: | 31 public: |
32 enum WindowType { | 32 enum WindowType { |
33 NORMAL, | 33 NORMAL, |
34 INCOGNITO, | 34 INCOGNITO, |
35 GUEST, | 35 GUEST, |
36 }; | 36 }; |
37 | 37 |
38 explicit NTPResourceCache(Profile* profile); | 38 explicit NTPResourceCache(Profile* profile); |
39 virtual ~NTPResourceCache(); | 39 ~NTPResourceCache() override; |
40 | 40 |
41 base::RefCountedMemory* GetNewTabHTML(WindowType win_type); | 41 base::RefCountedMemory* GetNewTabHTML(WindowType win_type); |
42 base::RefCountedMemory* GetNewTabCSS(WindowType win_type); | 42 base::RefCountedMemory* GetNewTabCSS(WindowType win_type); |
43 | 43 |
44 void set_should_show_apps_page(bool should_show_apps_page) { | 44 void set_should_show_apps_page(bool should_show_apps_page) { |
45 should_show_apps_page_ = should_show_apps_page; | 45 should_show_apps_page_ = should_show_apps_page; |
46 } | 46 } |
47 void set_should_show_most_visited_page(bool should_show_most_visited_page) { | 47 void set_should_show_most_visited_page(bool should_show_most_visited_page) { |
48 should_show_most_visited_page_ = should_show_most_visited_page; | 48 should_show_most_visited_page_ = should_show_most_visited_page; |
49 } | 49 } |
50 void set_should_show_other_devices_menu(bool should_show_other_devices_menu) { | 50 void set_should_show_other_devices_menu(bool should_show_other_devices_menu) { |
51 should_show_other_devices_menu_ = should_show_other_devices_menu; | 51 should_show_other_devices_menu_ = should_show_other_devices_menu; |
52 } | 52 } |
53 void set_should_show_recently_closed_menu( | 53 void set_should_show_recently_closed_menu( |
54 bool should_show_recently_closed_menu) { | 54 bool should_show_recently_closed_menu) { |
55 should_show_recently_closed_menu_ = should_show_recently_closed_menu; | 55 should_show_recently_closed_menu_ = should_show_recently_closed_menu; |
56 } | 56 } |
57 // content::NotificationObserver interface. | 57 // content::NotificationObserver interface. |
58 virtual void Observe(int type, | 58 void Observe(int type, |
59 const content::NotificationSource& source, | 59 const content::NotificationSource& source, |
60 const content::NotificationDetails& details) override; | 60 const content::NotificationDetails& details) override; |
61 | 61 |
62 static WindowType GetWindowType( | 62 static WindowType GetWindowType( |
63 Profile* profile, content::RenderProcessHost* render_host); | 63 Profile* profile, content::RenderProcessHost* render_host); |
64 | 64 |
65 private: | 65 private: |
66 void OnPreferenceChanged(); | 66 void OnPreferenceChanged(); |
67 | 67 |
68 void CreateNewTabHTML(); | 68 void CreateNewTabHTML(); |
69 | 69 |
70 // Helper to determine if the resource cache should be invalidated. | 70 // Helper to determine if the resource cache should be invalidated. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // The next three all default to true and can be manually set, e.g., by the | 104 // The next three all default to true and can be manually set, e.g., by the |
105 // chrome://apps page. | 105 // chrome://apps page. |
106 bool should_show_most_visited_page_; | 106 bool should_show_most_visited_page_; |
107 bool should_show_other_devices_menu_; | 107 bool should_show_other_devices_menu_; |
108 bool should_show_recently_closed_menu_; | 108 bool should_show_recently_closed_menu_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(NTPResourceCache); | 110 DISALLOW_COPY_AND_ASSIGN(NTPResourceCache); |
111 }; | 111 }; |
112 | 112 |
113 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_RESOURCE_CACHE_H_ | 113 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_RESOURCE_CACHE_H_ |
OLD | NEW |