Override server-side simple-cache trial with commandline switches.
[chromium-blink-merge.git] / chrome / browser / search / suggestion_iframe_source.cc
blob07b9ce6abcbbc1a13a06a5a7b017d0da16de494e
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 #include "chrome/browser/search/suggestion_iframe_source.h"
7 #include "chrome/common/url_constants.h"
8 #include "grit/browser_resources.h"
10 namespace {
12 const char kLoaderHtmlPath[] = "/loader.html";
13 const char kLoaderJSPath[] = "/loader.js";
14 const char kResultHtmlPath[] = "/result.html";
15 const char kResultJSPath[] = "/result.js";
17 } // namespace
19 SuggestionIframeSource::SuggestionIframeSource() {
22 SuggestionIframeSource::~SuggestionIframeSource() {
25 std::string SuggestionIframeSource::GetSource() const {
26 return chrome::kChromeSearchSuggestionHost;
29 void SuggestionIframeSource::StartDataRequest(
30 const std::string& path,
31 int render_process_id,
32 int render_view_id,
33 const content::URLDataSource::GotDataCallback& callback) {
34 // path has no leading '/' and includes any query string. Since we don't
35 // expect a query string for requests to this source, just add back the '/'.
36 std::string full_path = "/" + path;
37 if (full_path == kLoaderHtmlPath) {
38 SendResource(IDR_OMNIBOX_RESULT_LOADER_HTML, callback);
39 } else if (full_path == kLoaderJSPath) {
40 SendJSWithOrigin(IDR_OMNIBOX_RESULT_LOADER_JS, render_process_id,
41 render_view_id, callback);
42 } else if (full_path == kResultHtmlPath) {
43 SendResource(IDR_OMNIBOX_RESULT_HTML, callback);
44 } else if (full_path == kResultJSPath) {
45 SendJSWithOrigin(IDR_OMNIBOX_RESULT_JS, render_process_id, render_view_id,
46 callback);
47 } else {
48 callback.Run(NULL);
52 bool SuggestionIframeSource::ServesPath(const std::string& path) const {
53 return path == kLoaderHtmlPath || path == kLoaderJSPath ||
54 path == kResultHtmlPath || path == kResultJSPath;