Commit 9028a6ad authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Cleanup: Remove Android-specific #ifdef's etc from search/instant code

As of https://crrev.com/c/790511, this code isn't built on Android
anymore.
This also adds compile-time checks to many Instant headers to make sure
they're not accidentally built on Android.

Bug: 787830
Change-Id: I88026ce703158ac5b1580f02e621dea325a6fd64
Reviewed-on: https://chromium-review.googlesource.com/803280
Commit-Queue: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarChris Pickel <sfiera@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522101}
parent 13c92a34
...@@ -4042,7 +4042,7 @@ split_static_library("browser") { ...@@ -4042,7 +4042,7 @@ split_static_library("browser") {
] ]
} }
if (!is_chrome_branded) { if (!is_chrome_branded && !is_android) {
sources += [ sources += [
"search/local_files_ntp_source.cc", "search/local_files_ntp_source.cc",
"search/local_files_ntp_source.h", "search/local_files_ntp_source.h",
......
...@@ -6,8 +6,13 @@ ...@@ -6,8 +6,13 @@
#define CHROME_BROWSER_SEARCH_IFRAME_SOURCE_H_ #define CHROME_BROWSER_SEARCH_IFRAME_SOURCE_H_
#include "base/macros.h" #include "base/macros.h"
#include "build/build_config.h"
#include "content/public/browser/url_data_source.h" #include "content/public/browser/url_data_source.h"
#if defined(OS_ANDROID)
#error "Instant is only used on desktop";
#endif
// Base class for URL data sources for chrome-search:// iframed content. // Base class for URL data sources for chrome-search:// iframed content.
// TODO(treib): This has only one subclass outside of tests, // TODO(treib): This has only one subclass outside of tests,
// MostVisitedIframeSource. Merge the two classes? // MostVisitedIframeSource. Merge the two classes?
......
...@@ -30,13 +30,10 @@ ...@@ -30,13 +30,10 @@
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/color_utils.h" #include "ui/gfx/color_utils.h"
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
#if !defined(OS_ANDROID)
#include "chrome/browser/search/local_ntp_source.h" #include "chrome/browser/search/local_ntp_source.h"
#include "chrome/browser/themes/theme_properties.h" #include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/themes/theme_service_factory.h"
#endif
InstantService::InstantService(Profile* profile) : profile_(profile) { InstantService::InstantService(Profile* profile) : profile_(profile) {
// The initialization below depends on a typical set of browser threads. Skip // The initialization below depends on a typical set of browser threads. Skip
...@@ -66,22 +63,17 @@ InstantService::InstantService(Profile* profile) : profile_(profile) { ...@@ -66,22 +63,17 @@ InstantService::InstantService(Profile* profile) : profile_(profile) {
profile->GetResourceContext(), instant_io_context_)); profile->GetResourceContext(), instant_io_context_));
} }
// Set up the data sources that Instant uses on the NTP.
// TODO(aurimas) remove this #if once instant_service.cc is no longer compiled
// on Android.
#if !defined(OS_ANDROID)
// Listen for theme installation. // Listen for theme installation.
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
content::Source<ThemeService>( content::Source<ThemeService>(
ThemeServiceFactory::GetForProfile(profile_))); ThemeServiceFactory::GetForProfile(profile_)));
// Set up the data sources that Instant uses on the NTP.
content::URLDataSource::Add(profile_, new ThemeSource(profile_)); content::URLDataSource::Add(profile_, new ThemeSource(profile_));
content::URLDataSource::Add(profile_, new LocalNtpSource(profile_)); content::URLDataSource::Add(profile_, new LocalNtpSource(profile_));
content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false)); content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false));
content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true)); content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true));
content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_));
#endif // !defined(OS_ANDROID)
content::URLDataSource::Add(profile_, new FaviconSource(profile_)); content::URLDataSource::Add(profile_, new FaviconSource(profile_));
content::URLDataSource::Add(profile_, new MostVisitedIframeSource()); content::URLDataSource::Add(profile_, new MostVisitedIframeSource());
} }
...@@ -136,13 +128,11 @@ void InstantService::UndoAllMostVisitedDeletions() { ...@@ -136,13 +128,11 @@ void InstantService::UndoAllMostVisitedDeletions() {
} }
void InstantService::UpdateThemeInfo() { void InstantService::UpdateThemeInfo() {
#if !defined(OS_ANDROID)
// Initialize |theme_info_| if necessary. // Initialize |theme_info_| if necessary.
if (!theme_info_) { if (!theme_info_) {
BuildThemeInfo(); BuildThemeInfo();
} }
NotifyAboutThemeInfo(); NotifyAboutThemeInfo();
#endif // !defined(OS_ANDROID)
} }
void InstantService::UpdateMostVisitedItemsInfo() { void InstantService::UpdateMostVisitedItemsInfo() {
...@@ -187,12 +177,10 @@ void InstantService::Observe(int type, ...@@ -187,12 +177,10 @@ void InstantService::Observe(int type,
OnRendererProcessTerminated( OnRendererProcessTerminated(
content::Source<content::RenderProcessHost>(source)->GetID()); content::Source<content::RenderProcessHost>(source)->GetID());
break; break;
#if !defined(OS_ANDROID)
case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: case chrome::NOTIFICATION_BROWSER_THEME_CHANGED:
BuildThemeInfo(); BuildThemeInfo();
NotifyAboutThemeInfo(); NotifyAboutThemeInfo();
break; break;
#endif // !defined(OS_ANDROID)
default: default:
NOTREACHED() << "Unexpected notification type in InstantService."; NOTREACHED() << "Unexpected notification type in InstantService.";
} }
...@@ -244,8 +232,6 @@ void InstantService::NotifyAboutThemeInfo() { ...@@ -244,8 +232,6 @@ void InstantService::NotifyAboutThemeInfo() {
observer.ThemeInfoChanged(*theme_info_); observer.ThemeInfoChanged(*theme_info_);
} }
#if !defined(OS_ANDROID)
namespace { namespace {
const int kSectionBorderAlphaTransparency = 80; const int kSectionBorderAlphaTransparency = 80;
...@@ -360,4 +346,3 @@ void InstantService::BuildThemeInfo() { ...@@ -360,4 +346,3 @@ void InstantService::BuildThemeInfo() {
theme_provider.HasCustomImage(IDR_THEME_NTP_ATTRIBUTION); theme_provider.HasCustomImage(IDR_THEME_NTP_ATTRIBUTION);
} }
} }
#endif // !defined(OS_ANDROID)
...@@ -24,6 +24,10 @@ ...@@ -24,6 +24,10 @@
#include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_registrar.h"
#include "url/gurl.h" #include "url/gurl.h"
#if defined(OS_ANDROID)
#error "Instant is only used on desktop";
#endif
class InstantIOContext; class InstantIOContext;
class InstantServiceObserver; class InstantServiceObserver;
class Profile; class Profile;
...@@ -113,9 +117,7 @@ class InstantService : public KeyedService, ...@@ -113,9 +117,7 @@ class InstantService : public KeyedService,
void NotifyAboutMostVisitedItems(); void NotifyAboutMostVisitedItems();
void NotifyAboutThemeInfo(); void NotifyAboutThemeInfo();
#if !defined(OS_ANDROID)
void BuildThemeInfo(); void BuildThemeInfo();
#endif
Profile* const profile_; Profile* const profile_;
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "chrome/browser/search/instant_service_factory.h" #include "chrome/browser/search/instant_service_factory.h"
#include "build/build_config.h"
#include "chrome/browser/history/top_sites_factory.h" #include "chrome/browser/history/top_sites_factory.h"
#include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
...@@ -17,8 +16,7 @@ ...@@ -17,8 +16,7 @@
// static // static
InstantService* InstantServiceFactory::GetForProfile(Profile* profile) { InstantService* InstantServiceFactory::GetForProfile(Profile* profile) {
if (!search::IsInstantExtendedAPIEnabled()) DCHECK(search::IsInstantExtendedAPIEnabled());
return NULL;
return static_cast<InstantService*>( return static_cast<InstantService*>(
GetInstance()->GetServiceForBrowserContext(profile, true)); GetInstance()->GetServiceForBrowserContext(profile, true));
...@@ -35,14 +33,11 @@ InstantServiceFactory::InstantServiceFactory() ...@@ -35,14 +33,11 @@ InstantServiceFactory::InstantServiceFactory()
BrowserContextDependencyManager::GetInstance()) { BrowserContextDependencyManager::GetInstance()) {
DependsOn(suggestions::SuggestionsServiceFactory::GetInstance()); DependsOn(suggestions::SuggestionsServiceFactory::GetInstance());
DependsOn(TemplateURLServiceFactory::GetInstance()); DependsOn(TemplateURLServiceFactory::GetInstance());
#if !defined(OS_ANDROID)
DependsOn(ThemeServiceFactory::GetInstance()); DependsOn(ThemeServiceFactory::GetInstance());
#endif
DependsOn(TopSitesFactory::GetInstance()); DependsOn(TopSitesFactory::GetInstance());
} }
InstantServiceFactory::~InstantServiceFactory() { InstantServiceFactory::~InstantServiceFactory() = default;
}
content::BrowserContext* InstantServiceFactory::GetBrowserContextToUse( content::BrowserContext* InstantServiceFactory::GetBrowserContextToUse(
content::BrowserContext* context) const { content::BrowserContext* context) const {
...@@ -50,8 +45,7 @@ content::BrowserContext* InstantServiceFactory::GetBrowserContextToUse( ...@@ -50,8 +45,7 @@ content::BrowserContext* InstantServiceFactory::GetBrowserContextToUse(
} }
KeyedService* InstantServiceFactory::BuildServiceInstanceFor( KeyedService* InstantServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* profile) const { content::BrowserContext* context) const {
return search::IsInstantExtendedAPIEnabled() DCHECK(search::IsInstantExtendedAPIEnabled());
? new InstantService(static_cast<Profile*>(profile)) return new InstantService(Profile::FromBrowserContext(context));
: NULL;
} }
...@@ -5,11 +5,15 @@ ...@@ -5,11 +5,15 @@
#ifndef CHROME_BROWSER_SEARCH_INSTANT_SERVICE_FACTORY_H_ #ifndef CHROME_BROWSER_SEARCH_INSTANT_SERVICE_FACTORY_H_
#define CHROME_BROWSER_SEARCH_INSTANT_SERVICE_FACTORY_H_ #define CHROME_BROWSER_SEARCH_INSTANT_SERVICE_FACTORY_H_
#include "base/compiler_specific.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/singleton.h" #include "base/memory/singleton.h"
#include "build/build_config.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#if defined(OS_ANDROID)
#error "Instant is only used on desktop";
#endif
class InstantService; class InstantService;
class Profile; class Profile;
...@@ -31,7 +35,7 @@ class InstantServiceFactory : public BrowserContextKeyedServiceFactory { ...@@ -31,7 +35,7 @@ class InstantServiceFactory : public BrowserContextKeyedServiceFactory {
content::BrowserContext* GetBrowserContextToUse( content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const override; content::BrowserContext* context) const override;
KeyedService* BuildServiceInstanceFor( KeyedService* BuildServiceInstanceFor(
content::BrowserContext* profile) const override; content::BrowserContext* context) const override;
DISALLOW_COPY_AND_ASSIGN(InstantServiceFactory); DISALLOW_COPY_AND_ASSIGN(InstantServiceFactory);
}; };
......
...@@ -7,6 +7,12 @@ ...@@ -7,6 +7,12 @@
#include <vector> #include <vector>
#include "build/build_config.h"
#if defined(OS_ANDROID)
#error "Instant is only used on desktop";
#endif
struct InstantMostVisitedItem; struct InstantMostVisitedItem;
struct ThemeBackgroundInfo; struct ThemeBackgroundInfo;
......
...@@ -6,9 +6,14 @@ ...@@ -6,9 +6,14 @@
#define CHROME_BROWSER_SEARCH_LOCAL_FILES_NTP_SOURCE_H_ #define CHROME_BROWSER_SEARCH_LOCAL_FILES_NTP_SOURCE_H_
#include <string> #include <string>
#include "build/build_config.h" #include "build/build_config.h"
#include "content/public/browser/url_data_source.h" #include "content/public/browser/url_data_source.h"
#if defined(OS_ANDROID)
#error "Instant is only used on desktop";
#endif
#if !defined(GOOGLE_CHROME_BUILD) #if !defined(GOOGLE_CHROME_BUILD)
namespace local_ntp { namespace local_ntp {
......
...@@ -14,9 +14,14 @@ ...@@ -14,9 +14,14 @@
#include "base/optional.h" #include "base/optional.h"
#include "base/scoped_observer.h" #include "base/scoped_observer.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/search/one_google_bar/one_google_bar_service_observer.h" #include "chrome/browser/search/one_google_bar/one_google_bar_service_observer.h"
#include "content/public/browser/url_data_source.h" #include "content/public/browser/url_data_source.h"
#if defined(OS_ANDROID)
#error "Instant is only used on desktop";
#endif
struct OneGoogleBarData; struct OneGoogleBarData;
class OneGoogleBarService; class OneGoogleBarService;
class Profile; class Profile;
......
...@@ -6,8 +6,13 @@ ...@@ -6,8 +6,13 @@
#define CHROME_BROWSER_SEARCH_MOST_VISITED_IFRAME_SOURCE_H_ #define CHROME_BROWSER_SEARCH_MOST_VISITED_IFRAME_SOURCE_H_
#include "base/macros.h" #include "base/macros.h"
#include "build/build_config.h"
#include "chrome/browser/search/iframe_source.h" #include "chrome/browser/search/iframe_source.h"
#if defined(OS_ANDROID)
#error "Instant is only used on desktop";
#endif
// Serves HTML for displaying suggestions using iframes, e.g. // Serves HTML for displaying suggestions using iframes, e.g.
// chrome-search://most-visited/single.html // chrome-search://most-visited/single.html
class MostVisitedIframeSource : public IframeSource { class MostVisitedIframeSource : public IframeSource {
......
...@@ -9,9 +9,14 @@ ...@@ -9,9 +9,14 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/macros.h" #include "base/macros.h"
#include "build/build_config.h"
#include "chrome/browser/search/search_engine_base_url_tracker.h" #include "chrome/browser/search/search_engine_base_url_tracker.h"
#include "chrome/browser/ui/search/instant_controller.h" #include "chrome/browser/ui/search/instant_controller.h"
#if defined(OS_ANDROID)
#error "Instant is only used on desktop";
#endif
class Browser; class Browser;
class Profile; class Profile;
......
...@@ -10,8 +10,13 @@ ...@@ -10,8 +10,13 @@
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/scoped_observer.h" #include "base/scoped_observer.h"
#include "build/build_config.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#if defined(OS_ANDROID)
#error "Instant is only used on desktop";
#endif
class Profile; class Profile;
class TabStripModel; class TabStripModel;
......
...@@ -13,11 +13,16 @@ ...@@ -13,11 +13,16 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/optional.h" #include "base/optional.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/common/search/ntp_logging_events.h" #include "chrome/common/search/ntp_logging_events.h"
#include "components/ntp_tiles/ntp_tile_impression.h" #include "components/ntp_tiles/ntp_tile_impression.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h" #include "content/public/browser/web_contents_user_data.h"
#if defined(OS_ANDROID)
#error "Instant is only used on desktop";
#endif
namespace content { namespace content {
class WebContents; class WebContents;
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/common/search.mojom.h" #include "chrome/common/search.mojom.h"
#include "chrome/common/search/instant_types.h" #include "chrome/common/search/instant_types.h"
#include "chrome/common/search/ntp_logging_events.h" #include "chrome/common/search/ntp_logging_events.h"
...@@ -20,6 +21,10 @@ ...@@ -20,6 +21,10 @@
#include "content/public/browser/web_contents_binding_set.h" #include "content/public/browser/web_contents_binding_set.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#if defined(OS_ANDROID)
#error "Instant is only used on desktop";
#endif
class GURL; class GURL;
namespace content { namespace content {
......
...@@ -6,8 +6,13 @@ ...@@ -6,8 +6,13 @@
#define CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_POLICY_IMPL_H_ #define CHROME_BROWSER_UI_SEARCH_SEARCH_IPC_ROUTER_POLICY_IMPL_H_
#include "base/macros.h" #include "base/macros.h"
#include "build/build_config.h"
#include "chrome/browser/ui/search/search_ipc_router.h" #include "chrome/browser/ui/search/search_ipc_router.h"
#if defined(OS_ANDROID)
#error "Instant is only used on desktop";
#endif
namespace content { namespace content {
class WebContents; class WebContents;
} }
......
...@@ -112,8 +112,7 @@ SearchTabHelper::SearchTabHelper(content::WebContents* web_contents) ...@@ -112,8 +112,7 @@ SearchTabHelper::SearchTabHelper(content::WebContents* web_contents)
this, this,
base::MakeUnique<SearchIPCRouterPolicyImpl>(web_contents)), base::MakeUnique<SearchIPCRouterPolicyImpl>(web_contents)),
instant_service_(nullptr) { instant_service_(nullptr) {
if (!search::IsInstantExtendedAPIEnabled()) DCHECK(search::IsInstantExtendedAPIEnabled());
return;
instant_service_ = InstantServiceFactory::GetForProfile(profile()); instant_service_ = InstantServiceFactory::GetForProfile(profile());
if (instant_service_) if (instant_service_)
...@@ -126,9 +125,6 @@ SearchTabHelper::~SearchTabHelper() { ...@@ -126,9 +125,6 @@ SearchTabHelper::~SearchTabHelper() {
} }
void SearchTabHelper::OmniboxInputStateChanged() { void SearchTabHelper::OmniboxInputStateChanged() {
if (!search::IsInstantExtendedAPIEnabled())
return;
ipc_router_.SetInputInProgress(IsInputInProgress()); ipc_router_.SetInputInProgress(IsInputInProgress());
} }
...@@ -258,9 +254,6 @@ void SearchTabHelper::DidFinishLoad(content::RenderFrameHost* render_frame_host, ...@@ -258,9 +254,6 @@ void SearchTabHelper::DidFinishLoad(content::RenderFrameHost* render_frame_host,
void SearchTabHelper::NavigationEntryCommitted( void SearchTabHelper::NavigationEntryCommitted(
const content::LoadCommittedDetails& load_details) { const content::LoadCommittedDetails& load_details) {
if (!search::IsInstantExtendedAPIEnabled())
return;
if (!load_details.is_main_frame) if (!load_details.is_main_frame)
return; return;
...@@ -281,8 +274,6 @@ void SearchTabHelper::MostVisitedItemsChanged( ...@@ -281,8 +274,6 @@ void SearchTabHelper::MostVisitedItemsChanged(
} }
void SearchTabHelper::FocusOmnibox(OmniboxFocusState state) { void SearchTabHelper::FocusOmnibox(OmniboxFocusState state) {
// TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef.
#if !defined(OS_ANDROID)
OmniboxView* omnibox_view = GetOmniboxView(); OmniboxView* omnibox_view = GetOmniboxView();
if (!omnibox_view) if (!omnibox_view)
return; return;
...@@ -318,7 +309,6 @@ void SearchTabHelper::FocusOmnibox(OmniboxFocusState state) { ...@@ -318,7 +309,6 @@ void SearchTabHelper::FocusOmnibox(OmniboxFocusState state) {
web_contents()->Focus(); web_contents()->Focus();
break; break;
} }
#endif
} }
void SearchTabHelper::OnDeleteMostVisitedItem(const GURL& url) { void SearchTabHelper::OnDeleteMostVisitedItem(const GURL& url) {
...@@ -340,34 +330,23 @@ void SearchTabHelper::OnUndoAllMostVisitedDeletions() { ...@@ -340,34 +330,23 @@ void SearchTabHelper::OnUndoAllMostVisitedDeletions() {
void SearchTabHelper::OnLogEvent(NTPLoggingEventType event, void SearchTabHelper::OnLogEvent(NTPLoggingEventType event,
base::TimeDelta time) { base::TimeDelta time) {
// TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef.
#if !defined(OS_ANDROID)
NTPUserDataLogger::GetOrCreateFromWebContents(web_contents()) NTPUserDataLogger::GetOrCreateFromWebContents(web_contents())
->LogEvent(event, time); ->LogEvent(event, time);
#endif
} }
void SearchTabHelper::OnLogMostVisitedImpression( void SearchTabHelper::OnLogMostVisitedImpression(
const ntp_tiles::NTPTileImpression& impression) { const ntp_tiles::NTPTileImpression& impression) {
// TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef.
#if !defined(OS_ANDROID)
NTPUserDataLogger::GetOrCreateFromWebContents(web_contents()) NTPUserDataLogger::GetOrCreateFromWebContents(web_contents())
->LogMostVisitedImpression(impression); ->LogMostVisitedImpression(impression);
#endif
} }
void SearchTabHelper::OnLogMostVisitedNavigation( void SearchTabHelper::OnLogMostVisitedNavigation(
const ntp_tiles::NTPTileImpression& impression) { const ntp_tiles::NTPTileImpression& impression) {
// TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef.
#if !defined(OS_ANDROID)
NTPUserDataLogger::GetOrCreateFromWebContents(web_contents()) NTPUserDataLogger::GetOrCreateFromWebContents(web_contents())
->LogMostVisitedNavigation(impression); ->LogMostVisitedNavigation(impression);
#endif
} }
void SearchTabHelper::PasteIntoOmnibox(const base::string16& text) { void SearchTabHelper::PasteIntoOmnibox(const base::string16& text) {
// TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef.
#if !defined(OS_ANDROID)
OmniboxView* omnibox_view = GetOmniboxView(); OmniboxView* omnibox_view = GetOmniboxView();
if (!omnibox_view) if (!omnibox_view)
return; return;
...@@ -389,7 +368,6 @@ void SearchTabHelper::PasteIntoOmnibox(const base::string16& text) { ...@@ -389,7 +368,6 @@ void SearchTabHelper::PasteIntoOmnibox(const base::string16& text) {
omnibox_view->model()->OnPaste(); omnibox_view->model()->OnPaste();
omnibox_view->SetUserText(text_to_paste); omnibox_view->SetUserText(text_to_paste);
omnibox_view->OnAfterPossibleChange(true); omnibox_view->OnAfterPossibleChange(true);
#endif
} }
bool SearchTabHelper::ChromeIdentityCheck(const base::string16& identity) { bool SearchTabHelper::ChromeIdentityCheck(const base::string16& identity) {
...@@ -404,15 +382,11 @@ bool SearchTabHelper::HistorySyncCheck() { ...@@ -404,15 +382,11 @@ bool SearchTabHelper::HistorySyncCheck() {
} }
const OmniboxView* SearchTabHelper::GetOmniboxView() const { const OmniboxView* SearchTabHelper::GetOmniboxView() const {
#if defined(OS_ANDROID)
return nullptr;
#else
Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
if (!browser) if (!browser)
return nullptr; return nullptr;
return browser->window()->GetLocationBar()->GetOmniboxView(); return browser->window()->GetLocationBar()->GetOmniboxView();
#endif // OS_ANDROID
} }
OmniboxView* SearchTabHelper::GetOmniboxView() { OmniboxView* SearchTabHelper::GetOmniboxView() {
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/search/instant_service_observer.h" #include "chrome/browser/search/instant_service_observer.h"
#include "chrome/browser/ui/search/search_ipc_router.h" #include "chrome/browser/ui/search/search_ipc_router.h"
#include "chrome/common/search/instant_types.h" #include "chrome/common/search/instant_types.h"
...@@ -21,6 +22,10 @@ ...@@ -21,6 +22,10 @@
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h" #include "content/public/browser/web_contents_user_data.h"
#if defined(OS_ANDROID)
#error "Instant is only used on desktop";
#endif
namespace content { namespace content {
class WebContents; class WebContents;
struct LoadCommittedDetails; struct LoadCommittedDetails;
......
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