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

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

Issue 2772343003: Android: Remove GetApplicationContext part 1 (Closed)
Patch Set: rebase Created 3 years, 8 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 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 352
353 return null; 353 return null;
354 } 354 }
355 355
356 @Override 356 @Override
357 protected void onPostExecute(File saveFile) { 357 protected void onPostExecute(File saveFile) {
358 if (saveFile == null) return; 358 if (saveFile == null) return;
359 359
360 if (ApplicationStatus.getStateForApplication() 360 if (ApplicationStatus.getStateForApplication()
361 != ApplicationState.HAS_DESTROYED_ACTIVITIES) { 361 != ApplicationState.HAS_DESTROYED_ACTIVITIES) {
362 Uri imageUri = ApiCompatibilityUtils.getUriForImageCaptureFi le(activity, 362 Uri imageUri = ApiCompatibilityUtils.getUriForImageCaptureFi le(saveFile);
363 saveFile);
364 363
365 Intent chooserIntent = Intent.createChooser(getShareImageInt ent(imageUri), 364 Intent chooserIntent = Intent.createChooser(getShareImageInt ent(imageUri),
366 activity.getString(R.string.share_link_chooser_title )); 365 activity.getString(R.string.share_link_chooser_title ));
367 fireIntent(activity, chooserIntent); 366 fireIntent(activity, chooserIntent);
368 } 367 }
369 } 368 }
370 }.execute(); 369 }.execute();
371 } 370 }
372 371
373 /** 372 /**
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 407
409 return null; 408 return null;
410 } 409 }
411 410
412 @Override 411 @Override
413 protected void onPostExecute(File savedFile) { 412 protected void onPostExecute(File savedFile) {
414 Uri fileUri = null; 413 Uri fileUri = null;
415 if (ApplicationStatus.getStateForApplication() 414 if (ApplicationStatus.getStateForApplication()
416 != ApplicationState.HAS_DESTROYED_ACTIVITIES 415 != ApplicationState.HAS_DESTROYED_ACTIVITIES
417 && savedFile != null) { 416 && savedFile != null) {
418 fileUri = ApiCompatibilityUtils.getUriForImageCaptureFile(co ntext, savedFile); 417 fileUri = ApiCompatibilityUtils.getUriForImageCaptureFile(sa vedFile);
419 } 418 }
420 callback.onResult(fileUri); 419 callback.onResult(fileUri);
421 } 420 }
422 }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); 421 }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
423 } 422 }
424 423
425 /** 424 /**
426 * Creates and shows a share intent picker dialog. 425 * Creates and shows a share intent picker dialog.
427 * 426 *
428 * @param saveLastUsed Whether to save the chosen activity for future direct sharing. 427 * @param saveLastUsed Whether to save the chosen activity for future direct sharing.
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 } 674 }
676 675
677 private static ComponentName getLastShareComponentName() { 676 private static ComponentName getLastShareComponentName() {
678 SharedPreferences preferences = ContextUtils.getAppSharedPreferences(); 677 SharedPreferences preferences = ContextUtils.getAppSharedPreferences();
679 String packageName = preferences.getString(PACKAGE_NAME_KEY, null); 678 String packageName = preferences.getString(PACKAGE_NAME_KEY, null);
680 String className = preferences.getString(CLASS_NAME_KEY, null); 679 String className = preferences.getString(CLASS_NAME_KEY, null);
681 if (packageName == null || className == null) return null; 680 if (packageName == null || className == null) return null;
682 return new ComponentName(packageName, className); 681 return new ComponentName(packageName, className);
683 } 682 }
684 } 683 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698