/WebVox/src/com/marvin/webvox/Browser.java

http://eyes-free.googlecode.com/ · Java · 67 lines · 28 code · 14 blank · 25 comment · 1 complexity · 0e5cb835e92bd4a4483467e03da27b9d MD5 · raw file

  1. /*
  2. * Copyright (C) 2006 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.marvin.webvox;
  17. import android.util.Log;
  18. import android.app.Application;
  19. import android.content.Intent;
  20. import android.webkit.CookieManager;
  21. import android.webkit.CookieSyncManager;
  22. import dalvik.system.VMRuntime;
  23. public class Browser extends Application {
  24. private final static String LOGTAG = "browser";
  25. // Set to true to enable extra debugging.
  26. final static boolean DEBUG = false;
  27. // Set to true to enable verbose logging.
  28. final static boolean LOGV_ENABLED = DEBUG;
  29. // Set to true to enable extra debug logging.
  30. final static boolean LOGD_ENABLED = true;
  31. /**
  32. * Specifies a heap utilization ratio that works better
  33. * for the browser than the default ratio does.
  34. */
  35. private final static float TARGET_HEAP_UTILIZATION = 0.75f;
  36. public Browser() {
  37. }
  38. public void onCreate() {
  39. if (LOGV_ENABLED)
  40. Log.v(LOGTAG, "Browser.onCreate: this=" + this);
  41. // Fix heap utilization for better heap size characteristics.
  42. VMRuntime.getRuntime().setTargetHeapUtilization(
  43. TARGET_HEAP_UTILIZATION);
  44. // create CookieSyncManager with current Context
  45. CookieSyncManager.createInstance(this);
  46. // remove all expired cookies
  47. CookieManager.getInstance().removeExpiredCookie();
  48. }
  49. static Intent createBrowserViewIntent() {
  50. Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
  51. return intent;
  52. }
  53. }