OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.ui.base; | 5 package org.chromium.ui.base; |
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.content.Intent; | 9 import android.content.Intent; |
10 import android.os.Bundle; | 10 import android.os.Bundle; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 * @param errorId The ID of error string to be show if activity is paused be fore intent | 51 * @param errorId The ID of error string to be show if activity is paused be fore intent |
52 * results. | 52 * results. |
53 * @return Whether the intent was shown. | 53 * @return Whether the intent was shown. |
54 */ | 54 */ |
55 public boolean showIntent(Intent intent, IntentCallback callback, int errorI d) { | 55 public boolean showIntent(Intent intent, IntentCallback callback, int errorI d) { |
56 Log.d(TAG, "Can't show intent as context is not an Activity: " + intent) ; | 56 Log.d(TAG, "Can't show intent as context is not an Activity: " + intent) ; |
57 return false; | 57 return false; |
58 } | 58 } |
59 | 59 |
60 /** | 60 /** |
61 * Removes a callback from the list of pending intents, so that nothing happ ens if/when the | |
62 * result for that intent is received. | |
63 * @param callback The object that should have received the results | |
64 * @return True if the callback was removed, false if it was not found. | |
65 */ | |
66 public boolean removeIntentCallback(IntentCallback callback) { | |
David Trainor- moved to gerrit
2013/11/19 23:27:39
Is this meant to cancel the action? If not, shoul
Jay Civelli
2013/11/20 00:46:40
You mean removing the callback from mOutstandingIn
| |
67 int requestCode = mOutstandingIntents.indexOfValue(callback); | |
68 if (requestCode < 0) return false; | |
69 mOutstandingIntents.remove(requestCode); | |
70 mIntentErrors.remove(requestCode); | |
71 return true; | |
72 } | |
73 | |
74 /** | |
61 * Displays an error message with a provided error message string. | 75 * Displays an error message with a provided error message string. |
62 * @param error The error message string to be displayed. | 76 * @param error The error message string to be displayed. |
63 */ | 77 */ |
64 public void showError(String error) { | 78 public void showError(String error) { |
65 if (error != null) { | 79 if (error != null) { |
66 Toast.makeText(mApplicationContext, error, Toast.LENGTH_SHORT).show( ); | 80 Toast.makeText(mApplicationContext, error, Toast.LENGTH_SHORT).show( ); |
67 } | 81 } |
68 } | 82 } |
69 | 83 |
70 /** | 84 /** |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 */ | 201 */ |
188 @CalledByNative | 202 @CalledByNative |
189 public byte[] grabSnapshot(int windowX, int windowY, int width, int height) { | 203 public byte[] grabSnapshot(int windowX, int windowY, int width, int height) { |
190 return null; | 204 return null; |
191 } | 205 } |
192 | 206 |
193 private native long nativeInit(); | 207 private native long nativeInit(); |
194 private native void nativeDestroy(long nativeWindowAndroid); | 208 private native void nativeDestroy(long nativeWindowAndroid); |
195 | 209 |
196 } | 210 } |
OLD | NEW |