OLD | NEW |
(Empty) | |
| 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_SUGGESTION_SOURCE_H_ |
| 6 #define CHROME_BROWSER_SEARCH_SUGGESTION_SOURCE_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "content/public/browser/url_data_source.h" |
| 11 |
| 12 // Serves HTML for displaying suggestions using iframes, e.g. |
| 13 // chrome-search://suggestion/loader.html |
| 14 class SuggestionSource : public content::URLDataSource { |
| 15 public: |
| 16 SuggestionSource(); |
| 17 virtual ~SuggestionSource(); |
| 18 |
| 19 protected: |
| 20 virtual bool GetOrigin( |
| 21 int process_id, |
| 22 int render_view_id, |
| 23 std::string* origin) const; |
| 24 |
| 25 // Overridden from content::URLDataSource: |
| 26 virtual std::string GetSource() const OVERRIDE; |
| 27 virtual void StartDataRequest( |
| 28 const std::string& path_and_query, |
| 29 int render_process_id, |
| 30 int render_view_id, |
| 31 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; |
| 32 virtual std::string GetMimeType( |
| 33 const std::string& path_and_query) const OVERRIDE; |
| 34 virtual bool ShouldDenyXFrameOptions() const OVERRIDE; |
| 35 virtual bool ShouldServiceRequest( |
| 36 const net::URLRequest* request) const OVERRIDE; |
| 37 |
| 38 private: |
| 39 // Sends unmodified resource bytes. |
| 40 void SendResource( |
| 41 int resource_id, |
| 42 const content::URLDataSource::GotDataCallback& callback); |
| 43 |
| 44 // Sends Javascript with an expected postMessage origin interpolated. |
| 45 void SendJSWithOrigin( |
| 46 int resource_id, |
| 47 int render_process_id, |
| 48 int render_view_id, |
| 49 const content::URLDataSource::GotDataCallback& callback); |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(SuggestionSource); |
| 52 }; |
| 53 |
| 54 #endif // CHROME_BROWSER_SEARCH_SUGGESTION_SOURCE_H_ |
OLD | NEW |