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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 | 408 |
408 if (!HandleNonNavigationAboutURL(fixed_url)) { | 409 if (!HandleNonNavigationAboutURL(fixed_url)) { |
409 // Notify the GoogleURLTracker of searches, it might want to change the | 410 // Notify the GoogleURLTracker of searches, it might want to change the |
410 // actual Google site used (for instance when in the UK, google.co.uk, when | 411 // actual Google site used (for instance when in the UK, google.co.uk, when |
411 // in the US google.com). | 412 // in the US google.com). |
412 // Note that this needs to happen before we initiate the navigation as the | 413 // Note that this needs to happen before we initiate the navigation as the |
413 // GoogleURLTracker uses the navigation pending notification to trigger the | 414 // GoogleURLTracker uses the navigation pending notification to trigger the |
414 // infobar. | 415 // infobar. |
415 if (google_util::IsGoogleSearchUrl(fixed_url) && | 416 if (google_util::IsGoogleSearchUrl(fixed_url) && |
416 (page_transition & content::PAGE_TRANSITION_GENERATED)) { | 417 (page_transition & content::PAGE_TRANSITION_GENERATED)) { |
417 GoogleURLTracker::GoogleURLSearchCommitted(GetProfile()); | 418 GoogleURLTracker* tracker = |
| 419 GoogleURLTrackerFactory::GetForProfile(GetProfile()); |
| 420 if (tracker) |
| 421 tracker->SearchCommitted(); |
418 } | 422 } |
419 | 423 |
420 // Record UMA "ShowHistory" here. That way it'll pick up both user | 424 // Record UMA "ShowHistory" here. That way it'll pick up both user |
421 // typing chrome://history as well as selecting from the drop down menu. | 425 // typing chrome://history as well as selecting from the drop down menu. |
422 if (fixed_url.spec() == chrome::kChromeUIHistoryURL) { | 426 if (fixed_url.spec() == chrome::kChromeUIHistoryURL) { |
423 content::RecordAction(base::UserMetricsAction("ShowHistory")); | 427 content::RecordAction(base::UserMetricsAction("ShowHistory")); |
424 } | 428 } |
425 | 429 |
426 content::NavigationController::LoadURLParams load_params(fixed_url); | 430 content::NavigationController::LoadURLParams load_params(fixed_url); |
427 if (j_extra_headers) { | 431 if (j_extra_headers) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 | 511 |
508 static void Init(JNIEnv* env, jobject obj) { | 512 static void Init(JNIEnv* env, jobject obj) { |
509 TRACE_EVENT0("native", "TabAndroid::Init"); | 513 TRACE_EVENT0("native", "TabAndroid::Init"); |
510 // This will automatically bind to the Java object and pass ownership there. | 514 // This will automatically bind to the Java object and pass ownership there. |
511 new TabAndroid(env, obj); | 515 new TabAndroid(env, obj); |
512 } | 516 } |
513 | 517 |
514 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 518 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
515 return RegisterNativesImpl(env); | 519 return RegisterNativesImpl(env); |
516 } | 520 } |
OLD | NEW |