1 /*
   2  * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.webkit;
  27 
  28 import java.lang.annotation.Native;
  29 
  30 public interface LoadListenerClient {
  31     @Native public final static int PAGE_STARTED = 0;
  32     @Native public final static int PAGE_FINISHED = 1;
  33     @Native public final static int PAGE_REDIRECTED = 2;
  34     @Native public final static int LOAD_FAILED = 5;
  35     @Native public final static int LOAD_STOPPED = 6;
  36     @Native public final static int CONTENT_RECEIVED = 10;
  37     @Native public final static int TITLE_RECEIVED = 11;
  38     @Native public final static int ICON_RECEIVED = 12;
  39     @Native public final static int CONTENTTYPE_RECEIVED = 13;
  40     @Native public final static int DOCUMENT_AVAILABLE = 14;
  41     @Native public final static int RESOURCE_STARTED = 20;
  42     @Native public final static int RESOURCE_REDIRECTED = 21;
  43     @Native public final static int RESOURCE_FINISHED = 22;
  44     @Native public final static int RESOURCE_FAILED = 23;
  45     @Native public final static int PROGRESS_CHANGED = 30;
  46 
  47 
  48     // -- Error Code values
  49     /**
  50      * An error code indicating that the host name couldn't be resolved.
  51      */
  52     @Native public final static int UNKNOWN_HOST = 1;
  53     /**
  54      * An error code indicating that the URL was malformed or illegal.
  55      */
  56     @Native public final static int MALFORMED_URL = 2;
  57     /**
  58      * An error code indicating that the SSL handshake failed.
  59      */
  60     @Native public final static int SSL_HANDSHAKE = 3;
  61     /**
  62      * An error code indicating that the connection was refused by the server.
  63      */
  64     @Native public final static int CONNECTION_REFUSED = 4;
  65     /**
  66      * An error code indicating that the connection was reset by the server.
  67      */
  68     @Native public final static int CONNECTION_RESET = 5;
  69     /**
  70      * An error code indicating that there was no route to the host.
  71      */
  72     @Native public final static int NO_ROUTE_TO_HOST = 6;
  73     /**
  74      * An error code indicating that the connection timed out.
  75      */
  76     @Native public final static int CONNECTION_TIMED_OUT = 7;
  77     /**
  78      * An error code indicating that the client was denied permission
  79      * to initiate connection to the server.
  80      */
  81     @Native public final static int PERMISSION_DENIED = 8;
  82     /**
  83      * An error code indicating that the server response was invalid.
  84      */
  85     @Native public final static int INVALID_RESPONSE = 9;
  86     /**
  87      * An error code indicating that too many redirects were encountered
  88      * while processing the request.
  89      */
  90     @Native public final static int TOO_MANY_REDIRECTS = 10;
  91     /**
  92      * An error code indicating that the requested local file was not found.
  93      */
  94     @Native public final static int FILE_NOT_FOUND = 11;
  95     /**
  96      * An error code indicating that an unknown error occurred.
  97      */
  98     @Native public final static int UNKNOWN_ERROR = 99;
  99 
 100 
 101     public void dispatchLoadEvent(long frame, int state,
 102                                   String url, String contentType,
 103                                   double progress, int errorCode);
 104 
 105     public void dispatchResourceLoadEvent(long frame, int state,
 106                                           String url, String contentType,
 107                                           double progress, int errorCode);
 108 }