Don't use <iframe> for sign-in on a mobile device

Trying to use the <iframe> based sign-in on an Android or
an iPhone/iPod mobile device is very difficult.  The total
screen space is just too small to float the window onto.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-01-27 13:16:28 -08:00
parent f04ff6b504
commit d1f5c36809
3 changed files with 62 additions and 11 deletions

View File

@@ -3,19 +3,9 @@
<inherits name='com.google.gwtjsonrpc.GWTJSONRPC'/>
<inherits name='com.google.gwtorm.GWTORM'/>
<inherits name='com.google.gwt.user.theme.chrome.Chrome'/>
<inherits name='com.google.gerrit.UserAgent'/>
<extend-property name="locale" values="en"/>
<!-- openid.AllowFrameImpl -->
<replace-with class="com.google.gerrit.client.openid.AllowFrameImpl">
<when-type-is class="com.google.gerrit.client.openid.AllowFrameImpl"/>
</replace-with>
<replace-with class="com.google.gerrit.client.openid.AllowFrameImplSafari">
<when-type-is class="com.google.gerrit.client.openid.AllowFrameImpl" />
<any>
<when-property-is name="user.agent" value="safari"/>
</any>
</replace-with>
<!-- /openid.AllowFrameImpl -->
<entry-point class='com.google.gerrit.client.Gerrit'/>
<stylesheet src='Gerrit.css' />

View File

@@ -0,0 +1,37 @@
<module>
<define-property name="extUserAgent" values="mobile"/>
<property-provider name="extUserAgent"><![CDATA[
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("safari") != -1) {
if (ua.indexOf("iphone") != -1)
return "mobile";
if (ua.indexOf("ipod") != -1)
return "mobile";
if (ua.indexOf("android") != -1)
return "mobile";
}
return "unknown";
]]></property-provider>
<!-- openid.AllowFrameImpl -->
<replace-with class="com.google.gerrit.client.openid.AllowFrameImplMobile">
<when-type-is class="com.google.gerrit.client.openid.AllowFrameImpl" />
<any>
<when-property-is name="user.agent" value="safari"/>
<when-property-is name="extUserAgent" value="mobile"/>
</any>
</replace-with>
<replace-with class="com.google.gerrit.client.openid.AllowFrameImplSafari">
<when-type-is class="com.google.gerrit.client.openid.AllowFrameImpl" />
<any>
<when-property-is name="user.agent" value="safari"/>
</any>
</replace-with>
<replace-with class="com.google.gerrit.client.openid.AllowFrameImpl">
<when-type-is class="com.google.gerrit.client.openid.AllowFrameImpl"/>
</replace-with>
<!-- /openid.AllowFrameImpl -->
</module>

View File

@@ -0,0 +1,24 @@
// Copyright 2009 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.client.openid;
class AllowFrameImplMobile extends AllowFrameImpl {
@Override
boolean permit(final String url) {
// Working an IFRAME on a tiny device is difficult.
//
return false;
}
}