| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 return; | 72 return; |
| 73 // TODO(aruslan): TODO(tedchoc): Follow up on how to avoid this through js. | 73 // TODO(aruslan): TODO(tedchoc): Follow up on how to avoid this through js. |
| 74 // Since the favicon URL is used as a key in the history's thumbnail DB, | 74 // Since the favicon URL is used as a key in the history's thumbnail DB, |
| 75 // this gives us a value which does not collide with others. | 75 // this gives us a value which does not collide with others. |
| 76 GURL fake_icon_url = node->url(); | 76 GURL fake_icon_url = node->url(); |
| 77 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 77 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 78 SetFaviconTask(profile, | 78 SetFaviconTask(profile, |
| 79 node->url(), fake_icon_url, | 79 node->url(), fake_icon_url, |
| 80 image_data, icon_type); | 80 image_data, icon_type); |
| 81 } else { | 81 } else { |
| 82 base::WaitableEvent event(false, false); | 82 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 83 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 83 BrowserThread::PostTask( | 84 BrowserThread::PostTask( |
| 84 BrowserThread::UI, | 85 BrowserThread::UI, |
| 85 FROM_HERE, | 86 FROM_HERE, |
| 86 base::Bind(&SetFaviconCallback, | 87 base::Bind(&SetFaviconCallback, |
| 87 profile, node->url(), fake_icon_url, | 88 profile, node->url(), fake_icon_url, |
| 88 image_data, icon_type, &event)); | 89 image_data, icon_type, &event)); |
| 89 // TODO(aruslan): http://b/6397072 If possible - avoid using favicon service | 90 // TODO(aruslan): http://b/6397072 If possible - avoid using favicon service |
| 90 event.Wait(); | 91 event.Wait(); |
| 91 } | 92 } |
| 92 } | 93 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // ---------------------------------------------------------------- | 201 // ---------------------------------------------------------------- |
| 201 | 202 |
| 202 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 203 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 203 Profile* profile = ProfileManager::GetActiveUserProfile(); | 204 Profile* profile = ProfileManager::GetActiveUserProfile(); |
| 204 PartnerBookmarksShim* partner_bookmarks_shim = | 205 PartnerBookmarksShim* partner_bookmarks_shim = |
| 205 PartnerBookmarksShim::BuildForBrowserContext(profile); | 206 PartnerBookmarksShim::BuildForBrowserContext(profile); |
| 206 PartnerBookmarksReader* reader = new PartnerBookmarksReader( | 207 PartnerBookmarksReader* reader = new PartnerBookmarksReader( |
| 207 partner_bookmarks_shim, profile); | 208 partner_bookmarks_shim, profile); |
| 208 return reinterpret_cast<intptr_t>(reader); | 209 return reinterpret_cast<intptr_t>(reader); |
| 209 } | 210 } |
| OLD | NEW |