Chromium Code Reviews| Index: content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java |
| diff --git a/content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java b/content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java |
| index bddb70f316753ae564bb10700aea9dad876fadb3..c1a07c3cb0a9d826045c55cc0e2b72c2aec40844 100644 |
| --- a/content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java |
| +++ b/content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java |
| @@ -5,7 +5,10 @@ |
| package org.chromium.content_shell; |
| import android.app.Activity; |
| +import android.content.BroadcastReceiver; |
| +import android.content.Context; |
| import android.content.Intent; |
| +import android.content.IntentFilter; |
| import android.os.Bundle; |
| import android.text.TextUtils; |
| import android.util.Log; |
| @@ -17,6 +20,7 @@ import org.chromium.content.browser.ActivityContentVideoViewDelegate; |
| import org.chromium.content.browser.ContentVideoView; |
| import org.chromium.content.browser.ContentView; |
| import org.chromium.content.browser.DeviceUtils; |
| +import org.chromium.content.browser.TraceController; |
| import org.chromium.content.common.CommandLine; |
| import org.chromium.ui.gfx.ActivityNativeWindow; |
| @@ -29,11 +33,14 @@ public class ContentShellActivity extends ChromiumActivity { |
| private static final String TAG = ContentShellActivity.class.getName(); |
| private static final String ACTIVE_SHELL_URL_KEY = "activeUrl"; |
| + private static final String ACTION_START_TRACE = "org.chromium.content_shell.action.PROFILE_START"; |
|
Ted C
2013/01/04 17:40:48
>100 chars for this and the following line
|
| + private static final String ACTION_STOP_TRACE = "org.chromium.content_shell.action.PROFILE_STOP"; |
| public static final String DEFAULT_SHELL_URL = "http://www.google.com"; |
| public static final String COMMAND_LINE_ARGS_KEY = "commandLineArgs"; |
| private ShellManager mShellManager; |
| private ActivityNativeWindow mActivityNativeWindow; |
| + private BroadcastReceiver mReceiver; |
| @Override |
| protected void onCreate(Bundle savedInstanceState) { |
| @@ -129,6 +136,7 @@ public class ContentShellActivity extends ChromiumActivity { |
| if (view != null) view.onActivityPause(); |
| super.onPause(); |
| + unregisterReceiver(mReceiver); |
| } |
| @Override |
| @@ -137,6 +145,27 @@ public class ContentShellActivity extends ChromiumActivity { |
| ContentView view = getActiveContentView(); |
| if (view != null) view.onActivityResume(); |
| + IntentFilter intentFilter = new IntentFilter(ACTION_START_TRACE); |
| + intentFilter.addAction(ACTION_STOP_TRACE); |
| + mReceiver = new BroadcastReceiver() { |
| + @Override |
| + public void onReceive(Context context, Intent intent) { |
| + String action = intent.getAction(); |
| + String extra = intent.getStringExtra("file"); |
| + if (ACTION_START_TRACE.equals(action)) { |
| + if (extra.isEmpty()) |
|
Ted C
2013/01/04 17:40:48
sadly the conventions across languages are differe
|
| + Log.e("ContentShell", "Can not start tracing without specifing saving location"); |
|
Ted C
2013/01/04 17:40:48
Although, you should use TAG from above instead of
|
| + else { |
| + TraceController.beginTracing(extra); |
| + Log.i("ContentShell", "start tracing"); |
|
Ted C
2013/01/04 17:40:48
Use TAG here too and in the else if below.
|
| + } |
| + } else if (ACTION_STOP_TRACE.equals(action)) { |
| + Log.i("ContentShell", "stop tracing"); |
| + TraceController.endTracing(); |
| + } |
| + } |
| + }; |
| + registerReceiver(mReceiver, intentFilter); |
| } |
| @Override |