| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/android/tab_android.h" | 5 #include "chrome/browser/android/tab_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 if (content_view_core->GetLayer()->parent() == content_layer_) | 860 if (content_view_core->GetLayer()->parent() == content_layer_) |
| 861 content_view_core->GetLayer()->RemoveFromParent(); | 861 content_view_core->GetLayer()->RemoveFromParent(); |
| 862 } | 862 } |
| 863 | 863 |
| 864 static void Init(JNIEnv* env, jobject obj) { | 864 static void Init(JNIEnv* env, jobject obj) { |
| 865 TRACE_EVENT0("native", "TabAndroid::Init"); | 865 TRACE_EVENT0("native", "TabAndroid::Init"); |
| 866 // This will automatically bind to the Java object and pass ownership there. | 866 // This will automatically bind to the Java object and pass ownership there. |
| 867 new TabAndroid(env, obj); | 867 new TabAndroid(env, obj); |
| 868 } | 868 } |
| 869 | 869 |
| 870 void TabAndroid::ShowAutoSigninSnackbar(jobject credential) { |
| 871 JNIEnv *env = base::android::AttachCurrentThread(); |
| 872 Java_Tab_onSmartLockAutoSignIn(env, weak_java_tab_.get(env).obj(), |
| 873 credential); |
| 874 } |
| 875 |
| 870 // static | 876 // static |
| 871 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 877 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
| 872 return RegisterNativesImpl(env); | 878 return RegisterNativesImpl(env); |
| 873 } | 879 } |
| 874 | 880 |
| 875 static void RecordStartupToCommitUma(JNIEnv* env, jclass jcaller) { | 881 static void RecordStartupToCommitUma(JNIEnv* env, jclass jcaller) { |
| 876 // Currently it takes about 2000ms to commit a navigation if the measurement | 882 // Currently it takes about 2000ms to commit a navigation if the measurement |
| 877 // begins very early in the browser start. How many buckets (b) are needed to | 883 // begins very early in the browser start. How many buckets (b) are needed to |
| 878 // explore the _typical_ values with granularity 100ms and a maximum duration | 884 // explore the _typical_ values with granularity 100ms and a maximum duration |
| 879 // of 1 minute? | 885 // of 1 minute? |
| 880 // s^{n+1} / s^{n} = 2100 / 2000 | 886 // s^{n+1} / s^{n} = 2100 / 2000 |
| 881 // s = 1.05 | 887 // s = 1.05 |
| 882 // s^b = 60000 | 888 // s^b = 60000 |
| 883 // b = ln(60000) / ln(1.05) ~= 225 | 889 // b = ln(60000) / ln(1.05) ~= 225 |
| 884 UMA_HISTOGRAM_CUSTOM_TIMES("Startup.FirstCommitNavigationTime", | 890 UMA_HISTOGRAM_CUSTOM_TIMES("Startup.FirstCommitNavigationTime", |
| 885 base::Time::Now() - chrome::android::GetMainEntryPointTime(), | 891 base::Time::Now() - chrome::android::GetMainEntryPointTime(), |
| 886 base::TimeDelta::FromMilliseconds(1), | 892 base::TimeDelta::FromMilliseconds(1), |
| 887 base::TimeDelta::FromMinutes(1), | 893 base::TimeDelta::FromMinutes(1), |
| 888 225); | 894 225); |
| 889 } | 895 } |
| OLD | NEW |