| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.base; | 5 package org.chromium.base; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.app.Application; | 8 import android.app.Application; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.os.Bundle; | 10 import android.os.Bundle; |
| 11 import android.view.Window; | 11 import android.view.Window; |
| 12 | 12 |
| 13 import org.chromium.base.multidex.ChromiumMultiDexInstaller; | 13 import org.chromium.base.multidex.ChromiumMultiDex; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * Basic application functionality that should be shared among all browser appli
cations. | 16 * Basic application functionality that should be shared among all browser appli
cations. |
| 17 */ | 17 */ |
| 18 public class BaseChromiumApplication extends Application { | 18 public class BaseChromiumApplication extends Application { |
| 19 | 19 |
| 20 private static final String TAG = "cr.base"; | 20 private static final String TAG = "cr.base"; |
| 21 private final boolean mShouldInitializeApplicationStatusTracking; | 21 private final boolean mShouldInitializeApplicationStatusTracking; |
| 22 | 22 |
| 23 public BaseChromiumApplication() { | 23 public BaseChromiumApplication() { |
| 24 this(true); | 24 this(true); |
| 25 } | 25 } |
| 26 | 26 |
| 27 protected BaseChromiumApplication(boolean shouldInitializeApplicationStatusT
racking) { | 27 protected BaseChromiumApplication(boolean shouldInitializeApplicationStatusT
racking) { |
| 28 mShouldInitializeApplicationStatusTracking = shouldInitializeApplication
StatusTracking; | 28 mShouldInitializeApplicationStatusTracking = shouldInitializeApplication
StatusTracking; |
| 29 } | 29 } |
| 30 | 30 |
| 31 @Override | 31 @Override |
| 32 protected void attachBaseContext(Context base) { | 32 protected void attachBaseContext(Context base) { |
| 33 super.attachBaseContext(base); | 33 super.attachBaseContext(base); |
| 34 ChromiumMultiDexInstaller.install(this); | 34 ChromiumMultiDex.install(this); |
| 35 } | 35 } |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * Interface to be implemented by listeners for window focus events. | 38 * Interface to be implemented by listeners for window focus events. |
| 39 */ | 39 */ |
| 40 public interface WindowFocusChangedListener { | 40 public interface WindowFocusChangedListener { |
| 41 /** | 41 /** |
| 42 * Called when the window focus changes for {@code activity}. | 42 * Called when the window focus changes for {@code activity}. |
| 43 * @param activity The {@link Activity} that has a window focus changed
event. | 43 * @param activity The {@link Activity} that has a window focus changed
event. |
| 44 * @param hasFocus Whether or not {@code activity} gained or lost focus. | 44 * @param hasFocus Whether or not {@code activity} gained or lost focus. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 assert activity.getWindow().getCallback() instanceof WindowCallb
ackWrapper; | 127 assert activity.getWindow().getCallback() instanceof WindowCallb
ackWrapper; |
| 128 } | 128 } |
| 129 | 129 |
| 130 @Override | 130 @Override |
| 131 public void onActivityStopped(Activity activity) { | 131 public void onActivityStopped(Activity activity) { |
| 132 assert activity.getWindow().getCallback() instanceof WindowCallb
ackWrapper; | 132 assert activity.getWindow().getCallback() instanceof WindowCallb
ackWrapper; |
| 133 } | 133 } |
| 134 }); | 134 }); |
| 135 } | 135 } |
| 136 } | 136 } |
| OLD | NEW |