Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTabHelper.java

Issue 2812373002: Unregister from network changes on destroy in ContextualSearchTabHelper
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698