// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.android_webview.shell;

import android.app.Application;
import android.os.Debug;
import android.util.Log;

import org.chromium.android_webview.AwBrowserProcess;
import org.chromium.base.BaseSwitches;
import org.chromium.base.CommandLine;
import org.chromium.base.ResourceExtractor;
import org.chromium.base.TraceEvent;

/**
 * The android_webview shell Application subclass.
 */
public class AwShellApplication extends Application {

    private static final String TAG = "AwShellApplication";
    /** The minimum set of .pak files the test runner needs. */
    private static final String[] MANDATORY_PAKS = { "icudtl.dat",
                                                     "natives_blob.bin",
                                                     "snapshot_blob.bin" };

    @Override
    public void onCreate() {
        super.onCreate();

        AwShellResourceProvider.registerResources(this);

        CommandLine.initFromFile("/data/local/tmp/android-webview-command-line");

        if (CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBUGGER)) {
            Log.e(TAG, "Waiting for Java debugger to connect...");
            Debug.waitForDebugger();
            Log.e(TAG, "Java debugger connected. Resuming execution.");
        }

        ResourceExtractor.setMandatoryPaksToExtract(MANDATORY_PAKS);
        ResourceExtractor.setExtractImplicitLocaleForTesting(false);
        AwBrowserProcess.loadLibrary();

        if (CommandLine.getInstance().hasSwitch(AwShellSwitches.ENABLE_ATRACE)) {
            Log.e(TAG, "Enabling Android trace.");
            TraceEvent.setATraceEnabled(true);
        }
    }
}

@@ -208,40 +208,8 @@
 l;%0A%0A
-import android.app.Application;%0A
 impo
@@ -466,16 +466,68 @@
 ceEvent;
+%0Aimport org.chromium.content.app.ContentApplication;
 %0A%0A/**%0A *
@@ -619,16 +619,23 @@
 extends 
+Content
 Applicat
@@ -1842,11 +1842,119 @@
  %7D%0A    %7D
+%0A%0A    @Override%0A    public void initCommandLine() %7B%0A        throw new UnsupportedOperationException();%0A    %7D
 %0A%7D%0A

Make WebView Shell can be profiled by adb_profile_chrome