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_NEW_TAB_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 // Returns a pointer to a NewTabUI if the WebUIController object is a new tab | 58 // Returns a pointer to a NewTabUI if the WebUIController object is a new tab |
59 // page. | 59 // page. |
60 static NewTabUI* FromWebUIController(content::WebUIController* ui); | 60 static NewTabUI* FromWebUIController(content::WebUIController* ui); |
61 | 61 |
62 // The current preference version. | 62 // The current preference version. |
63 static int current_pref_version() { return current_pref_version_; } | 63 static int current_pref_version() { return current_pref_version_; } |
64 | 64 |
65 // WebUIController implementation: | 65 // WebUIController implementation: |
66 virtual void RenderViewCreated( | 66 virtual void RenderViewCreated( |
67 content::RenderViewHost* render_view_host) OVERRIDE; | 67 content::RenderViewHost* render_view_host) override; |
68 virtual void RenderViewReused( | 68 virtual void RenderViewReused( |
69 content::RenderViewHost* render_view_host) OVERRIDE; | 69 content::RenderViewHost* render_view_host) override; |
70 | 70 |
71 // WebContentsObserver implementation: | 71 // WebContentsObserver implementation: |
72 virtual void WasHidden() OVERRIDE; | 72 virtual void WasHidden() override; |
73 | 73 |
74 bool showing_sync_bubble() { return showing_sync_bubble_; } | 74 bool showing_sync_bubble() { return showing_sync_bubble_; } |
75 void set_showing_sync_bubble(bool showing) { showing_sync_bubble_ = showing; } | 75 void set_showing_sync_bubble(bool showing) { showing_sync_bubble_ = showing; } |
76 | 76 |
77 class NewTabHTMLSource : public content::URLDataSource { | 77 class NewTabHTMLSource : public content::URLDataSource { |
78 public: | 78 public: |
79 explicit NewTabHTMLSource(Profile* profile); | 79 explicit NewTabHTMLSource(Profile* profile); |
80 virtual ~NewTabHTMLSource(); | 80 virtual ~NewTabHTMLSource(); |
81 | 81 |
82 // content::URLDataSource implementation. | 82 // content::URLDataSource implementation. |
83 virtual std::string GetSource() const OVERRIDE; | 83 virtual std::string GetSource() const override; |
84 virtual void StartDataRequest( | 84 virtual void StartDataRequest( |
85 const std::string& path, | 85 const std::string& path, |
86 int render_process_id, | 86 int render_process_id, |
87 int render_frame_id, | 87 int render_frame_id, |
88 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; | 88 const content::URLDataSource::GotDataCallback& callback) override; |
89 virtual std::string GetMimeType(const std::string&) const OVERRIDE; | 89 virtual std::string GetMimeType(const std::string&) const override; |
90 virtual bool ShouldReplaceExistingSource() const OVERRIDE; | 90 virtual bool ShouldReplaceExistingSource() const override; |
91 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE; | 91 virtual bool ShouldAddContentSecurityPolicy() const override; |
92 | 92 |
93 // Adds |resource| to the source. |resource_id| is resource id or 0, | 93 // Adds |resource| to the source. |resource_id| is resource id or 0, |
94 // which means return empty data set. |mime_type| is mime type of the | 94 // which means return empty data set. |mime_type| is mime type of the |
95 // resource. | 95 // resource. |
96 void AddResource(const char* resource, | 96 void AddResource(const char* resource, |
97 const char* mime_type, | 97 const char* mime_type, |
98 int resource_id); | 98 int resource_id); |
99 | 99 |
100 private: | 100 private: |
101 // Pointer back to the original profile. | 101 // Pointer back to the original profile. |
102 Profile* profile_; | 102 Profile* profile_; |
103 | 103 |
104 // Maps resource files to mime types an resource ids. | 104 // Maps resource files to mime types an resource ids. |
105 std::map<std::string, std::pair<std::string, int> > resource_map_; | 105 std::map<std::string, std::pair<std::string, int> > resource_map_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource); | 107 DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource); |
108 }; | 108 }; |
109 | 109 |
110 private: | 110 private: |
111 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion); | 111 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion); |
112 | 112 |
113 // content::NotificationObserver implementation. | 113 // content::NotificationObserver implementation. |
114 virtual void Observe(int type, | 114 virtual void Observe(int type, |
115 const content::NotificationSource& source, | 115 const content::NotificationSource& source, |
116 const content::NotificationDetails& details) OVERRIDE; | 116 const content::NotificationDetails& details) override; |
117 | 117 |
118 // If |web_contents| has an NTP URL, emits a number of NTP statistics (like | 118 // If |web_contents| has an NTP URL, emits a number of NTP statistics (like |
119 // mouseovers counts) associated with |web_contents|, to be logged in UMA | 119 // mouseovers counts) associated with |web_contents|, to be logged in UMA |
120 // histograms. | 120 // histograms. |
121 void EmitNtpStatistics(); | 121 void EmitNtpStatistics(); |
122 | 122 |
123 void OnShowBookmarkBarChanged(); | 123 void OnShowBookmarkBarChanged(); |
124 | 124 |
125 void StartTimingPaint(content::RenderViewHost* render_view_host); | 125 void StartTimingPaint(content::RenderViewHost* render_view_host); |
126 void PaintTimeout(); | 126 void PaintTimeout(); |
(...skipping 13 matching lines...) Expand all Loading... |
140 | 140 |
141 // If the sync promo NTP bubble is being shown. | 141 // If the sync promo NTP bubble is being shown. |
142 bool showing_sync_bubble_; | 142 bool showing_sync_bubble_; |
143 | 143 |
144 PrefChangeRegistrar pref_change_registrar_; | 144 PrefChangeRegistrar pref_change_registrar_; |
145 | 145 |
146 DISALLOW_COPY_AND_ASSIGN(NewTabUI); | 146 DISALLOW_COPY_AND_ASSIGN(NewTabUI); |
147 }; | 147 }; |
148 | 148 |
149 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ | 149 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ |
OLD | NEW |