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 17 package com.android.browser; 18 19 import android.util.Log; 20 21 import android.app.Application; 22 import android.content.Intent; 23 import android.webkit.CookieManager; 24 import android.webkit.CookieSyncManager; 25 26 import dalvik.system.VMRuntime; 27 28 public class Browser extends Application { 29 30 private final static String LOGTAG = "browser"; 31 32 // Set to true to enable extra debugging. 33 final static boolean DEBUG = false; 34 35 // Set to true to enable verbose logging. 36 final static boolean LOGV_ENABLED = DEBUG; 37 38 // Set to true to enable extra debug logging. 39 final static boolean LOGD_ENABLED = true; 40 41 /** 42 * Specifies a heap utilization ratio that works better 43 * for the browser than the default ratio does. 44 */ 45 private final static float TARGET_HEAP_UTILIZATION = 0.75f; 46 Browser()47 public Browser() { 48 } 49 onCreate()50 public void onCreate() { 51 if (LOGV_ENABLED) 52 Log.v(LOGTAG, "Browser.onCreate: this=" + this); 53 // Fix heap utilization for better heap size characteristics. 54 VMRuntime.getRuntime().setTargetHeapUtilization( 55 TARGET_HEAP_UTILIZATION); 56 // create CookieSyncManager with current Context 57 CookieSyncManager.createInstance(this); 58 // remove all expired cookies 59 CookieManager.getInstance().removeExpiredCookie(); 60 } 61 createBrowserViewIntent()62 static Intent createBrowserViewIntent() { 63 Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); 64 return intent; 65 } 66 } 67 68