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

Side by Side Diff: chrome/browser/android/provider/chrome_browser_provider.cc

Issue 109013006: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 12 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/android/dev_tools_server.cc ('k') | chrome/browser/app_controller_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/android/provider/chrome_browser_provider.h" 5 #include "chrome/browser/android/provider/chrome_browser_provider.h"
6 6
7 #include <list> 7 #include <list>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 163
164 // ------------- Utility methods used by tasks ------------- // 164 // ------------- Utility methods used by tasks ------------- //
165 165
166 // Parse the given url and return a GURL, appending the default scheme 166 // Parse the given url and return a GURL, appending the default scheme
167 // if one is not present. 167 // if one is not present.
168 GURL ParseAndMaybeAppendScheme(const base::string16& url, 168 GURL ParseAndMaybeAppendScheme(const base::string16& url,
169 const char* default_scheme) { 169 const char* default_scheme) {
170 GURL gurl(url); 170 GURL gurl(url);
171 if (!gurl.is_valid() && !gurl.has_scheme()) { 171 if (!gurl.is_valid() && !gurl.has_scheme()) {
172 base::string16 refined_url(ASCIIToUTF16(default_scheme)); 172 base::string16 refined_url(base::ASCIIToUTF16(default_scheme));
173 refined_url.append(url); 173 refined_url.append(url);
174 gurl = GURL(refined_url); 174 gurl = GURL(refined_url);
175 } 175 }
176 return gurl; 176 return gurl;
177 } 177 }
178 178
179 const BookmarkNode* GetChildFolderByTitle(const BookmarkNode* parent, 179 const BookmarkNode* GetChildFolderByTitle(const BookmarkNode* parent,
180 const base::string16& title) { 180 const base::string16& title) {
181 for (int i = 0; i < parent->child_count(); ++i) { 181 for (int i = 0; i < parent->child_count(); ++i) {
182 if (parent->GetChild(i)->is_folder() && 182 if (parent->GetChild(i)->is_folder() &&
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); 1088 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
1089 1089
1090 if (url) { 1090 if (url) {
1091 base::string16 raw_url = ConvertJavaStringToUTF16(env, url); 1091 base::string16 raw_url = ConvertJavaStringToUTF16(env, url);
1092 // GURL doesn't accept the URL without protocol, but the Android CTS 1092 // GURL doesn't accept the URL without protocol, but the Android CTS
1093 // allows it. We are trying to prefix with 'http://' to see whether 1093 // allows it. We are trying to prefix with 'http://' to see whether
1094 // GURL thinks it is a valid URL. The original url will be stored in 1094 // GURL thinks it is a valid URL. The original url will be stored in
1095 // history::BookmarkRow.raw_url_. 1095 // history::BookmarkRow.raw_url_.
1096 GURL gurl = ParseAndMaybeAppendScheme(raw_url, kDefaultUrlScheme); 1096 GURL gurl = ParseAndMaybeAppendScheme(raw_url, kDefaultUrlScheme);
1097 row->set_url(gurl); 1097 row->set_url(gurl);
1098 row->set_raw_url(UTF16ToUTF8(raw_url)); 1098 row->set_raw_url(base::UTF16ToUTF8(raw_url));
1099 } 1099 }
1100 1100
1101 if (created) 1101 if (created)
1102 row->set_created(ConvertJlongToTime( 1102 row->set_created(ConvertJlongToTime(
1103 ConvertJLongObjectToPrimitive(env, created))); 1103 ConvertJLongObjectToPrimitive(env, created)));
1104 1104
1105 if (isBookmark) 1105 if (isBookmark)
1106 row->set_is_bookmark(ConvertJBooleanObjectToPrimitive(env, isBookmark)); 1106 row->set_is_bookmark(ConvertJBooleanObjectToPrimitive(env, isBookmark));
1107 1107
1108 if (date) 1108 if (date)
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 Java_ChromeBrowserProvider_onBookmarkChanged(env, obj.obj()); 1613 Java_ChromeBrowserProvider_onBookmarkChanged(env, obj.obj());
1614 } else if (type == 1614 } else if (type ==
1615 chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED) { 1615 chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED) {
1616 JNIEnv* env = AttachCurrentThread(); 1616 JNIEnv* env = AttachCurrentThread();
1617 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env); 1617 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env);
1618 if (obj.is_null()) 1618 if (obj.is_null())
1619 return; 1619 return;
1620 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj()); 1620 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj());
1621 } 1621 }
1622 } 1622 }
OLDNEW
« no previous file with comments | « chrome/browser/android/dev_tools_server.cc ('k') | chrome/browser/app_controller_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698