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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/installedapp/InstalledAppProviderFactory.java

Issue 2706403014: Add Android implementation of navigator.getInstalledRelatedApps. (Closed)
Patch Set: Fixed iframes (now has the correct origin of the frame, not the tab). 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
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.content.browser.installedapp;
6
7 import org.chromium.content.browser.ContentViewCore;
8 import org.chromium.content_public.browser.RenderFrameHost;
9 import org.chromium.content_public.browser.WebContentsStatics;
10 import org.chromium.installedapp.mojom.InstalledAppProvider;
11 import org.chromium.services.service_manager.InterfaceFactory;
12
13 /** Factory to create instances of the InstalledAppProvider Mojo service. */
14 public class InstalledAppProviderFactory implements InterfaceFactory<InstalledAp pProvider> {
15 private final RenderFrameHost mRenderFrameHost;
16
17 public InstalledAppProviderFactory(RenderFrameHost renderFrameHost) {
18 mRenderFrameHost = renderFrameHost;
19 }
20
21 @Override
22 public InstalledAppProvider createImpl() {
23 // Get Android application context from web contents.
24 ContentViewCore contentViewCore = ContentViewCore.fromWebContents(
25 WebContentsStatics.fromRenderFrameHost(mRenderFrameHost));
26 if (contentViewCore == null) {
27 return null;
28 }
29
30 String pageUrl = mRenderFrameHost.getLastCommittedURL();
boliu 2017/03/17 18:02:55 hmm, can the RFH navigate? in which case, caching
Matt Giuca 2017/03/20 06:31:56 I don't think so; I logged this code path and it g
boliu 2017/03/20 16:56:20 I don't think that testing is good enough here. n
Matt Giuca 2017/03/21 04:16:13 Ah, you're right. https://cs.chromium.org/chromiu
dcheng 2017/03/21 07:19:42 A RenderFrameHost is tied to a specific process ID
31 return new InstalledAppProviderImpl(pageUrl, contentViewCore.getContext( ));
boliu 2017/03/17 18:02:55 this is the application context in chrome iirc, is
Matt Giuca 2017/03/20 06:31:56 Done. Cool idea, that simplifies the code (I am pr
32 }
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698