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

Side by Side Diff: chrome/browser/android/most_visited_sites.cc

Issue 105193002: Replace string16 with base::string16. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
OLDNEW
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 "chrome/browser/android/most_visited_sites.h" 5 #include "chrome/browser/android/most_visited_sites.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 class NativeCallback : public base::RefCounted<NativeCallback> { 42 class NativeCallback : public base::RefCounted<NativeCallback> {
43 public: 43 public:
44 NativeCallback(jobject j_callback_obj, int num_results) 44 NativeCallback(jobject j_callback_obj, int num_results)
45 : num_results_(num_results) { 45 : num_results_(num_results) {
46 JNIEnv* env = AttachCurrentThread(); 46 JNIEnv* env = AttachCurrentThread();
47 j_callback_obj_.Reset(env, j_callback_obj); 47 j_callback_obj_.Reset(env, j_callback_obj);
48 } 48 }
49 49
50 void OnMostVisitedURLsAvailable( 50 void OnMostVisitedURLsAvailable(
51 const history::MostVisitedURLList& visited_list) { 51 const history::MostVisitedURLList& visited_list) {
52 std::vector<string16> titles; 52 std::vector<base::string16> titles;
53 std::vector<std::string> urls; 53 std::vector<std::string> urls;
54 ExtractMostVisitedTitlesAndURLs(visited_list, &titles, &urls); 54 ExtractMostVisitedTitlesAndURLs(visited_list, &titles, &urls);
55 55
56 JNIEnv* env = AttachCurrentThread(); 56 JNIEnv* env = AttachCurrentThread();
57 Java_MostVisitedURLsCallback_onMostVisitedURLsAvailable( 57 Java_MostVisitedURLsCallback_onMostVisitedURLsAvailable(
58 env, 58 env,
59 j_callback_obj_.obj(), 59 j_callback_obj_.obj(),
60 ToJavaArrayOfStrings(env, titles).obj(), 60 ToJavaArrayOfStrings(env, titles).obj(),
61 ToJavaArrayOfStrings(env, urls).obj()); 61 ToJavaArrayOfStrings(env, urls).obj());
62 } 62 }
63 63
64 private: 64 private:
65 friend class base::RefCounted<NativeCallback>; 65 friend class base::RefCounted<NativeCallback>;
66 ~NativeCallback() {} 66 ~NativeCallback() {}
67 67
68 void ExtractMostVisitedTitlesAndURLs( 68 void ExtractMostVisitedTitlesAndURLs(
69 const history::MostVisitedURLList& visited_list, 69 const history::MostVisitedURLList& visited_list,
70 std::vector<string16>* titles, 70 std::vector<base::string16>* titles,
71 std::vector<std::string>* urls) { 71 std::vector<std::string>* urls) {
72 for (size_t i = 0; i < visited_list.size() && i < num_results_; ++i) { 72 for (size_t i = 0; i < visited_list.size() && i < num_results_; ++i) {
73 const history::MostVisitedURL& visited = visited_list[i]; 73 const history::MostVisitedURL& visited = visited_list[i];
74 74
75 if (visited.url.is_empty()) 75 if (visited.url.is_empty())
76 break; // This is the signal that there are no more real visited sites. 76 break; // This is the signal that there are no more real visited sites.
77 77
78 titles->push_back(visited.title); 78 titles->push_back(visited.title);
79 urls->push_back(visited.url.spec()); 79 urls->push_back(visited.url.spec());
80 } 80 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 if (!profile) 195 if (!profile)
196 return; 196 return;
197 197
198 TopSites* top_sites = profile->GetTopSites(); 198 TopSites* top_sites = profile->GetTopSites();
199 if (!top_sites) 199 if (!top_sites)
200 return; 200 return;
201 201
202 std::string url_string = ConvertJavaStringToUTF8(env, j_url); 202 std::string url_string = ConvertJavaStringToUTF8(env, j_url);
203 top_sites->AddBlacklistedURL(GURL(url_string)); 203 top_sites->AddBlacklistedURL(GURL(url_string));
204 } 204 }
OLDNEW
« no previous file with comments | « chrome/browser/android/intent_helper.cc ('k') | chrome/browser/android/password_ui_view_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698