| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.contextualsearch; | 5 package org.chromium.chrome.browser.contextualsearch; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.view.ContextMenu; | 8 import android.view.ContextMenu; |
| 9 | 9 |
| 10 import org.chromium.base.annotations.CalledByNative; | 10 import org.chromium.base.annotations.CalledByNative; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 @Override | 112 @Override |
| 113 public void onDestroyed(Tab tab) { | 113 public void onDestroyed(Tab tab) { |
| 114 if (mNativeHelper != 0) { | 114 if (mNativeHelper != 0) { |
| 115 nativeDestroy(mNativeHelper); | 115 nativeDestroy(mNativeHelper); |
| 116 mNativeHelper = 0; | 116 mNativeHelper = 0; |
| 117 } | 117 } |
| 118 if (mTemplateUrlObserver != null) { | 118 if (mTemplateUrlObserver != null) { |
| 119 TemplateUrlService.getInstance().removeObserver(mTemplateUrlObserver
); | 119 TemplateUrlService.getInstance().removeObserver(mTemplateUrlObserver
); |
| 120 } | 120 } |
| 121 if (NetworkChangeNotifier.isInitialized()) { |
| 122 NetworkChangeNotifier.removeConnectionTypeObserver(this); |
| 123 } |
| 121 removeContextualSearchHooks(mBaseContentViewCore); | 124 removeContextualSearchHooks(mBaseContentViewCore); |
| 122 mBaseContentViewCore = null; | 125 mBaseContentViewCore = null; |
| 123 } | 126 } |
| 124 | 127 |
| 125 @Override | 128 @Override |
| 126 public void onToggleFullscreenMode(Tab tab, boolean enable) { | 129 public void onToggleFullscreenMode(Tab tab, boolean enable) { |
| 127 ContextualSearchManager manager = getContextualSearchManager(); | 130 ContextualSearchManager manager = getContextualSearchManager(); |
| 128 if (manager != null) { | 131 if (manager != null) { |
| 129 manager.hideContextualSearch(StateChangeReason.UNKNOWN); | 132 manager.hideContextualSearch(StateChangeReason.UNKNOWN); |
| 130 } | 133 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 if (manager != null) { | 263 if (manager != null) { |
| 261 boolean isEnabled = !PrefServiceBridge.getInstance().isContextualSea
rchDisabled() | 264 boolean isEnabled = !PrefServiceBridge.getInstance().isContextualSea
rchDisabled() |
| 262 && !PrefServiceBridge.getInstance().isContextualSearchUninit
ialized(); | 265 && !PrefServiceBridge.getInstance().isContextualSearchUninit
ialized(); |
| 263 manager.onContextualSearchPrefChanged(isEnabled); | 266 manager.onContextualSearchPrefChanged(isEnabled); |
| 264 } | 267 } |
| 265 } | 268 } |
| 266 | 269 |
| 267 private native long nativeInit(Profile profile); | 270 private native long nativeInit(Profile profile); |
| 268 private native void nativeDestroy(long nativeContextualSearchTabHelper); | 271 private native void nativeDestroy(long nativeContextualSearchTabHelper); |
| 269 } | 272 } |
| OLD | NEW |