Java Code Examples for org.chromium.base.ThreadUtils#getUiThreadLooper()

The following examples show how to use org.chromium.base.ThreadUtils#getUiThreadLooper() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AwWebContentsDelegateAdapter.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void showRepostFormWarningDialog(final ContentViewCore contentViewCore) {
    // TODO(mkosiba) We should be using something akin to the JsResultReceiver as the
    // callback parameter (instead of ContentViewCore) and implement a way of converting
    // that to a pair of messages.
    final int MSG_CONTINUE_PENDING_RELOAD = 1;
    final int MSG_CANCEL_PENDING_RELOAD = 2;

    // TODO(sgurun) Remember the URL to cancel the reload behavior
    // if it is different than the most recent NavigationController entry.
    final Handler handler = new Handler(ThreadUtils.getUiThreadLooper()) {
        @Override
        public void handleMessage(Message msg) {
            switch(msg.what) {
                case MSG_CONTINUE_PENDING_RELOAD: {
                    contentViewCore.continuePendingReload();
                    break;
                }
                case MSG_CANCEL_PENDING_RELOAD: {
                    contentViewCore.cancelPendingReload();
                    break;
                }
                default:
                    throw new IllegalStateException(
                            "WebContentsDelegateAdapter: unhandled message " + msg.what);
            }
        }
    };

    Message resend = handler.obtainMessage(MSG_CONTINUE_PENDING_RELOAD);
    Message dontResend = handler.obtainMessage(MSG_CANCEL_PENDING_RELOAD);
    mContentsClient.onFormResubmission(dontResend, resend);
}
 
Example 2
Source File: AwWebContentsDelegateAdapter.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void showRepostFormWarningDialog(final ContentViewCore contentViewCore) {
    // TODO(mkosiba) We should be using something akin to the JsResultReceiver as the
    // callback parameter (instead of ContentViewCore) and implement a way of converting
    // that to a pair of messages.
    final int MSG_CONTINUE_PENDING_RELOAD = 1;
    final int MSG_CANCEL_PENDING_RELOAD = 2;

    // TODO(sgurun) Remember the URL to cancel the reload behavior
    // if it is different than the most recent NavigationController entry.
    final Handler handler = new Handler(ThreadUtils.getUiThreadLooper()) {
        @Override
        public void handleMessage(Message msg) {
            switch(msg.what) {
                case MSG_CONTINUE_PENDING_RELOAD: {
                    contentViewCore.continuePendingReload();
                    break;
                }
                case MSG_CANCEL_PENDING_RELOAD: {
                    contentViewCore.cancelPendingReload();
                    break;
                }
                default:
                    throw new IllegalStateException(
                            "WebContentsDelegateAdapter: unhandled message " + msg.what);
            }
        }
    };

    Message resend = handler.obtainMessage(MSG_CONTINUE_PENDING_RELOAD);
    Message dontResend = handler.obtainMessage(MSG_CANCEL_PENDING_RELOAD);
    mContentsClient.onFormResubmission(dontResend, resend);
}
 
Example 3
Source File: NullContentsClient.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public NullContentsClient() {
    this(ThreadUtils.getUiThreadLooper());
}
 
Example 4
Source File: NullContentsClient.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public NullContentsClient() {
    this(ThreadUtils.getUiThreadLooper());
}