[email protected] | a353643 | 2013-03-26 08:14:31 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef CHROME_BROWSER_SEARCH_LOCAL_NTP_SOURCE_H_ | ||||
6 | #define CHROME_BROWSER_SEARCH_LOCAL_NTP_SOURCE_H_ | ||||
7 | |||||
[email protected] | a353643 | 2013-03-26 08:14:31 | [diff] [blame] | 8 | #include "base/compiler_specific.h" |
avi | b896c71 | 2015-12-26 02:10:43 | [diff] [blame^] | 9 | #include "base/macros.h" |
[email protected] | a353643 | 2013-03-26 08:14:31 | [diff] [blame] | 10 | #include "content/public/browser/url_data_source.h" |
11 | |||||
[email protected] | 5df96ab | 2013-07-17 23:14:48 | [diff] [blame] | 12 | class Profile; |
13 | |||||
[email protected] | a353643 | 2013-03-26 08:14:31 | [diff] [blame] | 14 | // Serves HTML and resources for the local new tab page i.e. |
15 | // chrome-search://local-ntp/local-ntp.html | ||||
16 | class LocalNtpSource : public content::URLDataSource { | ||||
17 | public: | ||||
[email protected] | 5df96ab | 2013-07-17 23:14:48 | [diff] [blame] | 18 | explicit LocalNtpSource(Profile* profile); |
[email protected] | a353643 | 2013-03-26 08:14:31 | [diff] [blame] | 19 | |
20 | private: | ||||
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 21 | ~LocalNtpSource() override; |
[email protected] | a353643 | 2013-03-26 08:14:31 | [diff] [blame] | 22 | |
23 | // Overridden from content::URLDataSource: | ||||
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 24 | std::string GetSource() const override; |
25 | void StartDataRequest( | ||||
[email protected] | a353643 | 2013-03-26 08:14:31 | [diff] [blame] | 26 | const std::string& path, |
[email protected] | e671c27 | 2013-04-23 22:45:03 | [diff] [blame] | 27 | int render_process_id, |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 28 | int render_frame_id, |
mostynb | fb66cb4f | 2014-10-07 09:15:42 | [diff] [blame] | 29 | const content::URLDataSource::GotDataCallback& callback) override; |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 30 | std::string GetMimeType(const std::string& path) const override; |
31 | bool ShouldServiceRequest(const net::URLRequest* request) const override; | ||||
32 | std::string GetContentSecurityPolicyFrameSrc() const override; | ||||
[email protected] | a353643 | 2013-03-26 08:14:31 | [diff] [blame] | 33 | |
[email protected] | 5df96ab | 2013-07-17 23:14:48 | [diff] [blame] | 34 | Profile* profile_; |
35 | |||||
[email protected] | a353643 | 2013-03-26 08:14:31 | [diff] [blame] | 36 | DISALLOW_COPY_AND_ASSIGN(LocalNtpSource); |
37 | }; | ||||
38 | |||||
39 | #endif // CHROME_BROWSER_SEARCH_LOCAL_NTP_SOURCE_H_ |