Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8E2A0111E6 for ; Thu, 17 Jul 2014 15:22:29 +0000 (UTC) Received: (qmail 71154 invoked by uid 500); 17 Jul 2014 15:22:29 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 71118 invoked by uid 500); 17 Jul 2014 15:22:29 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 71097 invoked by uid 99); 17 Jul 2014 15:22:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Jul 2014 15:22:28 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of agrieve@google.com designates 209.85.223.171 as permitted sender) Received: from [209.85.223.171] (HELO mail-ie0-f171.google.com) (209.85.223.171) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Jul 2014 15:22:23 +0000 Received: by mail-ie0-f171.google.com with SMTP id at1so3133780iec.30 for ; Thu, 17 Jul 2014 08:22:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=2e8i9sd5TLMINYMCvbIda0oyztV/KBhsm1o8gJK1xX8=; b=NL32b/vpkXtbf7/S/ql5kdOMYIHjcwQx+eIZZmDctUufeg6kcRiC1+1cE7Q4+bwN+z /txkp/1qwFI+V3tNKbeEdxgRd8IVdC6xeFTaPV5natI7KZCe+V7NkK1qJIRLOcM5PioU kQHROB8q+Ak53/PtG/dL0i07PPWE100RZreEYBl0Z+8osmeF5fKM0Ki9a35MzKmkWLgN EQlnoPCsSd77+eySxJJU9wcQ7TtG2jXTijZ4Obj8zWA4zMNc1fot4NYKQsS4qOHeApWO 2U+p1M9T+4kqEhw2rYKWrUvkFL4f4X9E/plk75Mu5R9GkeIwIlbavtm2/lNUnCZZcQXw ZQGQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=2e8i9sd5TLMINYMCvbIda0oyztV/KBhsm1o8gJK1xX8=; b=nmLqBAf9re0PSRoElvMJKPuJPB7FF/HmJWIDXNgNzUvqmUGoENu8dWsP8AXDGRyrzR ubMlRK4fIHG3JxwPVaEa5wcrh2DprvYeZeYraoJVv4+JvQSwzts+aD5pTcJMdxVVyx4T L3QzwONaEJJbaOFtk/2Eff9mTbc9yma5DHxRg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:content-type; bh=2e8i9sd5TLMINYMCvbIda0oyztV/KBhsm1o8gJK1xX8=; b=CV2aRYB32HEofpI8mBRLyYqV8tLCwaigdi+xs1DKnOcb6UDorJJfxlxkSaFYkkMzoF yZ01SdHQozmZbyWx3ANKLTe8UbUd1ZfRH9zgB/5q7HEGsie1UnGLcxNxZQk/srODOmLC v/osecpFnnUf3Dw/o3g0rwJ4PLqDFHPA8lTZL5graJrO0G5gsJLYtV3ZLweZcoiv2K7u PH7jGnvXpQs8HdUcjLpCWIGWEQCI23zZX6n3WgayBVGUZD2Kghy1KVuD7oBl7Z2qWJN2 ZhEpKojVihpFiWQIc+9Nxgvp/tX5Dh00690cmAf/o1pLw8/ib0/jgMZzgaI/aRcXnZj1 akKw== X-Gm-Message-State: ALoCoQlunFOogA2FXsuwYhNVpVaDC/d5lkVBwbJ9NUgjvEY1WsGDpt9RsfwJugBCLYFH/8NJbhKv X-Received: by 10.60.97.230 with SMTP id ed6mr5256351oeb.81.1405610522980; Thu, 17 Jul 2014 08:22:02 -0700 (PDT) MIME-Version: 1.0 Sender: agrieve@google.com Received: by 10.182.241.201 with HTTP; Thu, 17 Jul 2014 08:21:42 -0700 (PDT) In-Reply-To: References: From: Andrew Grieve Date: Thu, 17 Jul 2014 11:21:42 -0400 X-Google-Sender-Auth: bvroRXchOKaJ3K1YEWlDQBI4VLI Message-ID: Subject: Re: Pluggable webview design thread To: dev Content-Type: multipart/alternative; boundary=089e0115f46eea655d04fe6533bc X-Virus-Checked: Checked by ClamAV on apache.org --089e0115f46eea655d04fe6533bc Content-Type: text/plain; charset=UTF-8 Thanks Ian! Probably a good idea to discuss the heck of this. On Wed, Jul 16, 2014 at 4:23 PM, Ian Clelland wrote: > [Opening this discussion up on the list, as it had previously been the > domain of private conversations and limited-audience discussions] > > On the 4.0.x branch, we're developing an API for pluggable webviews. With > Cordova-Android 4.0.0, we are going to be providing a reference > implementation, "AndroidWebView", which uses the system webview, and should > be externally identical to the webview provided by Cordova 3.x (and > earlier). > > The API is going to be made available for third parties to implement > compatible WebViews against, such as Crosswalk and GeckoView. Since third > parties are going to be coding against this API, it will be difficult to > change once released, so we'd like to get it right the first time. > > This email thread is about defining that API, and getting consensus so that > we can start to stabilize the 4.0.x branch. > > In the interest of backwards-compatibility, and of feature-parity with > previous releases, I think that these things are important (but are all up > for discussion): > > - The AndroidWebView implementation should be (i.e. java:extends) an > actual android.webkit.WebView, for the sake of existing applications which > assume that this is the case. > - New webviews shouldn't have that restriction, since they *aren't* > android.webkit.WebView's, there's no reason for them to extend one. > - Because of Java's lack of multiple inheritance, this kinda means > that CordovaWebView needs to be an interface. > There are two clients that I think we need to consider: 1. CordovaActivity 2. Plugins Plugins are the more important case I think, because using plugins doesn't mean you understand how to edit your java. For CordovaActivity however, I think so long as we are backwards compatible with the default template, then other changes are more fair-game because they affect only developers who have some understanding of Java anyways. For AndroidWebView extending WebView, I don't see how doing this helps with backwards compatibility. Both CordovaActivity and Plugins hold a reference to the webview as a CordovaWebView interface, and so the inheritance structure of the implementing class is unknown to them. E.g. They would need to explicitly cast CordovaWebView -> AndroidWebView to exploit the fact that it extends WebView. Might as well have the call .getView() so that their code works with any WebView. > - It was previously possible for a subclass of CordovaActivity to provide > a makeWebViewClient and/or makeChromeClient method, to override the default > construction of these objects. This is a public API, for users who have > specific needs from their webview, and we should maintain that. > - By default, those methods should just defer to the instantiated > WebView to create its own client objects ("do the right thing"), but it > *should* be overridable by the application developer to provide whatever > objects are appropriate for *their* application, without having to hack on > the webview code. > - It's okay that app developers would have to know the concrete class > of the client objects they are creating. It's their app, and they know what > engine they are choosing to use. > - Making CordovaActivity "do the right thing" by default does involve > some complicated logic in CordovaActivity and the engine WebViews, but I > think it's worth it. > - Before commit 'efcedabe', this was previously implemented. > So - reason I think these functions don't make sense: they only apply to when the WebView is an AndroidWebView. Each engine has their own set of helper classes. What we *could* do is: - Use an instanceof check to see if the webview is an AndroidWebView - Only if it is, call these make*Client() functions However, I think this is a pretty confusing thing to have these hooks if they apply only to one engine. Instead, subclasses can override makeWebView() and hook up whatever Client subclasses they want as a part of that (or do any other initialization of it that they want). This means if anyone has overridden the make*Client() methods now, they'll need to update their code, but if this is the case, then we're dealing with people that already understand how to write Java, and the change is quite mechanical. > > I'm going to write up the actual API as I see it being implemented, and > then we can discuss that to. I'll post it back to this thread. > > Ian > --089e0115f46eea655d04fe6533bc--