blob: 1b987d2fe0cc8df822b942581a560c3be3ca785d [file] [log] [blame]
[email protected]a3536432013-03-26 08:14:311// 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
8#include "base/basictypes.h"
9#include "base/compiler_specific.h"
10#include "content/public/browser/url_data_source.h"
11
[email protected]5df96ab2013-07-17 23:14:4812class Profile;
13
[email protected]a3536432013-03-26 08:14:3114// Serves HTML and resources for the local new tab page i.e.
15// chrome-search://local-ntp/local-ntp.html
16class LocalNtpSource : public content::URLDataSource {
17 public:
[email protected]5df96ab2013-07-17 23:14:4818 explicit LocalNtpSource(Profile* profile);
[email protected]a3536432013-03-26 08:14:3119
20 private:
Daniel Chenga542fca2014-10-21 09:51:2921 ~LocalNtpSource() override;
[email protected]a3536432013-03-26 08:14:3122
23 // Overridden from content::URLDataSource:
Daniel Chenga542fca2014-10-21 09:51:2924 std::string GetSource() const override;
25 void StartDataRequest(
[email protected]a3536432013-03-26 08:14:3126 const std::string& path,
[email protected]e671c272013-04-23 22:45:0327 int render_process_id,
[email protected]f3add922013-12-20 23:17:1628 int render_frame_id,
mostynbfb66cb4f2014-10-07 09:15:4229 const content::URLDataSource::GotDataCallback& callback) override;
Daniel Chenga542fca2014-10-21 09:51:2930 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]a3536432013-03-26 08:14:3133
[email protected]2b8290d2014-08-02 00:29:3634 // Sends a local resource with a specific |class_name| substituted.
35 void SendResourceWithClass(
36 int resource_id,
37 const std::string& class_name,
38 const content::URLDataSource::GotDataCallback& callback);
39
[email protected]5df96ab2013-07-17 23:14:4840 Profile* profile_;
41
[email protected]a3536432013-03-26 08:14:3142 DISALLOW_COPY_AND_ASSIGN(LocalNtpSource);
43};
44
45#endif // CHROME_BROWSER_SEARCH_LOCAL_NTP_SOURCE_H_