| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.webshare; | 5 package org.chromium.chrome.browser.webshare; |
| 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.support.annotation.Nullable; | 9 import android.support.annotation.Nullable; |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 callback.call("Share failed"); | 38 callback.call("Share failed"); |
| 39 return; | 39 return; |
| 40 } | 40 } |
| 41 | 41 |
| 42 ShareHelper.TargetChosenCallback innerCallback = new ShareHelper.TargetC
hosenCallback() { | 42 ShareHelper.TargetChosenCallback innerCallback = new ShareHelper.TargetC
hosenCallback() { |
| 43 public void onTargetChosen(ComponentName chosenComponent) { | 43 public void onTargetChosen(ComponentName chosenComponent) { |
| 44 callback.call(null); | 44 callback.call(null); |
| 45 } | 45 } |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 ShareHelper.share(false, false, mActivity, title, text, null, null, inne
rCallback); | 48 ShareHelper.share(false, false, mActivity, title, text, null, null, null
, innerCallback); |
| 49 } | 49 } |
| 50 | 50 |
| 51 @Nullable | 51 @Nullable |
| 52 private static Activity activityFromWebContents(@Nullable WebContents webCon
tents) { | 52 private static Activity activityFromWebContents(@Nullable WebContents webCon
tents) { |
| 53 if (webContents == null) return null; | 53 if (webContents == null) return null; |
| 54 | 54 |
| 55 ContentViewCore contentViewCore = ContentViewCore.fromWebContents(webCon
tents); | 55 ContentViewCore contentViewCore = ContentViewCore.fromWebContents(webCon
tents); |
| 56 if (contentViewCore == null) return null; | 56 if (contentViewCore == null) return null; |
| 57 | 57 |
| 58 WindowAndroid window = contentViewCore.getWindowAndroid(); | 58 WindowAndroid window = contentViewCore.getWindowAndroid(); |
| 59 if (window == null) return null; | 59 if (window == null) return null; |
| 60 | 60 |
| 61 return window.getActivity().get(); | 61 return window.getActivity().get(); |
| 62 } | 62 } |
| 63 } | 63 } |
| OLD | NEW |