<!-- Do not translate. Testing only -->
<string name="dump_nav" translatable="false">Dump navigation cache</string>
+ <!-- The default homepage. If it starts with "http://www.google" and the
+ user signs up the device with a Google sites account, the site's
+ domain will be appended. -->
+ <string name="homepage_base">http://www.google.com/m?client=ms-{CID}</string>
+
<!-- Bookmarks -->
<string-array name="bookmarks" translatable="false">
<item>Google</item>
try {
if (mGls == null) return;
+ if (!homepage.startsWith("http://www.google.")) return;
+ if (homepage.indexOf('?') == -1) return;
+
String hostedUser = mGls.getAccount(GoogleLoginServiceConstants.PREFER_HOSTED);
String googleUser = mGls.getAccount(GoogleLoginServiceConstants.REQUIRE_GOOGLE);
if (googleUser == null || !hostedUser.equals(googleUser)) {
String domain = hostedUser.substring(hostedUser.lastIndexOf('@')+1);
- homepage = "http://www.google.com/m/a/" + domain + "?client=ms-" +
- Partner.getString(BrowserActivity.this.getContentResolver(), Partner.CLIENT_ID);
+ homepage = homepage.replace("?", "/a/" + domain + "?");
}
} catch (RemoteException ignore) {
// Login service died; carry on
private boolean saveFormData = true;
private boolean openInBackground = false;
private String defaultTextEncodingName;
- private String homeUrl = "http://www.google.com/m?client=ms-";
+ private String homeUrl = "";
private boolean loginInitialized = false;
private boolean autoFitPage = true;
private boolean showDebugSettings = false;
// local directory.
pluginsPath = ctx.getDir("plugins", 0).getPath();
- homeUrl += Partner.getString(ctx.getContentResolver(), Partner.CLIENT_ID);
+ homeUrl = getFactoryResetHomeUrl(ctx);
// Load the defaults from the xml
// This call is TOO SLOW, need to manually keep the defaults
p.edit().clear().commit();
PreferenceManager.setDefaultValues(context, R.xml.browser_preferences,
true);
+ // reset homeUrl
+ setHomePage(context, getFactoryResetHomeUrl(context));
+ }
+
+ private String getFactoryResetHomeUrl(Context context) {
+ String url = context.getResources().getString(R.string.homepage_base);
+ if (url.indexOf("{CID}") != -1) {
+ url = url.replace("{CID}", Partner.getString(context
+ .getContentResolver(), Partner.CLIENT_ID));
+ }
+ return url;
}
// Private constructor that does nothing.