Commit 4c75ae7a authored by thestig@chromium.org's avatar thestig@chromium.org

Make ContextualSearchPromoSource Android-only.

BUG=333201

Review URL: https://codereview.chromium.org/450543002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288075 0039d316-1c4b-4281-b951-d872f2087c98
parent 229a8308
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/search/contextual_search_promo_source.h"
#include "chrome/browser/search/contextual_search_promo_source_android.h"
#include "base/memory/ref_counted_memory.h"
#include "base/strings/string_util.h"
......@@ -26,11 +26,11 @@ const char kPromoRobotoPath[] = "/roboto.woff";
} // namespace
ContextualSearchPromoSource::ContextualSearchPromoSource() {}
ContextualSearchPromoSourceAndroid::ContextualSearchPromoSourceAndroid() {}
ContextualSearchPromoSource::~ContextualSearchPromoSource() {}
ContextualSearchPromoSourceAndroid::~ContextualSearchPromoSourceAndroid() {}
void ContextualSearchPromoSource::StartDataRequest(
void ContextualSearchPromoSourceAndroid::StartDataRequest(
const std::string& path_and_query, int render_process_id,
int render_frame_id,
const content::URLDataSource::GotDataCallback& callback) {
......@@ -50,11 +50,11 @@ void ContextualSearchPromoSource::StartDataRequest(
}
}
std::string ContextualSearchPromoSource::GetSource() const {
std::string ContextualSearchPromoSourceAndroid::GetSource() const {
return chrome::kChromeUIContextualSearchPromoHost;
}
std::string ContextualSearchPromoSource::GetMimeType(
std::string ContextualSearchPromoSourceAndroid::GetMimeType(
const std::string& path_and_query) const {
std::string path(GURL("chrome://host/" + path_and_query).path());
if (EndsWith(path, ".js", false)) return "application/javascript";
......@@ -65,22 +65,23 @@ std::string ContextualSearchPromoSource::GetMimeType(
return "";
}
bool ContextualSearchPromoSource::ShouldDenyXFrameOptions() const {
bool ContextualSearchPromoSourceAndroid::ShouldDenyXFrameOptions() const {
return false;
}
bool ContextualSearchPromoSource::ShouldAddContentSecurityPolicy() const {
bool
ContextualSearchPromoSourceAndroid::ShouldAddContentSecurityPolicy() const {
return false;
}
void ContextualSearchPromoSource::SendResource(
void ContextualSearchPromoSourceAndroid::SendResource(
int resource_id, const content::URLDataSource::GotDataCallback& callback) {
scoped_refptr<base::RefCountedStaticMemory> response(
ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id));
callback.Run(response.get());
}
void ContextualSearchPromoSource::SendHtmlWithStrings(
void ContextualSearchPromoSourceAndroid::SendHtmlWithStrings(
const content::URLDataSource::GotDataCallback& callback) {
base::DictionaryValue strings_data;
strings_data.SetString(
......
......@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_PROMO_SOURCE_H_
#define CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_PROMO_SOURCE_H_
#ifndef CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_PROMO_SOURCE_ANDROID_H_
#define CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_PROMO_SOURCE_ANDROID_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "content/public/browser/url_data_source.h"
// Serves HTML for displaying the contextual search first-run promo.
class ContextualSearchPromoSource : public content::URLDataSource {
class ContextualSearchPromoSourceAndroid : public content::URLDataSource {
public:
ContextualSearchPromoSource();
virtual ~ContextualSearchPromoSource();
ContextualSearchPromoSourceAndroid();
virtual ~ContextualSearchPromoSourceAndroid();
protected:
// Overridden from content::URLDataSource:
......@@ -38,7 +38,7 @@ class ContextualSearchPromoSource : public content::URLDataSource {
const content::URLDataSource::GotDataCallback& callback);
private:
DISALLOW_COPY_AND_ASSIGN(ContextualSearchPromoSource);
DISALLOW_COPY_AND_ASSIGN(ContextualSearchPromoSourceAndroid);
};
#endif // CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_PROMO_SOURCE_H_
#endif // CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_PROMO_SOURCE_ANDROID_H_
......@@ -1115,8 +1115,8 @@
'browser/resources_util.h',
'browser/safe_browsing/safe_browsing_tab_observer.cc',
'browser/safe_browsing/safe_browsing_tab_observer.h',
'browser/search/contextual_search_promo_source.cc',
'browser/search/contextual_search_promo_source.h',
'browser/search/contextual_search_promo_source_android.cc',
'browser/search/contextual_search_promo_source_android.h',
'browser/search/iframe_source.cc',
'browser/search/iframe_source.h',
'browser/search/instant_io_context.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment