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 "chrome/browser/android/bookmarks/partner_bookmarks_reader.h" | 5 #include "chrome/browser/android/bookmarks/partner_bookmarks_reader.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" | 10 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 BrowserThread::UI, | 84 BrowserThread::UI, |
85 FROM_HERE, | 85 FROM_HERE, |
86 base::Bind(&SetFaviconCallback, | 86 base::Bind(&SetFaviconCallback, |
87 profile, node->url(), fake_icon_url, | 87 profile, node->url(), fake_icon_url, |
88 image_data, icon_type, &event)); | 88 image_data, icon_type, &event)); |
89 // TODO(aruslan): http://b/6397072 If possible - avoid using favicon service | 89 // TODO(aruslan): http://b/6397072 If possible - avoid using favicon service |
90 event.Wait(); | 90 event.Wait(); |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 const BookmarkNode* GetNodeByID(const BookmarkNode* parent, int64 id) { | 94 const BookmarkNode* GetNodeByID(const BookmarkNode* parent, int64_t id) { |
95 if (parent->id() == id) | 95 if (parent->id() == id) |
96 return parent; | 96 return parent; |
97 for (int i= 0, child_count = parent->child_count(); i < child_count; ++i) { | 97 for (int i= 0, child_count = parent->child_count(); i < child_count; ++i) { |
98 const BookmarkNode* result = GetNodeByID(parent->GetChild(i), id); | 98 const BookmarkNode* result = GetNodeByID(parent->GetChild(i), id); |
99 if (result) | 99 if (result) |
100 return result; | 100 return result; |
101 } | 101 } |
102 return NULL; | 102 return NULL; |
103 } | 103 } |
104 | 104 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // ---------------------------------------------------------------- | 200 // ---------------------------------------------------------------- |
201 | 201 |
202 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 202 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
203 Profile* profile = ProfileManager::GetActiveUserProfile(); | 203 Profile* profile = ProfileManager::GetActiveUserProfile(); |
204 PartnerBookmarksShim* partner_bookmarks_shim = | 204 PartnerBookmarksShim* partner_bookmarks_shim = |
205 PartnerBookmarksShim::BuildForBrowserContext(profile); | 205 PartnerBookmarksShim::BuildForBrowserContext(profile); |
206 PartnerBookmarksReader* reader = new PartnerBookmarksReader( | 206 PartnerBookmarksReader* reader = new PartnerBookmarksReader( |
207 partner_bookmarks_shim, profile); | 207 partner_bookmarks_shim, profile); |
208 return reinterpret_cast<intptr_t>(reader); | 208 return reinterpret_cast<intptr_t>(reader); |
209 } | 209 } |
OLD | NEW |