where is the trunk commit? -igor
On Tue, Jul 13, 2010 at 4:26 AM, <jcompag...@apache.org> wrote: > Author: jcompagner > Date: Tue Jul 13 11:26:33 2010 > New Revision: 963681 > > URL: http://svn.apache.org/viewvc?rev=963681&view=rev > Log: > chrome browser detection (previously it was just safari) > > Modified: > > wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/ClientProperties.java > > wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java > > Modified: > wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/ClientProperties.java > URL: > http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/ClientProperties.java?rev=963681&r1=963680&r2=963681&view=diff > ============================================================================== > --- > wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/ClientProperties.java > (original) > +++ > wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/ClientProperties.java > Tue Jul 13 11:26:33 2010 > @@ -59,6 +59,7 @@ public class ClientProperties implements > private boolean browserMozillaFirefox; > private boolean browserOpera; > private boolean browserSafari; > + private boolean browserChrome; > private int browserVersionMajor = -1; > private int browserVersionMinor = -1; > private int browserWidth = -1; > @@ -415,6 +416,16 @@ public class ClientProperties implements > } > > /** > + * Flag indicating that the browser is a derivative of the Chrome > browser platform. > + * > + * @return True if a derivative of the Chrome browser platform. > + */ > + public boolean isBrowserChrome() > + { > + return browserChrome; > + } > + > + /** > * > * > * @return The client's navigator.cookieEnabled property. > @@ -751,6 +762,17 @@ public class ClientProperties implements > } > > /** > + * Flag indicating that the browser is a derivative of the Chrome > browser platform. > + * > + * @param browserChrome > + * True if a derivative of the Chrome browser platform. > + */ > + public void setBrowserChrome(boolean browserChrome) > + { > + this.browserChrome = browserChrome; > + } > + > + /** > * @param browserVersionMajor > * The major version number of the browser. > */ > > Modified: > wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java > URL: > http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java?rev=963681&r1=963680&r2=963681&view=diff > ============================================================================== > --- > wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java > (original) > +++ > wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java > Tue Jul 13 11:26:33 2010 > @@ -146,14 +146,20 @@ public class WebClientInfo extends Clien > { > String userAgent = (getUserAgent() != null) ? > getUserAgent().toLowerCase() : ""; > > + boolean browserChrome = userAgent.indexOf("chrome") != -1; > boolean browserOpera = userAgent.indexOf("opera") != -1; > - boolean browserSafari = userAgent.indexOf("safari") != -1; > boolean browserKonqueror = userAgent.indexOf("konqueror") != > -1; > > // Note deceptive user agent fields: > - // - Konqueror and Safari UA fields contain "like Gecko" > + // - Konqueror and Chrome UA fields contain "like Gecko" > // - Opera UA field typically contains "MSIE" > - boolean deceptiveUserAgent = browserOpera || browserSafari || > browserKonqueror; > + // - Chrome UA field contains "Safari" > + boolean deceptiveUserAgent = browserOpera || browserKonqueror > || browserChrome; > + > + boolean browserSafari = !deceptiveUserAgent && > userAgent.indexOf("safari") != -1; > + > + // -Safari UA fields contain "like Gecko" > + deceptiveUserAgent = deceptiveUserAgent || browserSafari; > > boolean browserMozilla = !deceptiveUserAgent && > userAgent.indexOf("gecko") != -1; > boolean browserFireFox = userAgent.indexOf("firefox") != -1; > @@ -174,6 +180,10 @@ public class WebClientInfo extends Clien > { > properties.setBrowserSafari(true); > } > + else if (browserChrome) > + { > + properties.setBrowserChrome(true); > + } > else if (browserMozilla) > { > properties.setBrowserMozilla(true); > > >