| 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/android/tab_android.h" | 9 #include "chrome/browser/android/tab_android.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 OmniboxPrerender::~OmniboxPrerender() { | 28 OmniboxPrerender::~OmniboxPrerender() { |
| 29 } | 29 } |
| 30 | 30 |
| 31 static jlong Init(JNIEnv* env, jobject obj) { | 31 static jlong Init(JNIEnv* env, jobject obj) { |
| 32 OmniboxPrerender* omnibox = new OmniboxPrerender(env, obj); | 32 OmniboxPrerender* omnibox = new OmniboxPrerender(env, obj); |
| 33 return reinterpret_cast<intptr_t>(omnibox); | 33 return reinterpret_cast<intptr_t>(omnibox); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool RegisterOmniboxPrerender(JNIEnv* env) { | |
| 37 return RegisterNativesImpl(env); | |
| 38 } | |
| 39 | |
| 40 void OmniboxPrerender::Clear(JNIEnv* env, | 36 void OmniboxPrerender::Clear(JNIEnv* env, |
| 41 jobject obj, | 37 jobject obj, |
| 42 jobject j_profile_android) { | 38 jobject j_profile_android) { |
| 43 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile_android); | 39 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile_android); |
| 44 DCHECK(profile); | 40 DCHECK(profile); |
| 45 if (!profile) | 41 if (!profile) |
| 46 return; | 42 return; |
| 47 AutocompleteActionPredictor* action_predictor = | 43 AutocompleteActionPredictor* action_predictor = |
| 48 AutocompleteActionPredictorFactory::GetForProfile(profile); | 44 AutocompleteActionPredictorFactory::GetForProfile(profile); |
| 49 action_predictor->ClearTransitionalMatches(); | 45 action_predictor->ClearTransitionalMatches(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 if (!web_contents) | 131 if (!web_contents) |
| 136 return; | 132 return; |
| 137 gfx::Rect container_bounds; | 133 gfx::Rect container_bounds; |
| 138 web_contents->GetView()->GetContainerBounds(&container_bounds); | 134 web_contents->GetView()->GetContainerBounds(&container_bounds); |
| 139 predictors::AutocompleteActionPredictorFactory::GetForProfile(profile)-> | 135 predictors::AutocompleteActionPredictorFactory::GetForProfile(profile)-> |
| 140 StartPrerendering( | 136 StartPrerendering( |
| 141 match.destination_url, | 137 match.destination_url, |
| 142 web_contents->GetController().GetSessionStorageNamespaceMap(), | 138 web_contents->GetController().GetSessionStorageNamespaceMap(), |
| 143 container_bounds.size()); | 139 container_bounds.size()); |
| 144 } | 140 } |
| OLD | NEW |