blob: 7822ec88fded803cd2aea8d278ce9c76a5a96cf1 [file] [log] [blame]
The Android Open Source Project0c908882009-03-03 19:32:16 -08001/*
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
17package com.android.browser;
18
The Android Open Source Project0c908882009-03-03 19:32:16 -080019import android.util.Log;
20
21import android.app.Application;
22import android.content.Intent;
23import android.webkit.CookieManager;
24import android.webkit.CookieSyncManager;
25
26import dalvik.system.VMRuntime;
27
28public class Browser extends Application {
29
30 private final static String LOGTAG = "browser";
31
Dave Bort31a6d1c2009-04-13 15:56:49 -070032 // 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
The Android Open Source Project0c908882009-03-03 19:32:16 -080041 /**
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
47 public Browser() {
48 }
49
50 public void onCreate() {
Dave Bort31a6d1c2009-04-13 15:56:49 -070051 if (LOGV_ENABLED)
The Android Open Source Project0c908882009-03-03 19:32:16 -080052 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();
Shimeng (Simon) Wang161974f2010-03-09 14:30:07 -080060 BrowserSettings.getInstance().loadFromDb(this);
The Android Open Source Project0c908882009-03-03 19:32:16 -080061 }
62
63 static Intent createBrowserViewIntent() {
64 Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
65 return intent;
66 }
67}
68