blob: 12c0c41829a2d38a18c0b6479b41d2cbf8f4bfe0 [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
John Reck6f48ba52010-12-03 16:03:14 -080019import android.os.FileUtils;
The Android Open Source Project0c908882009-03-03 19:32:16 -080020import android.util.Log;
21
22import android.app.Application;
23import android.content.Intent;
24import android.webkit.CookieManager;
25import android.webkit.CookieSyncManager;
26
27import dalvik.system.VMRuntime;
28
29public class Browser extends Application {
30
31 private final static String LOGTAG = "browser";
32
Dave Bort31a6d1c2009-04-13 15:56:49 -070033 // Set to true to enable extra debugging.
34 final static boolean DEBUG = false;
35
36 // Set to true to enable verbose logging.
37 final static boolean LOGV_ENABLED = DEBUG;
38
39 // Set to true to enable extra debug logging.
40 final static boolean LOGD_ENABLED = true;
41
The Android Open Source Project0c908882009-03-03 19:32:16 -080042 /**
43 * Specifies a heap utilization ratio that works better
44 * for the browser than the default ratio does.
45 */
46 private final static float TARGET_HEAP_UTILIZATION = 0.75f;
47
48 public Browser() {
49 }
50
John Reck6f48ba52010-12-03 16:03:14 -080051 @Override
The Android Open Source Project0c908882009-03-03 19:32:16 -080052 public void onCreate() {
John Reck6f48ba52010-12-03 16:03:14 -080053 // Set the umask so that native code creates files with the correct
54 // permissions (0660)
55 FileUtils.setUMask(FileUtils.S_IRWXO);
Dave Bort31a6d1c2009-04-13 15:56:49 -070056 if (LOGV_ENABLED)
The Android Open Source Project0c908882009-03-03 19:32:16 -080057 Log.v(LOGTAG, "Browser.onCreate: this=" + this);
58 // Fix heap utilization for better heap size characteristics.
59 VMRuntime.getRuntime().setTargetHeapUtilization(
60 TARGET_HEAP_UTILIZATION);
61 // create CookieSyncManager with current Context
62 CookieSyncManager.createInstance(this);
63 // remove all expired cookies
64 CookieManager.getInstance().removeExpiredCookie();
Ben Murdochef671652010-11-25 17:17:58 +000065 BrowserSettings.getInstance().asyncLoadFromDb(this);
The Android Open Source Project0c908882009-03-03 19:32:16 -080066 }
67
68 static Intent createBrowserViewIntent() {
69 Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
70 return intent;
71 }
72}
73