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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/IntentHelper.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.accounts.Account; 7 import android.accounts.Account;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.net.Uri; 10 import android.net.Uri;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 if (!TextUtils.isEmpty(email)) send.putExtra(Intent.EXTRA_EMAIL, new Str ing[] { email }); 54 if (!TextUtils.isEmpty(email)) send.putExtra(Intent.EXTRA_EMAIL, new Str ing[] { email });
55 send.putExtra(Intent.EXTRA_SUBJECT, subject); 55 send.putExtra(Intent.EXTRA_SUBJECT, subject);
56 send.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(body)); 56 send.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(body));
57 if (!TextUtils.isEmpty(fileToAttach)) { 57 if (!TextUtils.isEmpty(fileToAttach)) {
58 File fileIn = new File(fileToAttach); 58 File fileIn = new File(fileToAttach);
59 Uri fileUri; 59 Uri fileUri;
60 // Attempt to use a content Uri, for greater compatibility. If the path isn't set 60 // Attempt to use a content Uri, for greater compatibility. If the path isn't set
61 // up to be shared that way with a <paths> meta-data element, just u se a file Uri 61 // up to be shared that way with a <paths> meta-data element, just u se a file Uri
62 // instead. 62 // instead.
63 try { 63 try {
64 fileUri = ContentUriUtils.getContentUriFromFile(context, fileIn) ; 64 fileUri = ContentUriUtils.getContentUriFromFile(fileIn);
65 } catch (IllegalArgumentException ex) { 65 } catch (IllegalArgumentException ex) {
66 fileUri = Uri.fromFile(fileIn); 66 fileUri = Uri.fromFile(fileIn);
67 } 67 }
68 send.putExtra(Intent.EXTRA_STREAM, fileUri); 68 send.putExtra(Intent.EXTRA_STREAM, fileUri);
69 } 69 }
70 70
71 try { 71 try {
72 Intent chooser = Intent.createChooser(send, chooserTitle); 72 Intent chooser = Intent.createChooser(send, chooserTitle);
73 // we start this activity outside the main activity. 73 // we start this activity outside the main activity.
74 chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 74 chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
(...skipping 13 matching lines...) Expand all
88 Intent intent = new Intent(android.provider.Settings.ACTION_DATE_SETTING S); 88 Intent intent = new Intent(android.provider.Settings.ACTION_DATE_SETTING S);
89 89
90 try { 90 try {
91 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 91 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
92 context.startActivity(intent); 92 context.startActivity(intent);
93 } catch (android.content.ActivityNotFoundException ex) { 93 } catch (android.content.ActivityNotFoundException ex) {
94 // If it doesn't work, avoid crashing. 94 // If it doesn't work, avoid crashing.
95 } 95 }
96 } 96 }
97 } 97 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698