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

Side by Side Diff: content/public/android/java/src/org/chromium/content_public/browser/WebContentsObserver.java

Issue 2439483003: Link MediaSessionTabHelper with native MediaSession [CL is going to be split] (Closed)
Patch Set: Super rough, please give some initial feedbacks Created 4 years, 2 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.content_public.browser; 5 package org.chromium.content_public.browser;
6 6
7 import org.chromium.content_public.common.MediaMetadata;
8
9 import java.lang.ref.WeakReference; 7 import java.lang.ref.WeakReference;
10 8
11 /** 9 /**
12 * This class receives callbacks that act as hooks for various a native web cont ents events related 10 * This class receives callbacks that act as hooks for various a native web cont ents events related
13 * to loading a url. A single web contents can have multiple WebContentObservers . 11 * to loading a url. A single web contents can have multiple WebContentObservers .
14 */ 12 */
15 public abstract class WebContentsObserver { 13 public abstract class WebContentsObserver {
16 // TODO(jdduke): Remove the destroy method and hold observer embedders 14 // TODO(jdduke): Remove the destroy method and hold observer embedders
17 // responsible for explicit observer detachment. 15 // responsible for explicit observer detachment.
18 // Using a weak reference avoids cycles that might prevent GC of WebView's W ebContents. 16 // Using a weak reference avoids cycles that might prevent GC of WebView's W ebContents.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 */ 154 */
157 public void didChangeThemeColor(int color) {} 155 public void didChangeThemeColor(int color) {}
158 156
159 /** 157 /**
160 * Called when we started navigation to the pending entry. 158 * Called when we started navigation to the pending entry.
161 * @param url The URL that we are navigating to. 159 * @param url The URL that we are navigating to.
162 */ 160 */
163 public void didStartNavigationToPendingEntry(String url) {} 161 public void didStartNavigationToPendingEntry(String url) {}
164 162
165 /** 163 /**
166 * Called when the media session state changed.
167 * @param isControllable if the session can be resumed or suspended.
168 * @param isSuspended if the session currently suspended or not.
169 */
170 public void mediaSessionStateChanged(boolean isControllable, boolean isSuspe nded) {}
171
172 /**
173 * Called when the media session metadata changed.
174 * @param metadata the new MediaMetadata after change.
175 */
176 public void mediaSessionMetadataChanged(MediaMetadata metadata) {}
177
178 /**
179 * Stop observing the web contents and clean up associated references. 164 * Stop observing the web contents and clean up associated references.
180 */ 165 */
181 public void destroy() { 166 public void destroy() {
182 if (mWebContents == null) return; 167 if (mWebContents == null) return;
183 final WebContents webContents = mWebContents.get(); 168 final WebContents webContents = mWebContents.get();
184 mWebContents = null; 169 mWebContents = null;
185 if (webContents == null) return; 170 if (webContents == null) return;
186 webContents.removeObserver(this); 171 webContents.removeObserver(this);
187 } 172 }
188 173
189 protected WebContentsObserver() {} 174 protected WebContentsObserver() {}
190 } 175 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698