Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/fullscreen/FullscreenInfoBarDelegate.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/FullscreenInfoBarDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/FullscreenInfoBarDelegate.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ac3e76d8edca805a122aa2dc525abdfea7c2a82a |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/FullscreenInfoBarDelegate.java |
| @@ -0,0 +1,64 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.chrome.browser.fullscreen; |
| + |
| +import org.chromium.base.CalledByNative; |
| +import org.chromium.chrome.browser.Tab; |
| +import org.chromium.chrome.browser.preferences.website.ContentSetting; |
| +import org.chromium.chrome.browser.preferences.website.FullscreenInfo; |
| + |
| +/** |
| + * Class for managing the fullscreen infobar. |
| + */ |
| +public class FullscreenInfoBarDelegate { |
| + private final FullscreenHtmlApiHandler mHandler; |
| + private final Tab mTab; |
| + private long mNativeFullscreenInfoBarDelegate = 0; |
| + |
| + FullscreenInfoBarDelegate(FullscreenHtmlApiHandler handler, Tab tab, String origin) { |
|
Ted C
2015/03/12 21:21:34
Looking at the native side of things, I think mayb
qinmin
2015/03/17 23:49:30
Done.
|
| + mHandler = handler; |
| + mTab = tab; |
| + mNativeFullscreenInfoBarDelegate = nativeLaunchFullscreenInfoBar(tab, origin); |
| + } |
| + |
| + /** |
| + * Close the fullscreen infobar. |
| + */ |
| + protected void closeFullscreenInfoBar() { |
| + if (mNativeFullscreenInfoBarDelegate != 0) { |
| + nativeCloseFullscreenInfoBar(mNativeFullscreenInfoBarDelegate, mTab); |
| + } |
| + } |
| + |
| + /** |
| + * Called when fullscreen is allowed for a particular origin. |
| + * |
| + * @param origin The site origin that fullscreen is allowed. |
| + */ |
| + @CalledByNative |
| + public void onFullscreenAllowed(String origin) { |
|
Ted C
2015/03/12 21:21:34
are all of these just called by native? If so, th
qinmin
2015/03/17 23:49:30
Done.
|
| + FullscreenInfo fullscreenInfo = new FullscreenInfo(origin, null); |
| + fullscreenInfo.setContentSetting(ContentSetting.ALLOW); |
| + } |
| + |
| + /** |
| + * Called when fullscreen is cancelled on the infobar. |
| + */ |
| + @CalledByNative |
| + public void onFullscreenCancelled() { |
| + mHandler.setPersistentFullscreenMode(false); |
| + } |
| + |
| + /** |
| + * Called when the infobar is dismissed. |
| + */ |
| + @CalledByNative |
| + public void onInfoBarDismissed() { |
| + mNativeFullscreenInfoBarDelegate = 0; |
| + } |
| + |
| + private native long nativeLaunchFullscreenInfoBar(Tab tab, String origin); |
| + private native void nativeCloseFullscreenInfoBar(long nativeFullscreenInfoBarDelegate, Tab tab); |
| +} |