Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / search / iframe_source.h
blob80beefc298f1ef32c5b21fbefd3c11bf29faccf3
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.
5 #ifndef CHROME_BROWSER_SEARCH_IFRAME_SOURCE_H_
6 #define CHROME_BROWSER_SEARCH_IFRAME_SOURCE_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "content/public/browser/url_data_source.h"
12 // Base class for URL data sources for chrome-search:// iframed content.
13 class IframeSource : public content::URLDataSource {
14 public:
15 IframeSource();
16 ~IframeSource() override;
18 protected:
19 // Overridden from content::URLDataSource:
20 std::string GetMimeType(const std::string& path_and_query) const override;
21 bool ShouldDenyXFrameOptions() const override;
22 bool ShouldServiceRequest(const net::URLRequest* request) const override;
24 // Returns whether this source should serve data for a particular path.
25 virtual bool ServesPath(const std::string& path) const = 0;
27 // Sends unmodified resource bytes.
28 void SendResource(
29 int resource_id,
30 const content::URLDataSource::GotDataCallback& callback);
32 // Sends Javascript with an expected postMessage origin interpolated.
33 void SendJSWithOrigin(
34 int resource_id,
35 int render_process_id,
36 int render_frame_id,
37 const content::URLDataSource::GotDataCallback& callback);
39 // This is exposed for testing and should not be overridden.
40 // Sets |origin| to the URL of the render frame identified by |process_id| and
41 // |render_frame_id|. Returns true if successful and false if not, for example
42 // if the render frame does not exist.
43 virtual bool GetOrigin(
44 int process_id,
45 int render_frame_id,
46 std::string* origin) const;
48 DISALLOW_COPY_AND_ASSIGN(IframeSource);
51 #endif // CHROME_BROWSER_SEARCH_IFRAME_SOURCE_H_