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 <map> | |
9 #include <string> | |
10 | |
11 #include "base/macros.h" | 8 #include "base/macros.h" |
12 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
13 #include "components/prefs/pref_change_registrar.h" | 10 #include "components/prefs/pref_change_registrar.h" |
14 #include "content/public/browser/url_data_source.h" | 11 #include "content/public/browser/url_data_source.h" |
15 #include "content/public/browser/web_ui_controller.h" | 12 #include "content/public/browser/web_ui_controller.h" |
16 | 13 |
17 class GURL; | 14 class GURL; |
18 class Profile; | 15 class Profile; |
19 | 16 |
20 namespace base { | 17 namespace base { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 const std::string& path, | 62 const std::string& path, |
66 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, | 63 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, |
67 const content::URLDataSource::GotDataCallback& callback) override; | 64 const content::URLDataSource::GotDataCallback& callback) override; |
68 std::string GetMimeType(const std::string&) const override; | 65 std::string GetMimeType(const std::string&) const override; |
69 bool ShouldReplaceExistingSource() const override; | 66 bool ShouldReplaceExistingSource() const override; |
70 std::string GetContentSecurityPolicyScriptSrc() const override; | 67 std::string GetContentSecurityPolicyScriptSrc() const override; |
71 std::string GetContentSecurityPolicyStyleSrc() const override; | 68 std::string GetContentSecurityPolicyStyleSrc() const override; |
72 std::string GetContentSecurityPolicyImgSrc() const override; | 69 std::string GetContentSecurityPolicyImgSrc() const override; |
73 std::string GetContentSecurityPolicyChildSrc() const override; | 70 std::string GetContentSecurityPolicyChildSrc() const override; |
74 | 71 |
75 // Adds |resource| to the source. |resource_id| is resource id or 0, | |
76 // which means return empty data set. |mime_type| is mime type of the | |
77 // resource. | |
78 void AddResource(const char* resource, | |
79 const char* mime_type, | |
80 int resource_id); | |
81 | |
82 private: | 72 private: |
83 // Pointer back to the original profile. | 73 // Pointer back to the original profile. |
84 Profile* profile_; | 74 Profile* profile_; |
85 | 75 |
86 // Maps resource files to mime types an resource ids. | |
87 std::map<std::string, std::pair<std::string, int> > resource_map_; | |
88 | |
89 DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource); | 76 DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource); |
90 }; | 77 }; |
91 | 78 |
92 void OnShowBookmarkBarChanged(); | 79 void OnShowBookmarkBarChanged(); |
93 | 80 |
94 Profile* GetProfile() const; | 81 Profile* GetProfile() const; |
95 | 82 |
96 PrefChangeRegistrar pref_change_registrar_; | 83 PrefChangeRegistrar pref_change_registrar_; |
97 | 84 |
98 DISALLOW_COPY_AND_ASSIGN(NewTabUI); | 85 DISALLOW_COPY_AND_ASSIGN(NewTabUI); |
99 }; | 86 }; |
100 | 87 |
101 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ | 88 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ |
OLD | NEW |