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 "base/gtest_prod_util.h" | |
11 #include "content/public/browser/url_data_source.h" | |
12 | |
13 // Serves HTML for displaying suggestions using iframes, e.g. | |
14 // chrome-search://suggestion/loader.html | |
15 class SuggestionSource : public content::URLDataSource { | |
16 public: | |
17 SuggestionSource(); | |
18 | |
19 virtual ~SuggestionSource(); | |
20 | |
21 private: | |
22 friend class SuggestionSourceTest; | |
23 FRIEND_TEST_ALL_PREFIXES(SuggestionSourceTest, ShouldServiceRequest); | |
24 FRIEND_TEST_ALL_PREFIXES(SuggestionSourceTest, GetMimeType); | |
25 FRIEND_TEST_ALL_PREFIXES(SuggestionSourceTest, StartDataRequest); | |
26 | |
27 // Overridden from content::URLDataSource: | |
28 virtual std::string GetSource() OVERRIDE; | |
29 virtual void StartDataRequest( | |
30 const std::string& path_and_query, | |
31 bool is_incognito, | |
32 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; | |
33 virtual std::string GetMimeType( | |
34 const std::string& path_and_query) const OVERRIDE; | |
35 virtual bool ShouldDenyXFrameOptions() const OVERRIDE; | |
36 virtual bool ShouldServiceRequest( | |
37 const net::URLRequest* request) const OVERRIDE; | |
38 | |
39 // Sends unmodified resource bytes. | |
40 void SendResource( | |
41 int resource_id, | |
42 const content::URLDataSource::GotDataCallback& callback); | |
43 | |
44 // Sends Javascript with an &origin parameter interpolated. | |
palmer
2013/04/09 00:26:15
I'm sorry, I still don't understand why this is sa
Jered
2013/04/09 01:18:58
Can you be more specific here? Why is it potential
| |
45 void SendJSWithOrigin( | |
46 int resource_id, | |
47 const std::string& path_and_query, | |
48 const content::URLDataSource::GotDataCallback& callback); | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(SuggestionSource); | |
51 }; | |
52 | |
53 #endif // CHROME_BROWSER_SEARCH_SUGGESTION_SOURCE_H_ | |
OLD | NEW |