Commit 0cd66225 authored by kmadhusu's avatar kmadhusu Committed by Commit bot

Have TabAndroid to implement the SearchTabHelperDelegate interface to provide...

Have TabAndroid to implement the SearchTabHelperDelegate interface to provide the necessary functionality to SearchTabHelper.

This will allow us to turn off search term replacement (by updating the location bar displayed url) when the underlying page doesn't support embedded search.

Server side bug: b/17140979

BUG=none
TEST=none

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

Cr-Commit-Position: refs/heads/master@{#291603}
parent ec6d38ea
...@@ -997,6 +997,14 @@ public class Tab implements NavigationClient { ...@@ -997,6 +997,14 @@ public class Tab implements NavigationClient {
return new TabChromeWebContentsDelegateAndroid(); return new TabChromeWebContentsDelegateAndroid();
} }
/**
* A helper method to allow subclasses to handle the Instant support
* disabled event.
*/
@CalledByNative
protected void onWebContentsInstantSupportDisabled() {
}
/** /**
* A helper method to allow subclasses to build their own menu populator. * A helper method to allow subclasses to build their own menu populator.
* @return An instance of a {@link ContextMenuPopulator}. * @return An instance of a {@link ContextMenuPopulator}.
......
...@@ -306,6 +306,17 @@ void TabAndroid::SwapTabContents(content::WebContents* old_contents, ...@@ -306,6 +306,17 @@ void TabAndroid::SwapTabContents(content::WebContents* old_contents,
did_finish_load); did_finish_load);
} }
void TabAndroid::OnWebContentsInstantSupportDisabled(
const content::WebContents* contents) {
DCHECK(contents);
if (web_contents() != contents)
return;
JNIEnv* env = base::android::AttachCurrentThread();
Java_Tab_onWebContentsInstantSupportDisabled(env,
weak_java_tab_.get(env).obj());
}
void TabAndroid::Observe(int type, void TabAndroid::Observe(int type,
const content::NotificationSource& source, const content::NotificationSource& source,
const content::NotificationDetails& details) { const content::NotificationDetails& details) {
...@@ -371,6 +382,7 @@ void TabAndroid::InitWebContents(JNIEnv* env, ...@@ -371,6 +382,7 @@ void TabAndroid::InitWebContents(JNIEnv* env,
WindowAndroidHelper::FromWebContents(web_contents())-> WindowAndroidHelper::FromWebContents(web_contents())->
SetWindowAndroid(content_view_core->GetWindowAndroid()); SetWindowAndroid(content_view_core->GetWindowAndroid());
CoreTabHelper::FromWebContents(web_contents())->set_delegate(this); CoreTabHelper::FromWebContents(web_contents())->set_delegate(this);
SearchTabHelper::FromWebContents(web_contents())->set_delegate(this);
web_contents_delegate_.reset( web_contents_delegate_.reset(
new chrome::android::ChromeWebContentsDelegateAndroid( new chrome::android::ChromeWebContentsDelegateAndroid(
env, jweb_contents_delegate)); env, jweb_contents_delegate));
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "chrome/browser/sync/glue/synced_tab_delegate_android.h" #include "chrome/browser/sync/glue/synced_tab_delegate_android.h"
#include "chrome/browser/ui/search/search_tab_helper_delegate.h"
#include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h"
#include "chrome/browser/ui/toolbar/toolbar_model.h" #include "chrome/browser/ui/toolbar/toolbar_model.h"
#include "components/sessions/session_id.h" #include "components/sessions/session_id.h"
...@@ -42,6 +43,7 @@ class PrerenderManager; ...@@ -42,6 +43,7 @@ class PrerenderManager;
} }
class TabAndroid : public CoreTabHelperDelegate, class TabAndroid : public CoreTabHelperDelegate,
public SearchTabHelperDelegate,
public content::NotificationObserver { public content::NotificationObserver {
public: public:
enum TabLoadStatus { enum TabLoadStatus {
...@@ -111,6 +113,10 @@ class TabAndroid : public CoreTabHelperDelegate, ...@@ -111,6 +113,10 @@ class TabAndroid : public CoreTabHelperDelegate,
bool did_start_load, bool did_start_load,
bool did_finish_load) OVERRIDE; bool did_finish_load) OVERRIDE;
// Overridden from SearchTabHelperDelegate:
virtual void OnWebContentsInstantSupportDisabled(
const content::WebContents* web_contents) OVERRIDE;
// NotificationObserver ----------------------------------------------------- // NotificationObserver -----------------------------------------------------
virtual void Observe(int type, virtual void Observe(int type,
const content::NotificationSource& source, const content::NotificationSource& source,
......
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