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

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: Addressed Nits 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..72f6f96e8275a8a8a1f9daa36515b7e5d39b75c5 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.
+ if (url.find(".") == std::string::npos)
+ url = "http://www.google.com/search?q=" + url;
+
+ GURL fixed_url = url_formatter::FixupURL(url, std::string());
+ navigation_feature_->NavigateToUrlText(kDummyTabId, fixed_url.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