| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "omnibox_prerender.h" | 5 #include "omnibox_prerender.h" |
| 6 | 6 |
| 7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete_match.h" | 9 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_result.h" | 10 #include "chrome/browser/autocomplete/autocomplete_result.h" |
| 11 #include "chrome/browser/predictors/autocomplete_action_predictor.h" | 11 #include "chrome/browser/predictors/autocomplete_action_predictor.h" |
| 12 #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h" | 12 #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/profiles/profile_android.h" | 14 #include "chrome/browser/profiles/profile_android.h" |
| 15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 16 #include "content/public/browser/web_contents_view.h" | 16 #include "content/public/browser/web_contents_view.h" |
| 17 #include "jni/OmniboxPrerender_jni.h" | 17 #include "jni/OmniboxPrerender_jni.h" |
| 18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 19 | 19 |
| 20 using predictors::AutocompleteActionPredictor; | 20 using predictors::AutocompleteActionPredictor; |
| 21 using predictors::AutocompleteActionPredictorFactory; | 21 using predictors::AutocompleteActionPredictorFactory; |
| 22 | 22 |
| 23 OmniboxPrerender::OmniboxPrerender(JNIEnv* env, jobject obj) | 23 OmniboxPrerender::OmniboxPrerender(JNIEnv* env, jobject obj) |
| 24 : weak_java_omnibox_(env, obj) { | 24 : weak_java_omnibox_(env, obj) { |
| 25 } | 25 } |
| 26 | 26 |
| 27 OmniboxPrerender::~OmniboxPrerender() { | 27 OmniboxPrerender::~OmniboxPrerender() { |
| 28 } | 28 } |
| 29 | 29 |
| 30 static jint Init(JNIEnv* env, jobject obj) { | 30 static jlong Init(JNIEnv* env, jobject obj) { |
| 31 OmniboxPrerender* omnibox = new OmniboxPrerender(env, obj); | 31 OmniboxPrerender* omnibox = new OmniboxPrerender(env, obj); |
| 32 return reinterpret_cast<jint>(omnibox); | 32 return reinterpret_cast<intptr_t>(omnibox); |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool RegisterOmniboxPrerender(JNIEnv* env) { | 35 bool RegisterOmniboxPrerender(JNIEnv* env) { |
| 36 return RegisterNativesImpl(env); | 36 return RegisterNativesImpl(env); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void OmniboxPrerender::Clear(JNIEnv* env, | 39 void OmniboxPrerender::Clear(JNIEnv* env, |
| 40 jobject obj, | 40 jobject obj, |
| 41 jobject j_profile_android) { | 41 jobject j_profile_android) { |
| 42 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile_android); | 42 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile_android); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 if (!web_contents) | 134 if (!web_contents) |
| 135 return; | 135 return; |
| 136 gfx::Rect container_bounds; | 136 gfx::Rect container_bounds; |
| 137 web_contents->GetView()->GetContainerBounds(&container_bounds); | 137 web_contents->GetView()->GetContainerBounds(&container_bounds); |
| 138 predictors::AutocompleteActionPredictorFactory::GetForProfile(profile)-> | 138 predictors::AutocompleteActionPredictorFactory::GetForProfile(profile)-> |
| 139 StartPrerendering( | 139 StartPrerendering( |
| 140 match.destination_url, | 140 match.destination_url, |
| 141 web_contents->GetController().GetSessionStorageNamespaceMap(), | 141 web_contents->GetController().GetSessionStorageNamespaceMap(), |
| 142 container_bounds.size()); | 142 container_bounds.size()); |
| 143 } | 143 } |
| OLD | NEW |