| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 class BookmarkService; | 28 class BookmarkService; |
| 29 class TestingProfile; | 29 class TestingProfile; |
| 30 struct ThumbnailScore; | 30 struct ThumbnailScore; |
| 31 | 31 |
| 32 namespace content { | 32 namespace content { |
| 33 struct DownloadPersistentStoreInfo; | 33 struct DownloadPersistentStoreInfo; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace history { | 36 namespace history { |
| 37 | 37 #if defined(OS_ANDROID) |
| 38 class AndroidProviderBackend; |
| 39 #endif |
| 38 class CommitLaterTask; | 40 class CommitLaterTask; |
| 39 class HistoryPublisher; | 41 class HistoryPublisher; |
| 40 class VisitFilter; | 42 class VisitFilter; |
| 41 | 43 |
| 42 // *See the .cc file for more information on the design.* | 44 // *See the .cc file for more information on the design.* |
| 43 // | 45 // |
| 44 // Internal history implementation which does most of the work of the history | 46 // Internal history implementation which does most of the work of the history |
| 45 // system. This runs on a background thread (to not block the browser when we | 47 // system. This runs on a background thread (to not block the browser when we |
| 46 // do expensive operations) and is NOT threadsafe, so it must only be called | 48 // do expensive operations) and is NOT threadsafe, so it must only be called |
| 47 // from message handlers on the background thread. Invoking on another thread | 49 // from message handlers on the background thread. Invoking on another thread |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 const string16& term); | 301 const string16& term); |
| 300 | 302 |
| 301 void DeleteAllSearchTermsForKeyword(TemplateURLID keyword_id); | 303 void DeleteAllSearchTermsForKeyword(TemplateURLID keyword_id); |
| 302 | 304 |
| 303 void GetMostRecentKeywordSearchTerms( | 305 void GetMostRecentKeywordSearchTerms( |
| 304 scoped_refptr<GetMostRecentKeywordSearchTermsRequest> request, | 306 scoped_refptr<GetMostRecentKeywordSearchTermsRequest> request, |
| 305 TemplateURLID keyword_id, | 307 TemplateURLID keyword_id, |
| 306 const string16& prefix, | 308 const string16& prefix, |
| 307 int max_count); | 309 int max_count); |
| 308 | 310 |
| 311 #if defined(OS_ANDROID) |
| 312 // Android Provider --------------------------------------------------------- |
| 313 |
| 314 // History and bookmarks ---------------------------------------------------- |
| 315 void InsertHistoryAndBookmark(scoped_refptr<InsertRequest> request, |
| 316 const HistoryAndBookmarkRow& row); |
| 317 |
| 318 void QueryHistoryAndBookmarks( |
| 319 scoped_refptr<QueryRequest> request, |
| 320 const std::vector<HistoryAndBookmarkRow::ColumnID>& projections, |
| 321 const std::string& selection, |
| 322 const std::vector<string16>& selection_args, |
| 323 const std::string& sort_order); |
| 324 |
| 325 void UpdateHistoryAndBookmarks(scoped_refptr<UpdateRequest> request, |
| 326 const HistoryAndBookmarkRow& row, |
| 327 const std::string& selection, |
| 328 const std::vector<string16>& selection_args); |
| 329 |
| 330 void DeleteHistoryAndBookmarks(scoped_refptr<DeleteRequest> request, |
| 331 const std::string& selection, |
| 332 const std::vector<string16>& selection_args); |
| 333 |
| 334 void DeleteHistory(scoped_refptr<DeleteRequest> request, |
| 335 const std::string& selection, |
| 336 const std::vector<string16>& selection_args); |
| 337 |
| 338 // Statement ---------------------------------------------------------------- |
| 339 // Move the statement's current position. |
| 340 void MoveStatement(scoped_refptr<MoveStatementRequest> request, |
| 341 history::AndroidStatement* statement, |
| 342 int current_pos, |
| 343 int destination); |
| 344 |
| 345 // Close the given statement. The ownership is transfered. |
| 346 void CloseStatement(AndroidStatement* statement); |
| 347 |
| 348 // Search terms ------------------------------------------------------------- |
| 349 void InsertSearchTerm(scoped_refptr<InsertRequest> request, |
| 350 const SearchRow& row); |
| 351 |
| 352 void UpdateSearchTerms(scoped_refptr<UpdateRequest> request, |
| 353 const SearchRow& row, |
| 354 const std::string& selection, |
| 355 const std::vector<string16> selection_args); |
| 356 |
| 357 void DeleteSearchTerms(scoped_refptr<DeleteRequest> request, |
| 358 const std::string& selection, |
| 359 const std::vector<string16> selection_args); |
| 360 |
| 361 void QuerySearchTerms(scoped_refptr<QueryRequest> request, |
| 362 const std::vector<SearchRow::ColumnID>& projections, |
| 363 const std::string& selection, |
| 364 const std::vector<string16>& selection_args, |
| 365 const std::string& sort_order); |
| 366 |
| 367 #endif // defined(OS_ANDROID) |
| 368 |
| 309 // Generic operations -------------------------------------------------------- | 369 // Generic operations -------------------------------------------------------- |
| 310 | 370 |
| 311 void ProcessDBTask(scoped_refptr<HistoryDBTaskRequest> request); | 371 void ProcessDBTask(scoped_refptr<HistoryDBTaskRequest> request); |
| 312 | 372 |
| 313 virtual bool GetAllTypedURLs(URLRows* urls); | 373 virtual bool GetAllTypedURLs(URLRows* urls); |
| 314 | 374 |
| 315 virtual bool GetVisitsForURL(URLID id, VisitVector* visits); | 375 virtual bool GetVisitsForURL(URLID id, VisitVector* visits); |
| 316 | 376 |
| 317 // Fetches up to |max_visits| most recent visits for the passed URL. | 377 // Fetches up to |max_visits| most recent visits for the passed URL. |
| 318 virtual bool GetMostRecentVisitsForURL(URLID id, | 378 virtual bool GetMostRecentVisitsForURL(URLID id, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 | 472 |
| 413 // Computes the name of the specified database on disk. | 473 // Computes the name of the specified database on disk. |
| 414 FilePath GetThumbnailFileName() const; | 474 FilePath GetThumbnailFileName() const; |
| 415 | 475 |
| 416 // Returns the name of the Favicons database. This is the new name | 476 // Returns the name of the Favicons database. This is the new name |
| 417 // of the Thumbnails database. | 477 // of the Thumbnails database. |
| 418 // See ThumbnailDatabase::RenameAndDropThumbnails. | 478 // See ThumbnailDatabase::RenameAndDropThumbnails. |
| 419 FilePath GetFaviconsFileName() const; | 479 FilePath GetFaviconsFileName() const; |
| 420 FilePath GetArchivedFileName() const; | 480 FilePath GetArchivedFileName() const; |
| 421 | 481 |
| 482 #if defined(OS_ANDROID) |
| 483 // Returns the name of android cache database. |
| 484 FilePath GetAndroidCacheFileName() const; |
| 485 #endif |
| 486 |
| 422 class URLQuerier; | 487 class URLQuerier; |
| 423 friend class URLQuerier; | 488 friend class URLQuerier; |
| 424 | 489 |
| 425 // Does the work of Init. | 490 // Does the work of Init. |
| 426 void InitImpl(const std::string& languages); | 491 void InitImpl(const std::string& languages); |
| 427 | 492 |
| 428 // Adds a single visit to the database, updating the URL information such | 493 // Adds a single visit to the database, updating the URL information such |
| 429 // as visit and typed count. The visit ID of the added visit and the URL ID | 494 // as visit and typed count. The visit ID of the added visit and the URL ID |
| 430 // of the associated URL (whether added or not) is returned. Both values will | 495 // of the associated URL (whether added or not) is returned. Both values will |
| 431 // be 0 on failure. | 496 // be 0 on failure. |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 // may be NULL (during testing). | 737 // may be NULL (during testing). |
| 673 // | 738 // |
| 674 // Use GetBookmarkService to access this, which makes sure the service is | 739 // Use GetBookmarkService to access this, which makes sure the service is |
| 675 // loaded. | 740 // loaded. |
| 676 BookmarkService* bookmark_service_; | 741 BookmarkService* bookmark_service_; |
| 677 | 742 |
| 678 // Publishes the history to all indexers which are registered to receive | 743 // Publishes the history to all indexers which are registered to receive |
| 679 // history data from us. Can be NULL if there are no listeners. | 744 // history data from us. Can be NULL if there are no listeners. |
| 680 scoped_ptr<HistoryPublisher> history_publisher_; | 745 scoped_ptr<HistoryPublisher> history_publisher_; |
| 681 | 746 |
| 747 #if defined(OS_ANDROID) |
| 748 // Used to provide the Android ContentProvider APIs. |
| 749 scoped_ptr<AndroidProviderBackend> android_provider_backend_; |
| 750 #endif |
| 751 |
| 682 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 752 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
| 683 }; | 753 }; |
| 684 | 754 |
| 685 } // namespace history | 755 } // namespace history |
| 686 | 756 |
| 687 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 757 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
| OLD | NEW |