Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: blimp/client/app/android/toolbar.cc

Issue 1891573002: Added simple url fixer for blimp toolbar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Used url_fixer for fixing URL Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/client/DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/client/app/android/toolbar.cc
diff --git a/blimp/client/app/android/toolbar.cc b/blimp/client/app/android/toolbar.cc
index 849592dbb3e355f26e98b4de413125ec446dc929..5666231a877cdebd8b2ab77af513ad14404158d1 100644
--- a/blimp/client/app/android/toolbar.cc
+++ b/blimp/client/app/android/toolbar.cc
@@ -6,6 +6,7 @@
#include "base/android/jni_string.h"
#include "blimp/client/app/android/blimp_client_session_android.h"
+#include "components/url_formatter/url_fixer.h"
#include "jni/Toolbar_jni.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/android/java_bitmap.h"
@@ -56,8 +57,14 @@ void Toolbar::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
void Toolbar::OnUrlTextEntered(JNIEnv* env,
const JavaParamRef<jobject>& jobj,
const JavaParamRef<jstring>& text) {
- navigation_feature_->NavigateToUrlText(
- kDummyTabId, base::android::ConvertJavaStringToUTF8(env, text));
+ std::string url = base::android::ConvertJavaStringToUTF8(env, text);
+
+ // 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
+ 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.
+ 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.
+ }
+ 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.
+ navigation_feature_->NavigateToUrlText(kDummyTabId, fixedUrl.spec());
}
void Toolbar::OnReloadPressed(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
« no previous file with comments | « blimp/client/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698