Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Side by Side Diff: ui/android/java/src/org/chromium/ui/base/WindowAndroid.java

Issue 32543003: Adding a way to remove an intent callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding a way to remove an intent callback. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698