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 // Overridden from content::URLDataSource: |
| 20 virtual std::string GetSource() OVERRIDE; |
| 21 virtual void StartDataRequest( |
| 22 const std::string& path, |
| 23 bool is_incognito, |
| 24 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; |
| 25 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; |
| 26 virtual bool ShouldDenyXFrameOptions() const OVERRIDE; |
| 27 virtual bool ShouldServiceRequest( |
| 28 const net::URLRequest* request) const OVERRIDE; |
| 29 |
| 30 private: |
| 31 // Sends unmodified resource bytes. |
| 32 void SendResource( |
| 33 int resource_id, |
| 34 const content::URLDataSource::GotDataCallback& callback); |
| 35 |
| 36 // Sends Javascript with a parameter substituted. |
| 37 void SendJSWithOrigin( |
| 38 int resource_id, |
| 39 const std::string& path, |
| 40 const content::URLDataSource::GotDataCallback& callback); |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(SuggestionSource); |
| 43 }; |
| 44 |
| 45 #endif // CHROME_BROWSER_SEARCH_SUGGESTION_SOURCE_H_ |
OLD | NEW |