Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.android_webview; | 5 package org.chromium.android_webview; |
| 6 | 6 |
| 7 import android.content.ContentResolver; | 7 import android.content.ContentResolver; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.net.Uri; | 9 import android.net.Uri; |
| 10 import android.os.AsyncTask; | 10 import android.os.AsyncTask; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 // This is only called in chrome layers. | 128 // This is only called in chrome layers. |
| 129 assert false; | 129 assert false; |
| 130 } | 130 } |
| 131 | 131 |
| 132 @Override | 132 @Override |
| 133 public void closeContents() { | 133 public void closeContents() { |
| 134 mContentsClient.onCloseWindow(); | 134 mContentsClient.onCloseWindow(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 @Override | 137 @Override |
| 138 public void showRepostFormWarningDialog(final ContentViewCore contentViewCor e) { | 138 public void showRepostFormWarningDialog(final ContentViewCore contentViewCor e) { |
|
boliu
2014/09/13 00:38:53
Content should pass up a NavigationController inst
AKVT
2014/09/13 11:30:50
@boliu. I will correct in follow up patch.
| |
| 139 // TODO(mkosiba) We should be using something akin to the JsResultReceiv er as the | 139 // TODO(mkosiba) We should be using something akin to the JsResultReceiv er as the |
| 140 // callback parameter (instead of ContentViewCore) and implement a way o f converting | 140 // callback parameter (instead of ContentViewCore) and implement a way o f converting |
| 141 // that to a pair of messages. | 141 // that to a pair of messages. |
| 142 final int msgContinuePendingReload = 1; | 142 final int msgContinuePendingReload = 1; |
| 143 final int msgCancelPendingReload = 2; | 143 final int msgCancelPendingReload = 2; |
| 144 | 144 |
| 145 // TODO(sgurun) Remember the URL to cancel the reload behavior | 145 // TODO(sgurun) Remember the URL to cancel the reload behavior |
| 146 // if it is different than the most recent NavigationController entry. | 146 // if it is different than the most recent NavigationController entry. |
| 147 final Handler handler = new Handler(ThreadUtils.getUiThreadLooper()) { | 147 final Handler handler = new Handler(ThreadUtils.getUiThreadLooper()) { |
| 148 @Override | 148 @Override |
| 149 public void handleMessage(Message msg) { | 149 public void handleMessage(Message msg) { |
| 150 switch(msg.what) { | 150 switch(msg.what) { |
| 151 case msgContinuePendingReload: { | 151 case msgContinuePendingReload: { |
| 152 contentViewCore.continuePendingReload(); | 152 contentViewCore.getWebContents().getNavigationController () |
| 153 .continuePendingReload(); | |
| 153 break; | 154 break; |
| 154 } | 155 } |
| 155 case msgCancelPendingReload: { | 156 case msgCancelPendingReload: { |
| 156 contentViewCore.cancelPendingReload(); | 157 contentViewCore.getWebContents().getNavigationController () |
| 158 .cancelPendingReload(); | |
| 157 break; | 159 break; |
| 158 } | 160 } |
| 159 default: | 161 default: |
| 160 throw new IllegalStateException( | 162 throw new IllegalStateException( |
| 161 "WebContentsDelegateAdapter: unhandled message " + msg.what); | 163 "WebContentsDelegateAdapter: unhandled message " + msg.what); |
| 162 } | 164 } |
| 163 } | 165 } |
| 164 }; | 166 }; |
| 165 | 167 |
| 166 Message resend = handler.obtainMessage(msgContinuePendingReload); | 168 Message resend = handler.obtainMessage(msgContinuePendingReload); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 * or an empty string otherwise. | 253 * or an empty string otherwise. |
| 252 */ | 254 */ |
| 253 private String resolveFileName(String filePath) { | 255 private String resolveFileName(String filePath) { |
| 254 if (mContentResolver == null || filePath == null) return ""; | 256 if (mContentResolver == null || filePath == null) return ""; |
| 255 Uri uri = Uri.parse(filePath); | 257 Uri uri = Uri.parse(filePath); |
| 256 return ContentUriUtils.getDisplayName( | 258 return ContentUriUtils.getDisplayName( |
| 257 uri, mContentResolver, MediaStore.MediaColumns.DISPLAY_NAME) ; | 259 uri, mContentResolver, MediaStore.MediaColumns.DISPLAY_NAME) ; |
| 258 } | 260 } |
| 259 } | 261 } |
| 260 } | 262 } |
| OLD | NEW |