< prev index next >

src/java.desktop/share/classes/java/awt/Taskbar.java

Print this page

        

@@ -177,17 +177,20 @@
         }
     }
 
     /**
      *  Calls to the security manager's {@code checkPermission} method with
-     *  an {@code AWTPermission("showWindowWithoutWarningBanner")}
-     *  permission.
+     *  an {@code AWTPermission("showWindowWithoutWarningBanner")} and an
+     *  {@code AWTPermission("canProcessApplicationEvents")}
+     *  permissions.
      */
-    private void checkAWTPermission(){
+    private void checkPermissions(){
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             sm.checkPermission(new AWTPermission(
+                    "canProcessApplicationEvents"));
+            sm.checkPermission(new AWTPermission(
                     "showWindowWithoutWarningBanner"));
         }
     }
 
     private Taskbar() {

@@ -260,16 +263,17 @@
      * with {@code enabled} parameter set to false.
      *
      * @param enabled disables this request if false
      * @param critical if this is an important request
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#USER_ATTENTION} feature
      */
     public void requestUserAttention(final boolean enabled, final boolean critical) {
-        checkAWTPermission();
+        checkPermissions();
         checkFeatureSupport(Feature.USER_ATTENTION);
         peer.requestUserAttention(enabled, critical);
     }
 
     /**

@@ -277,77 +281,82 @@
      *
      * On an already active window requesting attention does nothing.
      *
      * @param w window
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#USER_ATTENTION_WINDOW} feature
      */
     public void requestWindowUserAttention(Window w) {
-        checkAWTPermission();
+        checkPermissions();
         checkFeatureSupport(Feature.USER_ATTENTION_WINDOW);
         peer.requestWindowUserAttention(w);
     }
 
     /**
      * Attaches the contents of the provided PopupMenu to the application icon
      * in the task area.
      *
      * @param menu the PopupMenu to attach to this application
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#MENU} feature
      */
     public void setMenu(final PopupMenu menu) {
-        checkAWTPermission();
+        checkPermissions();
         checkFeatureSupport(Feature.MENU);
         peer.setMenu(menu);
     }
 
     /**
      * Gets PopupMenu used to add items to this application's icon in system task area.
      *
      * @return the PopupMenu
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#MENU} feature
      */
     public PopupMenu getMenu() {
-        checkAWTPermission();
+        checkPermissions();
         checkFeatureSupport(Feature.MENU);
         return peer.getMenu();
     }
 
     /**
      * Changes this application's icon to the provided image.
      *
      * @param image to change
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#ICON_IMAGE} feature
      */
     public void setIconImage(final Image image) {
-        checkAWTPermission();
+        checkPermissions();
         checkFeatureSupport(Feature.ICON_IMAGE);
         peer.setIconImage(image);
     }
 
     /**
      * Obtains an image of this application's icon.
      *
      * @return an image of this application's icon
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#ICON_IMAGE} feature
      */
     public Image getIconImage() {
-        checkAWTPermission();
+        checkPermissions();
         checkFeatureSupport(Feature.ICON_IMAGE);
         return peer.getIconImage();
     }
 
     /**

@@ -360,17 +369,18 @@
      * {@code Feature.ICON_BADGE_NUMBER}.
      *
      * Passing {@code null} as parameter hides the badge.
      * @param badge label to affix to the icon
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#ICON_BADGE_NUMBER}
      * or {@link Taskbar.Feature#ICON_BADGE_TEXT} feature
      */
     public void setIconBadge(final String badge) {
-        checkAWTPermission();
+        checkPermissions();
         checkFeatureSupport(Feature.ICON_BADGE_NUMBER);
         peer.setIconBadge(badge);
     }
 
     /**

@@ -379,16 +389,17 @@
      * It may be disabled by system settings.
      *
      * @param w window to update
      * @param badge image to affix to the icon
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#ICON_BADGE_IMAGE_WINDOW} feature
      */
     public void setWindowIconBadge(Window w, final Image badge) {
-        checkAWTPermission();
+        checkPermissions();
         checkFeatureSupport(Feature.ICON_BADGE_IMAGE_WINDOW);
         if (w != null) {
             peer.setWindowIconBadge(w, badge);
         }
     }

@@ -396,31 +407,35 @@
 
     /**
      * Affixes a small system-provided progress bar to this application's icon.
      *
      * @param value from 0 to 100, other to disable progress indication
+     * @throws SecurityException if a security manager exists and it denies the
+     * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#PROGRESS_VALUE} feature
      */
     public void setProgressValue(int value) {
-        checkAWTPermission();
+        checkPermissions();
         checkFeatureSupport(Feature.PROGRESS_VALUE);
         peer.setProgressValue(value);
     }
 
     /**
      * Displays progress for specified window.
      *
      * @param w window to update
      * @param value from 0 to 100, other to disable progress indication
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#PROGRESS_VALUE_WINDOW} feature
      */
     public void setWindowProgressValue(Window w, int value) {
-        checkAWTPermission();
+        checkPermissions();
         checkFeatureSupport(Feature.PROGRESS_VALUE_WINDOW);
         if (w != null) {
             peer.setWindowProgressValue(w, value);
         }
     }

@@ -434,16 +449,17 @@
      * @see State#NORMAL
      * @see State#PAUSED
      * @see State#INDETERMINATE
      * @see State#ERROR
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#PROGRESS_STATE_WINDOW} feature
      */
     public void setWindowProgressState(Window w, State state) {
-        checkAWTPermission();
+        checkPermissions();
         checkFeatureSupport(Feature.PROGRESS_STATE_WINDOW);
         if (w != null) {
             peer.setWindowProgressState(w, state);
         }
     }
< prev index next >