1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package org.chromium.chrome.browser.permissions; 6 7 import org.chromium.base.annotations.NativeMethods; 8 import org.chromium.chrome.browser.profiles.Profile; 9 import org.chromium.content_public.browser.WebContents; 10 11 /** 12 * Utility class that interacts with native to retrieve and set permission-related settings. 13 */ 14 public class PermissionSettingsBridge { shouldShowNotificationsPromo(WebContents webContents)15 public static boolean shouldShowNotificationsPromo(WebContents webContents) { 16 return PermissionSettingsBridgeJni.get().shouldShowNotificationsPromo( 17 getProfile(), webContents); 18 } 19 didShowNotificationsPromo()20 public static void didShowNotificationsPromo() { 21 PermissionSettingsBridgeJni.get().didShowNotificationsPromo(getProfile()); 22 } 23 getProfile()24 private static Profile getProfile() { 25 return Profile.getLastUsedRegularProfile(); 26 } 27 28 @NativeMethods 29 public interface Natives { shouldShowNotificationsPromo(Profile profile, WebContents webContents)30 boolean shouldShowNotificationsPromo(Profile profile, WebContents webContents); didShowNotificationsPromo(Profile profile)31 void didShowNotificationsPromo(Profile profile); 32 } 33 } 34