| 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_HISTORY_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
| 6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "components/favicon_base/favicon_usage_data.h" | 21 #include "components/favicon_base/favicon_usage_data.h" |
| 22 #include "components/history/core/browser/expire_history_backend.h" | 22 #include "components/history/core/browser/expire_history_backend.h" |
| 23 #include "components/history/core/browser/history_backend_notifier.h" | 23 #include "components/history/core/browser/history_backend_notifier.h" |
| 24 #include "components/history/core/browser/history_types.h" | 24 #include "components/history/core/browser/history_types.h" |
| 25 #include "components/history/core/browser/keyword_id.h" | 25 #include "components/history/core/browser/keyword_id.h" |
| 26 #include "components/history/core/browser/thumbnail_database.h" | 26 #include "components/history/core/browser/thumbnail_database.h" |
| 27 #include "components/history/core/browser/visit_tracker.h" | 27 #include "components/history/core/browser/visit_tracker.h" |
| 28 #include "components/visitedlink/browser/visitedlink_delegate.h" | 28 #include "components/visitedlink/browser/visitedlink_delegate.h" |
| 29 #include "sql/init_status.h" | 29 #include "sql/init_status.h" |
| 30 | 30 |
| 31 #if defined(OS_ANDROID) | |
| 32 #include "components/history/core/browser/android/android_history_types.h" | |
| 33 #endif | |
| 34 | |
| 35 class HistoryURLProvider; | 31 class HistoryURLProvider; |
| 36 struct HistoryURLProviderParams; | 32 struct HistoryURLProviderParams; |
| 37 class SkBitmap; | 33 class SkBitmap; |
| 38 class TestingProfile; | 34 class TestingProfile; |
| 39 struct ThumbnailScore; | 35 struct ThumbnailScore; |
| 40 | 36 |
| 41 namespace base { | 37 namespace base { |
| 42 class MessageLoop; | 38 class MessageLoop; |
| 43 class SingleThreadTaskRunner; | 39 class SingleThreadTaskRunner; |
| 44 } | 40 } |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 const base::string16& term); | 329 const base::string16& term); |
| 334 | 330 |
| 335 // Observers ----------------------------------------------------------------- | 331 // Observers ----------------------------------------------------------------- |
| 336 | 332 |
| 337 void AddObserver(HistoryBackendObserver* observer); | 333 void AddObserver(HistoryBackendObserver* observer); |
| 338 void RemoveObserver(HistoryBackendObserver* observer); | 334 void RemoveObserver(HistoryBackendObserver* observer); |
| 339 | 335 |
| 340 #if defined(OS_ANDROID) | 336 #if defined(OS_ANDROID) |
| 341 // Android Provider --------------------------------------------------------- | 337 // Android Provider --------------------------------------------------------- |
| 342 | 338 |
| 343 // History and bookmarks ---------------------------------------------------- | 339 // Returns the android provider backend associated with the HistoryBackend. |
| 344 // Inserts the given values into history backend. | 340 AndroidProviderBackend* android_provider_backend() { |
| 345 AndroidURLID InsertHistoryAndBookmark(const HistoryAndBookmarkRow& row); | 341 return android_provider_backend_.get(); |
| 346 | 342 } |
| 347 // Runs the given query on history backend and returns the result. | 343 #endif |
| 348 // | |
| 349 // |projections| is the vector of the result columns. | |
| 350 // |selection| is the SQL WHERE clause without 'WHERE'. | |
| 351 // |selection_args| is the arguments for WHERE clause. | |
| 352 // |sort_order| is the SQL ORDER clause. | |
| 353 history::AndroidStatement* QueryHistoryAndBookmarks( | |
| 354 const std::vector<HistoryAndBookmarkRow::ColumnID>& projections, | |
| 355 const std::string& selection, | |
| 356 const std::vector<base::string16>& selection_args, | |
| 357 const std::string& sort_order); | |
| 358 | |
| 359 // Returns the number of row updated by the update query. | |
| 360 // | |
| 361 // |row| is the value to update. | |
| 362 // |selection| is the SQL WHERE clause without 'WHERE'. | |
| 363 // |selection_args| is the arguments for the WHERE clause. | |
| 364 int UpdateHistoryAndBookmarks( | |
| 365 const HistoryAndBookmarkRow& row, | |
| 366 const std::string& selection, | |
| 367 const std::vector<base::string16>& selection_args); | |
| 368 | |
| 369 // Deletes the specified rows and returns the number of rows deleted. | |
| 370 // | |
| 371 // |selection| is the SQL WHERE clause without 'WHERE'. | |
| 372 // |selection_args| is the arguments for the WHERE clause. | |
| 373 // | |
| 374 // If |selection| is empty all history and bookmarks are deleted. | |
| 375 int DeleteHistoryAndBookmarks( | |
| 376 const std::string& selection, | |
| 377 const std::vector<base::string16>& selection_args); | |
| 378 | |
| 379 // Deletes the matched history and returns the number of rows deleted. | |
| 380 int DeleteHistory(const std::string& selection, | |
| 381 const std::vector<base::string16>& selection_args); | |
| 382 | |
| 383 // Statement ---------------------------------------------------------------- | |
| 384 // Move the statement's current position. | |
| 385 int MoveStatement(history::AndroidStatement* statement, | |
| 386 int current_pos, | |
| 387 int destination); | |
| 388 | |
| 389 // Close the given statement. The ownership is transfered. | |
| 390 void CloseStatement(AndroidStatement* statement); | |
| 391 | |
| 392 // Search terms ------------------------------------------------------------- | |
| 393 // Inserts the given values and returns the SearchTermID of the inserted row. | |
| 394 SearchTermID InsertSearchTerm(const SearchRow& row); | |
| 395 | |
| 396 // Returns the number of row updated by the update query. | |
| 397 // | |
| 398 // |row| is the value to update. | |
| 399 // |selection| is the SQL WHERE clause without 'WHERE'. | |
| 400 // |selection_args| is the arguments for the WHERE clause. | |
| 401 int UpdateSearchTerms(const SearchRow& row, | |
| 402 const std::string& selection, | |
| 403 const std::vector<base::string16> selection_args); | |
| 404 | |
| 405 // Deletes the matched rows and returns the number of deleted rows. | |
| 406 // | |
| 407 // |selection| is the SQL WHERE clause without 'WHERE'. | |
| 408 // |selection_args| is the arguments for WHERE clause. | |
| 409 // | |
| 410 // If |selection| is empty all search terms will be deleted. | |
| 411 int DeleteSearchTerms(const std::string& selection, | |
| 412 const std::vector<base::string16> selection_args); | |
| 413 | |
| 414 // Returns the result of the given query. | |
| 415 // | |
| 416 // |projections| specifies the result columns. | |
| 417 // |selection| is the SQL WHERE clause without 'WHERE'. | |
| 418 // |selection_args| is the arguments for WHERE clause. | |
| 419 // |sort_order| is the SQL ORDER clause. | |
| 420 history::AndroidStatement* QuerySearchTerms( | |
| 421 const std::vector<SearchRow::ColumnID>& projections, | |
| 422 const std::string& selection, | |
| 423 const std::vector<base::string16>& selection_args, | |
| 424 const std::string& sort_order); | |
| 425 | |
| 426 #endif // defined(OS_ANDROID) | |
| 427 | 344 |
| 428 // Generic operations -------------------------------------------------------- | 345 // Generic operations -------------------------------------------------------- |
| 429 | 346 |
| 430 void ProcessDBTask( | 347 void ProcessDBTask( |
| 431 scoped_ptr<HistoryDBTask> task, | 348 scoped_ptr<HistoryDBTask> task, |
| 432 scoped_refptr<base::SingleThreadTaskRunner> origin_loop, | 349 scoped_refptr<base::SingleThreadTaskRunner> origin_loop, |
| 433 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled); | 350 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled); |
| 434 | 351 |
| 435 virtual bool GetAllTypedURLs(URLRows* urls); | 352 virtual bool GetAllTypedURLs(URLRows* urls); |
| 436 | 353 |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 | 838 |
| 922 // List of observers | 839 // List of observers |
| 923 ObserverList<HistoryBackendObserver> observers_; | 840 ObserverList<HistoryBackendObserver> observers_; |
| 924 | 841 |
| 925 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 842 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
| 926 }; | 843 }; |
| 927 | 844 |
| 928 } // namespace history | 845 } // namespace history |
| 929 | 846 |
| 930 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 847 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
| OLD | NEW |