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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/share/OptionalShareTargetsManager.java

Issue 2716293003: Abstract ShareActivity Class (Closed)
Patch Set: Removed Availability Created 3 years, 9 months 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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.chrome.browser.share; 5 package org.chromium.chrome.browser.share;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.content.ComponentName; 8 import android.content.ComponentName;
9 import android.content.pm.PackageManager; 9 import android.content.pm.PackageManager;
10 import android.os.AsyncTask; 10 import android.os.AsyncTask;
(...skipping 28 matching lines...) Expand all
39 * Enables sharing options. 39 * Enables sharing options.
40 * @param triggeringActivity The activity that will be triggering the share action. The 40 * @param triggeringActivity The activity that will be triggering the share action. The
41 * activity's state will be tracked to disable the options w hen 41 * activity's state will be tracked to disable the options w hen
42 * the share operation has been completed. 42 * the share operation has been completed.
43 * @param enabledClasses classes to be enabled. 43 * @param enabledClasses classes to be enabled.
44 * @param callback The callback to be triggered after the options have been enabled. This 44 * @param callback The callback to be triggered after the options have been enabled. This
45 * may or may not be synchronous depending on whether this w ill require 45 * may or may not be synchronous depending on whether this w ill require
46 * interacting with the Android framework. 46 * interacting with the Android framework.
47 */ 47 */
48 public static void enableOptionalShareActivities(final Activity triggeringAc tivity, 48 public static void enableOptionalShareActivities(final Activity triggeringAc tivity,
49 final List<Class<? extends Activity>> enabledClasses, final Runnable callback) { 49 final List<Class<? extends ShareActivity>> enabledClasses, final Run nable callback) {
50 ThreadUtils.assertOnUiThread(); 50 ThreadUtils.assertOnUiThread();
51 51
52 if (sStateListener == null) { 52 if (sStateListener == null) {
53 sStateListener = new ActivityStateListener() { 53 sStateListener = new ActivityStateListener() {
54 @Override 54 @Override
55 public void onActivityStateChange(Activity triggeringActivity, i nt newState) { 55 public void onActivityStateChange(Activity triggeringActivity, i nt newState) {
56 if (newState == ActivityState.PAUSED) return; 56 if (newState == ActivityState.PAUSED) return;
57 handleShareFinish(triggeringActivity); 57 handleShareFinish(triggeringActivity);
58 } 58 }
59 }; 59 };
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 try { 142 try {
143 sStateChangeTask.get(); 143 sStateChangeTask.get();
144 sStateChangeTask = null; 144 sStateChangeTask = null;
145 } catch (InterruptedException | ExecutionException e) { 145 } catch (InterruptedException | ExecutionException e) {
146 Log.e(TAG, "State change task did not complete as expected"); 146 Log.e(TAG, "State change task did not complete as expected");
147 } finally { 147 } finally {
148 StrictMode.setThreadPolicy(oldPolicy); 148 StrictMode.setThreadPolicy(oldPolicy);
149 } 149 }
150 } 150 }
151 } 151 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698