Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/client/app/android/toolbar.h" | 5 #include "blimp/client/app/android/toolbar.h" |
| 6 | 6 |
| 7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "blimp/client/app/android/blimp_client_session_android.h" | 8 #include "blimp/client/app/android/blimp_client_session_android.h" |
| 9 #include "components/url_formatter/url_fixer.h" | |
| 9 #include "jni/Toolbar_jni.h" | 10 #include "jni/Toolbar_jni.h" |
| 10 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
| 11 #include "ui/gfx/android/java_bitmap.h" | 12 #include "ui/gfx/android/java_bitmap.h" |
| 12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 13 | 14 |
| 14 namespace blimp { | 15 namespace blimp { |
| 15 namespace client { | 16 namespace client { |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 49 navigation_feature_->RemoveDelegate(kDummyTabId); | 50 navigation_feature_->RemoveDelegate(kDummyTabId); |
| 50 } | 51 } |
| 51 | 52 |
| 52 void Toolbar::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) { | 53 void Toolbar::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) { |
| 53 delete this; | 54 delete this; |
| 54 } | 55 } |
| 55 | 56 |
| 56 void Toolbar::OnUrlTextEntered(JNIEnv* env, | 57 void Toolbar::OnUrlTextEntered(JNIEnv* env, |
| 57 const JavaParamRef<jobject>& jobj, | 58 const JavaParamRef<jobject>& jobj, |
| 58 const JavaParamRef<jstring>& text) { | 59 const JavaParamRef<jstring>& text) { |
| 59 navigation_feature_->NavigateToUrlText( | 60 std::string url = base::android::ConvertJavaStringToUTF8(env, text); |
| 60 kDummyTabId, base::android::ConvertJavaStringToUTF8(env, text)); | 61 |
| 62 // Build a search query, if |url| doesn't have a '.' anywhere. | |
|
Peter Kasting
2016/04/14 04:34:01
This will give you both false positives and false
shaktisahu
2016/04/14 17:55:23
We looked at AutocompleteClassfier before, but it
Peter Kasting
2016/04/14 20:38:44
How long ago did you look? This has all been comp
nyquist
2016/04/15 16:21:55
I believe the plan would be to merge this with the
shaktisahu
2016/04/15 18:32:35
Actually, this is a temporary work. All this code
| |
| 63 if (url.find(".") == std::string::npos) { | |
|
Peter Kasting
2016/04/15 18:35:52
Nit: {} not necessary
shaktisahu
2016/04/15 18:59:06
Done.
| |
| 64 url = std::string("http://www.google.com/search?q=") + url; | |
|
Peter Kasting
2016/04/15 18:35:53
Nit: std::string() not necessary
shaktisahu
2016/04/15 18:59:06
Done.
| |
| 65 } | |
| 66 GURL fixedUrl = url_formatter::FixupURL(url, std::string()); | |
|
Peter Kasting
2016/04/15 18:35:52
Nit: fixed_url
shaktisahu
2016/04/15 18:59:06
Done.
| |
| 67 navigation_feature_->NavigateToUrlText(kDummyTabId, fixedUrl.spec()); | |
| 61 } | 68 } |
| 62 | 69 |
| 63 void Toolbar::OnReloadPressed(JNIEnv* env, const JavaParamRef<jobject>& jobj) { | 70 void Toolbar::OnReloadPressed(JNIEnv* env, const JavaParamRef<jobject>& jobj) { |
| 64 navigation_feature_->Reload(kDummyTabId); | 71 navigation_feature_->Reload(kDummyTabId); |
| 65 } | 72 } |
| 66 | 73 |
| 67 void Toolbar::OnForwardPressed(JNIEnv* env, const JavaParamRef<jobject>& jobj) { | 74 void Toolbar::OnForwardPressed(JNIEnv* env, const JavaParamRef<jobject>& jobj) { |
| 68 navigation_feature_->GoForward(kDummyTabId); | 75 navigation_feature_->GoForward(kDummyTabId); |
| 69 } | 76 } |
| 70 | 77 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 JNIEnv* env = base::android::AttachCurrentThread(); | 119 JNIEnv* env = base::android::AttachCurrentThread(); |
| 113 | 120 |
| 114 Java_Toolbar_onEngineSentPageLoadStatusUpdate( | 121 Java_Toolbar_onEngineSentPageLoadStatusUpdate( |
| 115 env, | 122 env, |
| 116 java_obj_.obj(), | 123 java_obj_.obj(), |
| 117 static_cast<jboolean>(completed)); | 124 static_cast<jboolean>(completed)); |
| 118 } | 125 } |
| 119 | 126 |
| 120 } // namespace client | 127 } // namespace client |
| 121 } // namespace blimp | 128 } // namespace blimp |
| OLD | NEW |