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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 Profile* profile = GetProfile(); | 520 Profile* profile = GetProfile(); |
521 if (!profile) | 521 if (!profile) |
522 return base::android::ScopedJavaLocalRef<jobject>(); | 522 return base::android::ScopedJavaLocalRef<jobject>(); |
523 ProfileAndroid* profile_android = ProfileAndroid::FromProfile(profile); | 523 ProfileAndroid* profile_android = ProfileAndroid::FromProfile(profile); |
524 if (!profile_android) | 524 if (!profile_android) |
525 return base::android::ScopedJavaLocalRef<jobject>(); | 525 return base::android::ScopedJavaLocalRef<jobject>(); |
526 | 526 |
527 return profile_android->GetJavaObject(); | 527 return profile_android->GetJavaObject(); |
528 } | 528 } |
529 | 529 |
530 TabAndroid::TabLoadStatus TabAndroid::LoadUrl(JNIEnv* env, | 530 TabAndroid::TabLoadStatus TabAndroid::LoadUrl( |
531 jobject obj, | 531 JNIEnv* env, |
532 jstring url, | 532 jobject obj, |
533 jstring j_extra_headers, | 533 jstring url, |
534 jbyteArray j_post_data, | 534 jstring j_extra_headers, |
535 jint page_transition, | 535 jbyteArray j_post_data, |
536 jstring j_referrer_url, | 536 jint page_transition, |
537 jint referrer_policy, | 537 jstring j_referrer_url, |
538 jboolean is_renderer_initiated, | 538 jint referrer_policy, |
539 jlong intent_received_timestamp, | 539 jboolean is_renderer_initiated, |
540 jboolean has_user_gesture) { | 540 jboolean should_replace_current_entry, |
| 541 jlong intent_received_timestamp, |
| 542 jboolean has_user_gesture) { |
541 if (!web_contents()) | 543 if (!web_contents()) |
542 return PAGE_LOAD_FAILED; | 544 return PAGE_LOAD_FAILED; |
543 | 545 |
544 GURL gurl(base::android::ConvertJavaStringToUTF8(env, url)); | 546 GURL gurl(base::android::ConvertJavaStringToUTF8(env, url)); |
545 if (gurl.is_empty()) | 547 if (gurl.is_empty()) |
546 return PAGE_LOAD_FAILED; | 548 return PAGE_LOAD_FAILED; |
547 | 549 |
548 // If the page was prerendered, use it. | 550 // If the page was prerendered, use it. |
549 // Note in incognito mode, we don't have a PrerenderManager. | 551 // Note in incognito mode, we don't have a PrerenderManager. |
550 | 552 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 search::ExtractSearchTermsFromURL(GetProfile(), gurl); | 614 search::ExtractSearchTermsFromURL(GetProfile(), gurl); |
613 SearchTabHelper* search_tab_helper = | 615 SearchTabHelper* search_tab_helper = |
614 SearchTabHelper::FromWebContents(web_contents_.get()); | 616 SearchTabHelper::FromWebContents(web_contents_.get()); |
615 if (!search_terms.empty() && search_tab_helper && | 617 if (!search_terms.empty() && search_tab_helper && |
616 search_tab_helper->SupportsInstant()) { | 618 search_tab_helper->SupportsInstant()) { |
617 EmbeddedSearchRequestParams request_params(gurl); | 619 EmbeddedSearchRequestParams request_params(gurl); |
618 search_tab_helper->Submit(search_terms, request_params); | 620 search_tab_helper->Submit(search_terms, request_params); |
619 return DEFAULT_PAGE_LOAD; | 621 return DEFAULT_PAGE_LOAD; |
620 } | 622 } |
621 load_params.is_renderer_initiated = is_renderer_initiated; | 623 load_params.is_renderer_initiated = is_renderer_initiated; |
| 624 load_params.should_replace_current_entry = should_replace_current_entry; |
622 load_params.intent_received_timestamp = intent_received_timestamp; | 625 load_params.intent_received_timestamp = intent_received_timestamp; |
623 load_params.has_user_gesture = has_user_gesture; | 626 load_params.has_user_gesture = has_user_gesture; |
624 web_contents()->GetController().LoadURLWithParams(load_params); | 627 web_contents()->GetController().LoadURLWithParams(load_params); |
625 } | 628 } |
626 return DEFAULT_PAGE_LOAD; | 629 return DEFAULT_PAGE_LOAD; |
627 } | 630 } |
628 | 631 |
629 void TabAndroid::SetActiveNavigationEntryTitleForUrl(JNIEnv* env, | 632 void TabAndroid::SetActiveNavigationEntryTitleForUrl(JNIEnv* env, |
630 jobject obj, | 633 jobject obj, |
631 jstring jurl, | 634 jstring jurl, |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 // s^{n+1} / s^{n} = 2100 / 2000 | 902 // s^{n+1} / s^{n} = 2100 / 2000 |
900 // s = 1.05 | 903 // s = 1.05 |
901 // s^b = 60000 | 904 // s^b = 60000 |
902 // b = ln(60000) / ln(1.05) ~= 225 | 905 // b = ln(60000) / ln(1.05) ~= 225 |
903 UMA_HISTOGRAM_CUSTOM_TIMES("Startup.FirstCommitNavigationTime", | 906 UMA_HISTOGRAM_CUSTOM_TIMES("Startup.FirstCommitNavigationTime", |
904 base::Time::Now() - chrome::android::GetMainEntryPointTime(), | 907 base::Time::Now() - chrome::android::GetMainEntryPointTime(), |
905 base::TimeDelta::FromMilliseconds(1), | 908 base::TimeDelta::FromMilliseconds(1), |
906 base::TimeDelta::FromMinutes(1), | 909 base::TimeDelta::FromMinutes(1), |
907 225); | 910 225); |
908 } | 911 } |
OLD | NEW |