| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.app.Activity; | 8 import android.app.Activity; |
| 9 import android.app.PendingIntent; | 9 import android.app.PendingIntent; |
| 10 import android.content.BroadcastReceiver; | 10 import android.content.BroadcastReceiver; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 private static final long COMPONENT_INFO_READ_TIMEOUT_IN_MS = 1000; | 92 private static final long COMPONENT_INFO_READ_TIMEOUT_IN_MS = 1000; |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * Directory name for shared images. | 95 * Directory name for shared images. |
| 96 * | 96 * |
| 97 * Named "screenshot" for historical reasons as we only initially shared scr
eenshot images. | 97 * Named "screenshot" for historical reasons as we only initially shared scr
eenshot images. |
| 98 */ | 98 */ |
| 99 private static final String SHARE_IMAGES_DIRECTORY_NAME = "screenshot"; | 99 private static final String SHARE_IMAGES_DIRECTORY_NAME = "screenshot"; |
| 100 | 100 |
| 101 /** Force the use of a Chrome-specific intent chooser, not the system choose
r. */ | 101 /** Force the use of a Chrome-specific intent chooser, not the system choose
r. */ |
| 102 private static boolean sForceCustomChooserForTesting = false; | 102 private static boolean sForceCustomChooserForTesting; |
| 103 | 103 |
| 104 /** If non-null, will be used instead of the real activity. */ | 104 /** If non-null, will be used instead of the real activity. */ |
| 105 private static FakeIntentReceiver sFakeIntentReceiverForTesting; | 105 private static FakeIntentReceiver sFakeIntentReceiverForTesting; |
| 106 | 106 |
| 107 private ShareHelper() {} | 107 private ShareHelper() {} |
| 108 | 108 |
| 109 private static void fireIntent(Activity activity, Intent intent) { | 109 private static void fireIntent(Activity activity, Intent intent) { |
| 110 if (sFakeIntentReceiverForTesting != null) { | 110 if (sFakeIntentReceiverForTesting != null) { |
| 111 Context context = activity.getApplicationContext(); | 111 Context context = activity.getApplicationContext(); |
| 112 sFakeIntentReceiverForTesting.fireIntent(context, intent); | 112 sFakeIntentReceiverForTesting.fireIntent(context, intent); |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 } | 674 } |
| 675 | 675 |
| 676 private static ComponentName getLastShareComponentName() { | 676 private static ComponentName getLastShareComponentName() { |
| 677 SharedPreferences preferences = ContextUtils.getAppSharedPreferences(); | 677 SharedPreferences preferences = ContextUtils.getAppSharedPreferences(); |
| 678 String packageName = preferences.getString(PACKAGE_NAME_KEY, null); | 678 String packageName = preferences.getString(PACKAGE_NAME_KEY, null); |
| 679 String className = preferences.getString(CLASS_NAME_KEY, null); | 679 String className = preferences.getString(CLASS_NAME_KEY, null); |
| 680 if (packageName == null || className == null) return null; | 680 if (packageName == null || className == null) return null; |
| 681 return new ComponentName(packageName, className); | 681 return new ComponentName(packageName, className); |
| 682 } | 682 } |
| 683 } | 683 } |
| OLD | NEW |