| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 const string16& term); | 304 const string16& term); |
| 303 | 305 |
| 304 void DeleteAllSearchTermsForKeyword(TemplateURLID keyword_id); | 306 void DeleteAllSearchTermsForKeyword(TemplateURLID keyword_id); |
| 305 | 307 |
| 306 void GetMostRecentKeywordSearchTerms( | 308 void GetMostRecentKeywordSearchTerms( |
| 307 scoped_refptr<GetMostRecentKeywordSearchTermsRequest> request, | 309 scoped_refptr<GetMostRecentKeywordSearchTermsRequest> request, |
| 308 TemplateURLID keyword_id, | 310 TemplateURLID keyword_id, |
| 309 const string16& prefix, | 311 const string16& prefix, |
| 310 int max_count); | 312 int max_count); |
| 311 | 313 |
| 314 #if defined(OS_ANDROID) |
| 315 // Android Provider --------------------------------------------------------- |
| 316 |
| 317 // History and bookmarks ---------------------------------------------------- |
| 318 void InsertHistoryAndBookmark(scoped_refptr<InsertRequest> request, |
| 319 const HistoryAndBookmarkRow& row); |
| 320 |
| 321 void QueryHistoryAndBookmarks( |
| 322 scoped_refptr<QueryRequest> request, |
| 323 const std::vector<HistoryAndBookmarkRow::ColumnID>& projections, |
| 324 const std::string& selection, |
| 325 const std::vector<string16>& selection_args, |
| 326 const std::string& sort_order); |
| 327 |
| 328 void UpdateHistoryAndBookmarks(scoped_refptr<UpdateRequest> request, |
| 329 const HistoryAndBookmarkRow& row, |
| 330 const std::string& selection, |
| 331 const std::vector<string16>& selection_args); |
| 332 |
| 333 void DeleteHistoryAndBookmarks(scoped_refptr<DeleteRequest> request, |
| 334 const std::string& selection, |
| 335 const std::vector<string16>& selection_args); |
| 336 |
| 337 void DeleteHistory(scoped_refptr<DeleteRequest> request, |
| 338 const std::string& selection, |
| 339 const std::vector<string16>& selection_args); |
| 340 |
| 341 // Statement ---------------------------------------------------------------- |
| 342 // Move the statement's current position. |
| 343 void MoveStatement(scoped_refptr<MoveStatementRequest> request, |
| 344 history::AndroidStatement* statement, |
| 345 int current_pos, |
| 346 int destination); |
| 347 |
| 348 // Close the given statement. The ownership is transfered. |
| 349 void CloseStatement(AndroidStatement* statement); |
| 350 |
| 351 // Search terms ------------------------------------------------------------- |
| 352 void InsertSearchTerm(scoped_refptr<InsertRequest> request, |
| 353 const SearchRow& row); |
| 354 |
| 355 void UpdateSearchTerms(scoped_refptr<UpdateRequest> request, |
| 356 const SearchRow& row, |
| 357 const std::string& selection, |
| 358 const std::vector<string16> selection_args); |
| 359 |
| 360 void DeleteSearchTerms(scoped_refptr<DeleteRequest> request, |
| 361 const std::string& selection, |
| 362 const std::vector<string16> selection_args); |
| 363 |
| 364 void QuerySearchTerms(scoped_refptr<QueryRequest> request, |
| 365 const std::vector<SearchRow::ColumnID>& projections, |
| 366 const std::string& selection, |
| 367 const std::vector<string16>& selection_args, |
| 368 const std::string& sort_order); |
| 369 |
| 370 #endif // defined(OS_ANDROID) |
| 371 |
| 312 // Generic operations -------------------------------------------------------- | 372 // Generic operations -------------------------------------------------------- |
| 313 | 373 |
| 314 void ProcessDBTask(scoped_refptr<HistoryDBTaskRequest> request); | 374 void ProcessDBTask(scoped_refptr<HistoryDBTaskRequest> request); |
| 315 | 375 |
| 316 virtual bool GetAllTypedURLs(URLRows* urls); | 376 virtual bool GetAllTypedURLs(URLRows* urls); |
| 317 | 377 |
| 318 virtual bool GetVisitsForURL(URLID id, VisitVector* visits); | 378 virtual bool GetVisitsForURL(URLID id, VisitVector* visits); |
| 319 | 379 |
| 320 // Fetches up to |max_visits| most recent visits for the passed URL. | 380 // Fetches up to |max_visits| most recent visits for the passed URL. |
| 321 virtual bool GetMostRecentVisitsForURL(URLID id, | 381 virtual bool GetMostRecentVisitsForURL(URLID id, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 | 475 |
| 416 // Computes the name of the specified database on disk. | 476 // Computes the name of the specified database on disk. |
| 417 FilePath GetThumbnailFileName() const; | 477 FilePath GetThumbnailFileName() const; |
| 418 | 478 |
| 419 // Returns the name of the Favicons database. This is the new name | 479 // Returns the name of the Favicons database. This is the new name |
| 420 // of the Thumbnails database. | 480 // of the Thumbnails database. |
| 421 // See ThumbnailDatabase::RenameAndDropThumbnails. | 481 // See ThumbnailDatabase::RenameAndDropThumbnails. |
| 422 FilePath GetFaviconsFileName() const; | 482 FilePath GetFaviconsFileName() const; |
| 423 FilePath GetArchivedFileName() const; | 483 FilePath GetArchivedFileName() const; |
| 424 | 484 |
| 485 #if defined(OS_ANDROID) |
| 486 // Returns the name of android cache database. |
| 487 FilePath GetAndroidCacheFileName() const; |
| 488 #endif |
| 489 |
| 425 class URLQuerier; | 490 class URLQuerier; |
| 426 friend class URLQuerier; | 491 friend class URLQuerier; |
| 427 | 492 |
| 428 // Does the work of Init. | 493 // Does the work of Init. |
| 429 void InitImpl(const std::string& languages); | 494 void InitImpl(const std::string& languages); |
| 430 | 495 |
| 431 // Adds a single visit to the database, updating the URL information such | 496 // Adds a single visit to the database, updating the URL information such |
| 432 // as visit and typed count. The visit ID of the added visit and the URL ID | 497 // as visit and typed count. The visit ID of the added visit and the URL ID |
| 433 // of the associated URL (whether added or not) is returned. Both values will | 498 // of the associated URL (whether added or not) is returned. Both values will |
| 434 // be 0 on failure. | 499 // be 0 on failure. |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 // may be NULL (during testing). | 743 // may be NULL (during testing). |
| 679 // | 744 // |
| 680 // Use GetBookmarkService to access this, which makes sure the service is | 745 // Use GetBookmarkService to access this, which makes sure the service is |
| 681 // loaded. | 746 // loaded. |
| 682 BookmarkService* bookmark_service_; | 747 BookmarkService* bookmark_service_; |
| 683 | 748 |
| 684 // Publishes the history to all indexers which are registered to receive | 749 // Publishes the history to all indexers which are registered to receive |
| 685 // history data from us. Can be NULL if there are no listeners. | 750 // history data from us. Can be NULL if there are no listeners. |
| 686 scoped_ptr<HistoryPublisher> history_publisher_; | 751 scoped_ptr<HistoryPublisher> history_publisher_; |
| 687 | 752 |
| 753 #if defined(OS_ANDROID) |
| 754 // Used to provide the Android ContentProvider APIs. |
| 755 scoped_ptr<AndroidProviderBackend> android_provider_backend_; |
| 756 #endif |
| 757 |
| 688 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 758 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
| 689 }; | 759 }; |
| 690 | 760 |
| 691 } // namespace history | 761 } // namespace history |
| 692 | 762 |
| 693 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 763 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
| OLD | NEW |