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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
11 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" | 11 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" |
12 #include "chrome/browser/browser_about_handler.h" | 12 #include "chrome/browser/browser_about_handler.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
15 #include "chrome/browser/google/google_url_tracker.h" | 15 #include "chrome/browser/google/google_url_tracker.h" |
| 16 #include "chrome/browser/google/google_url_tracker_factory.h" |
16 #include "chrome/browser/google/google_util.h" | 17 #include "chrome/browser/google/google_util.h" |
17 #include "chrome/browser/infobars/infobar_service.h" | 18 #include "chrome/browser/infobars/infobar_service.h" |
18 #include "chrome/browser/prerender/prerender_contents.h" | 19 #include "chrome/browser/prerender/prerender_contents.h" |
19 #include "chrome/browser/prerender/prerender_manager.h" | 20 #include "chrome/browser/prerender/prerender_manager.h" |
20 #include "chrome/browser/prerender/prerender_manager_factory.h" | 21 #include "chrome/browser/prerender/prerender_manager_factory.h" |
21 #include "chrome/browser/printing/print_view_manager_basic.h" | 22 #include "chrome/browser/printing/print_view_manager_basic.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/profile_android.h" | 24 #include "chrome/browser/profiles/profile_android.h" |
24 #include "chrome/browser/search/search.h" | 25 #include "chrome/browser/search/search.h" |
25 #include "chrome/browser/sessions/session_tab_helper.h" | 26 #include "chrome/browser/sessions/session_tab_helper.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 | 407 |
407 if (!HandleNonNavigationAboutURL(fixed_url)) { | 408 if (!HandleNonNavigationAboutURL(fixed_url)) { |
408 // Notify the GoogleURLTracker of searches, it might want to change the | 409 // Notify the GoogleURLTracker of searches, it might want to change the |
409 // actual Google site used (for instance when in the UK, google.co.uk, when | 410 // actual Google site used (for instance when in the UK, google.co.uk, when |
410 // in the US google.com). | 411 // in the US google.com). |
411 // Note that this needs to happen before we initiate the navigation as the | 412 // Note that this needs to happen before we initiate the navigation as the |
412 // GoogleURLTracker uses the navigation pending notification to trigger the | 413 // GoogleURLTracker uses the navigation pending notification to trigger the |
413 // infobar. | 414 // infobar. |
414 if (google_util::IsGoogleSearchUrl(fixed_url) && | 415 if (google_util::IsGoogleSearchUrl(fixed_url) && |
415 (page_transition & content::PAGE_TRANSITION_GENERATED)) { | 416 (page_transition & content::PAGE_TRANSITION_GENERATED)) { |
416 GoogleURLTracker::GoogleURLSearchCommitted(GetProfile()); | 417 GoogleURLTracker* tracker = |
| 418 GoogleURLTrackerFactory::GetForProfile(GetProfile()); |
| 419 if (tracker) |
| 420 tracker->GoogleURLSearchCommitted()); |
417 } | 421 } |
418 | 422 |
419 // Record UMA "ShowHistory" here. That way it'll pick up both user | 423 // Record UMA "ShowHistory" here. That way it'll pick up both user |
420 // typing chrome://history as well as selecting from the drop down menu. | 424 // typing chrome://history as well as selecting from the drop down menu. |
421 if (fixed_url.spec() == chrome::kChromeUIHistoryURL) { | 425 if (fixed_url.spec() == chrome::kChromeUIHistoryURL) { |
422 content::RecordAction(base::UserMetricsAction("ShowHistory")); | 426 content::RecordAction(base::UserMetricsAction("ShowHistory")); |
423 } | 427 } |
424 | 428 |
425 content::NavigationController::LoadURLParams load_params(fixed_url); | 429 content::NavigationController::LoadURLParams load_params(fixed_url); |
426 if (j_extra_headers) { | 430 if (j_extra_headers) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 | 509 |
506 static void Init(JNIEnv* env, jobject obj) { | 510 static void Init(JNIEnv* env, jobject obj) { |
507 TRACE_EVENT0("native", "TabAndroid::Init"); | 511 TRACE_EVENT0("native", "TabAndroid::Init"); |
508 // This will automatically bind to the Java object and pass ownership there. | 512 // This will automatically bind to the Java object and pass ownership there. |
509 new TabAndroid(env, obj); | 513 new TabAndroid(env, obj); |
510 } | 514 } |
511 | 515 |
512 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 516 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
513 return RegisterNativesImpl(env); | 517 return RegisterNativesImpl(env); |
514 } | 518 } |
OLD | NEW |