Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: chrome/browser/android/tab_android.cc

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 return PAGE_LOAD_FAILED; 504 return PAGE_LOAD_FAILED;
505 505
506 if (!HandleNonNavigationAboutURL(fixed_url)) { 506 if (!HandleNonNavigationAboutURL(fixed_url)) {
507 // Notify the GoogleURLTracker of searches, it might want to change the 507 // Notify the GoogleURLTracker of searches, it might want to change the
508 // actual Google site used (for instance when in the UK, google.co.uk, when 508 // actual Google site used (for instance when in the UK, google.co.uk, when
509 // in the US google.com). 509 // in the US google.com).
510 // Note that this needs to happen before we initiate the navigation as the 510 // Note that this needs to happen before we initiate the navigation as the
511 // GoogleURLTracker uses the navigation pending notification to trigger the 511 // GoogleURLTracker uses the navigation pending notification to trigger the
512 // infobar. 512 // infobar.
513 if (google_util::IsGoogleSearchUrl(fixed_url) && 513 if (google_util::IsGoogleSearchUrl(fixed_url) &&
514 (page_transition & content::PAGE_TRANSITION_GENERATED)) { 514 (page_transition & ui::PAGE_TRANSITION_GENERATED)) {
515 GoogleURLTracker* tracker = 515 GoogleURLTracker* tracker =
516 GoogleURLTrackerFactory::GetForProfile(GetProfile()); 516 GoogleURLTrackerFactory::GetForProfile(GetProfile());
517 if (tracker) 517 if (tracker)
518 tracker->SearchCommitted(); 518 tracker->SearchCommitted();
519 } 519 }
520 520
521 // Record UMA "ShowHistory" here. That way it'll pick up both user 521 // Record UMA "ShowHistory" here. That way it'll pick up both user
522 // typing chrome://history as well as selecting from the drop down menu. 522 // typing chrome://history as well as selecting from the drop down menu.
523 if (fixed_url.spec() == chrome::kChromeUIHistoryURL) { 523 if (fixed_url.spec() == chrome::kChromeUIHistoryURL) {
524 content::RecordAction(base::UserMetricsAction("ShowHistory")); 524 content::RecordAction(base::UserMetricsAction("ShowHistory"));
525 } 525 }
526 526
527 content::NavigationController::LoadURLParams load_params(fixed_url); 527 content::NavigationController::LoadURLParams load_params(fixed_url);
528 if (j_extra_headers) { 528 if (j_extra_headers) {
529 load_params.extra_headers = base::android::ConvertJavaStringToUTF8( 529 load_params.extra_headers = base::android::ConvertJavaStringToUTF8(
530 env, 530 env,
531 j_extra_headers); 531 j_extra_headers);
532 } 532 }
533 if (j_post_data) { 533 if (j_post_data) {
534 load_params.load_type = 534 load_params.load_type =
535 content::NavigationController::LOAD_TYPE_BROWSER_INITIATED_HTTP_POST; 535 content::NavigationController::LOAD_TYPE_BROWSER_INITIATED_HTTP_POST;
536 std::vector<uint8> post_data; 536 std::vector<uint8> post_data;
537 base::android::JavaByteArrayToByteVector(env, j_post_data, &post_data); 537 base::android::JavaByteArrayToByteVector(env, j_post_data, &post_data);
538 load_params.browser_initiated_post_data = 538 load_params.browser_initiated_post_data =
539 base::RefCountedBytes::TakeVector(&post_data); 539 base::RefCountedBytes::TakeVector(&post_data);
540 } 540 }
541 load_params.transition_type = 541 load_params.transition_type =
542 content::PageTransitionFromInt(page_transition); 542 ui::PageTransitionFromInt(page_transition);
543 if (j_referrer_url) { 543 if (j_referrer_url) {
544 load_params.referrer = content::Referrer( 544 load_params.referrer = content::Referrer(
545 GURL(base::android::ConvertJavaStringToUTF8(env, j_referrer_url)), 545 GURL(base::android::ConvertJavaStringToUTF8(env, j_referrer_url)),
546 static_cast<blink::WebReferrerPolicy>(referrer_policy)); 546 static_cast<blink::WebReferrerPolicy>(referrer_policy));
547 } 547 }
548 const base::string16 search_terms = 548 const base::string16 search_terms =
549 chrome::ExtractSearchTermsFromURL(GetProfile(), gurl); 549 chrome::ExtractSearchTermsFromURL(GetProfile(), gurl);
550 SearchTabHelper* search_tab_helper = 550 SearchTabHelper* search_tab_helper =
551 SearchTabHelper::FromWebContents(web_contents_.get()); 551 SearchTabHelper::FromWebContents(web_contents_.get());
552 if (!search_terms.empty() && search_tab_helper && 552 if (!search_terms.empty() && search_tab_helper &&
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 652
653 static void Init(JNIEnv* env, jobject obj) { 653 static void Init(JNIEnv* env, jobject obj) {
654 TRACE_EVENT0("native", "TabAndroid::Init"); 654 TRACE_EVENT0("native", "TabAndroid::Init");
655 // This will automatically bind to the Java object and pass ownership there. 655 // This will automatically bind to the Java object and pass ownership there.
656 new TabAndroid(env, obj); 656 new TabAndroid(env, obj);
657 } 657 }
658 658
659 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 659 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
660 return RegisterNativesImpl(env); 660 return RegisterNativesImpl(env);
661 } 661 }
OLDNEW
« no previous file with comments | « athena/content/render_view_context_menu_impl.cc ('k') | chrome/browser/apps/app_browsertest_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698