| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ |
| 6 #define CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ | 6 #define CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/synchronization/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" |
| 17 #include "base/task/cancelable_task_tracker.h" | 17 #include "base/task/cancelable_task_tracker.h" |
| 18 #include "chrome/browser/common/cancelable_request.h" | 18 #include "chrome/browser/common/cancelable_request.h" |
| 19 #include "chrome/browser/favicon/favicon_service.h" | |
| 20 #include "chrome/browser/history/android/android_history_provider_service.h" | 19 #include "chrome/browser/history/android/android_history_provider_service.h" |
| 21 #include "chrome/browser/history/history_types.h" | 20 #include "chrome/browser/history/history_types.h" |
| 21 #include "components/favicon_base/favicon_callback.h" |
| 22 |
| 23 class FaviconService; |
| 22 | 24 |
| 23 // This class is JNI implementation of | 25 // This class is JNI implementation of |
| 24 // org.chromium.chrome.database.SqliteCursor, it uses the AndroidStatement to | 26 // org.chromium.chrome.database.SqliteCursor, it uses the AndroidStatement to |
| 25 // iterate among the result rows. This is not thread safe, all methods should | 27 // iterate among the result rows. This is not thread safe, all methods should |
| 26 // be called from the same non-UI thread which typical is the Java thread. | 28 // be called from the same non-UI thread which typical is the Java thread. |
| 27 // | 29 // |
| 28 // This class can not be in history namespace because the class name has to | 30 // This class can not be in history namespace because the class name has to |
| 29 // match to the generated sqlite_cursor_jni.h. | 31 // match to the generated sqlite_cursor_jni.h. |
| 30 class SQLiteCursor { | 32 class SQLiteCursor { |
| 31 public: | 33 public: |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 void set_test_observer(TestObserver* test_observer) { | 146 void set_test_observer(TestObserver* test_observer) { |
| 145 test_observer_ = test_observer; | 147 test_observer_ = test_observer; |
| 146 } | 148 } |
| 147 | 149 |
| 148 // Get Favicon from history backend. | 150 // Get Favicon from history backend. |
| 149 bool GetFavicon(favicon_base::FaviconID id, | 151 bool GetFavicon(favicon_base::FaviconID id, |
| 150 std::vector<unsigned char>* image_data); | 152 std::vector<unsigned char>* image_data); |
| 151 | 153 |
| 152 void GetFaviconForIDInUIThread( | 154 void GetFaviconForIDInUIThread( |
| 153 favicon_base::FaviconID id, | 155 favicon_base::FaviconID id, |
| 154 const FaviconService::FaviconRawCallback& callback); | 156 const favicon_base::FaviconRawCallback& callback); |
| 155 | 157 |
| 156 // The callback function of FaviconService::GetLargestRawFaviconForID(). | 158 // The callback function of FaviconService::GetLargestRawFaviconForID(). |
| 157 void OnFaviconData(const favicon_base::FaviconBitmapResult& bitmap_result); | 159 void OnFaviconData(const favicon_base::FaviconBitmapResult& bitmap_result); |
| 158 | 160 |
| 159 // The callback function of MoveTo(). | 161 // The callback function of MoveTo(). |
| 160 void OnMoved(AndroidHistoryProviderService::Handle handle, int pos); | 162 void OnMoved(AndroidHistoryProviderService::Handle handle, int pos); |
| 161 | 163 |
| 162 JavaColumnType GetColumnTypeInternal(int column); | 164 JavaColumnType GetColumnTypeInternal(int column); |
| 163 | 165 |
| 164 // Runs the MoveStatement on UI thread. | 166 // Runs the MoveStatement on UI thread. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 188 | 190 |
| 189 // The favicon image. | 191 // The favicon image. |
| 190 favicon_base::FaviconBitmapResult favicon_bitmap_result_; | 192 favicon_base::FaviconBitmapResult favicon_bitmap_result_; |
| 191 | 193 |
| 192 TestObserver* test_observer_; | 194 TestObserver* test_observer_; |
| 193 | 195 |
| 194 DISALLOW_COPY_AND_ASSIGN(SQLiteCursor); | 196 DISALLOW_COPY_AND_ASSIGN(SQLiteCursor); |
| 195 }; | 197 }; |
| 196 | 198 |
| 197 #endif // CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ | 199 #endif // CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ |
| OLD | NEW |