blob: 909a50d73c57ff26a237f796d5ae3ce1ae6456e5 [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.app.Application;
20import android.content.Intent;
John Reck35e9dd62011-04-25 09:01:54 -070021import android.util.Log;
The Android Open Source Project0c908882009-03-03 19:32:16 -080022import android.webkit.CookieSyncManager;
23
24import dalvik.system.VMRuntime;
25
26public class Browser extends Application {
27
28 private final static String LOGTAG = "browser";
29
Dave Bort31a6d1c2009-04-13 15:56:49 -070030 // Set to true to enable extra debugging.
31 final static boolean DEBUG = false;
32
33 // Set to true to enable verbose logging.
34 final static boolean LOGV_ENABLED = DEBUG;
35
36 // Set to true to enable extra debug logging.
37 final static boolean LOGD_ENABLED = true;
38
The Android Open Source Project0c908882009-03-03 19:32:16 -080039 /**
40 * Specifies a heap utilization ratio that works better
41 * for the browser than the default ratio does.
42 */
43 private final static float TARGET_HEAP_UTILIZATION = 0.75f;
44
45 public Browser() {
46 }
47
John Reck6f48ba52010-12-03 16:03:14 -080048 @Override
The Android Open Source Project0c908882009-03-03 19:32:16 -080049 public void onCreate() {
Kristian Monsene800e8e2010-12-06 16:59:33 +000050 super.onCreate();
51
Dave Bort31a6d1c2009-04-13 15:56:49 -070052 if (LOGV_ENABLED)
The Android Open Source Project0c908882009-03-03 19:32:16 -080053 Log.v(LOGTAG, "Browser.onCreate: this=" + this);
Kristian Monsene800e8e2010-12-06 16:59:33 +000054
The Android Open Source Project0c908882009-03-03 19:32:16 -080055 // Fix heap utilization for better heap size characteristics.
56 VMRuntime.getRuntime().setTargetHeapUtilization(
57 TARGET_HEAP_UTILIZATION);
58 // create CookieSyncManager with current Context
59 CookieSyncManager.createInstance(this);
John Reck35e9dd62011-04-25 09:01:54 -070060 BrowserSettings.initialize(getApplicationContext());
Michael Kolb14612442011-06-24 13:06:29 -070061 Preloader.initialize(getApplicationContext());
The Android Open Source Project0c908882009-03-03 19:32:16 -080062 }
63
64 static Intent createBrowserViewIntent() {
65 Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
66 return intent;
67 }
68}
69