Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: chrome/browser/history/history.h

Issue 343067: Unittest for fix to allow navigation when there is no history DB.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_unittest.cc ('k') | chrome/browser/history/history.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_H__ 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_H__
6 #define CHROME_BROWSER_HISTORY_HISTORY_H__ 6 #define CHROME_BROWSER_HISTORY_HISTORY_H__
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // Must call Init after construction. 94 // Must call Init after construction.
95 explicit HistoryService(Profile* profile); 95 explicit HistoryService(Profile* profile);
96 // The empty constructor is provided only for testing. 96 // The empty constructor is provided only for testing.
97 HistoryService(); 97 HistoryService();
98 ~HistoryService(); 98 ~HistoryService();
99 99
100 // Initializes the history service, returning true on success. On false, do 100 // Initializes the history service, returning true on success. On false, do
101 // not call any other functions. The given directory will be used for storing 101 // not call any other functions. The given directory will be used for storing
102 // the history files. The BookmarkService is used when deleting URLs to 102 // the history files. The BookmarkService is used when deleting URLs to
103 // test if a URL is bookmarked; it may be NULL during testing. 103 // test if a URL is bookmarked; it may be NULL during testing.
104 bool Init(const FilePath& history_dir, BookmarkService* bookmark_service); 104 bool Init(const FilePath& history_dir, BookmarkService* bookmark_service) {
105 return Init(history_dir, bookmark_service, false);
106 }
105 107
106 // Triggers the backend to load if it hasn't already, and then returns whether 108 // Triggers the backend to load if it hasn't already, and then returns whether
107 // it's finished loading. 109 // it's finished loading.
108 bool BackendLoaded(); 110 bool BackendLoaded();
109 111
110 // Unloads the backend without actually shutting down the history service. 112 // Unloads the backend without actually shutting down the history service.
111 // This can be used to temporarily reduce the browser process' memory 113 // This can be used to temporarily reduce the browser process' memory
112 // footprint. 114 // footprint.
113 void UnloadBackend(); 115 void UnloadBackend();
114 116
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 PRIORITY_UI, // The highest priority (must respond to UI events). 540 PRIORITY_UI, // The highest priority (must respond to UI events).
539 PRIORITY_NORMAL, // Normal stuff like adding a page. 541 PRIORITY_NORMAL, // Normal stuff like adding a page.
540 PRIORITY_LOW, // Low priority things like indexing or expiration. 542 PRIORITY_LOW, // Low priority things like indexing or expiration.
541 }; 543 };
542 544
543 // Implementation of NotificationObserver. 545 // Implementation of NotificationObserver.
544 virtual void Observe(NotificationType type, 546 virtual void Observe(NotificationType type,
545 const NotificationSource& source, 547 const NotificationSource& source,
546 const NotificationDetails& details); 548 const NotificationDetails& details);
547 549
550 // Low-level Init(). Same as the public version, but adds a |no_db| parameter
551 // that is only set by unittests which causes the backend to not init its DB.
552 bool Init(const FilePath& history_dir,
553 BookmarkService* bookmark_service,
554 bool no_db);
555
548 // Called by the HistoryURLProvider class to schedule an autocomplete, it 556 // Called by the HistoryURLProvider class to schedule an autocomplete, it
549 // will be called back on the internal history thread with the history 557 // will be called back on the internal history thread with the history
550 // database so it can query. See history_autocomplete.cc for a diagram. 558 // database so it can query. See history_autocomplete.cc for a diagram.
551 void ScheduleAutocomplete(HistoryURLProvider* provider, 559 void ScheduleAutocomplete(HistoryURLProvider* provider,
552 HistoryURLProviderParams* params); 560 HistoryURLProviderParams* params);
553 561
554 // Broadcasts the given notification. This is called by the backend so that 562 // Broadcasts the given notification. This is called by the backend so that
555 // the notification will be broadcast on the main thread. 563 // the notification will be broadcast on the main thread.
556 // 564 //
557 // The |details_deleted| pointer will be sent as the "details" for the 565 // The |details_deleted| pointer will be sent as the "details" for the
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 // The profile, may be null when testing. 798 // The profile, may be null when testing.
791 Profile* profile_; 799 Profile* profile_;
792 800
793 // Has the backend finished loading? The backend is loaded once Init has 801 // Has the backend finished loading? The backend is loaded once Init has
794 // completed. 802 // completed.
795 bool backend_loaded_; 803 bool backend_loaded_;
796 804
797 // Cached values from Init(), used whenever we need to reload the backend. 805 // Cached values from Init(), used whenever we need to reload the backend.
798 FilePath history_dir_; 806 FilePath history_dir_;
799 BookmarkService* bookmark_service_; 807 BookmarkService* bookmark_service_;
808 bool no_db_;
800 809
801 DISALLOW_COPY_AND_ASSIGN(HistoryService); 810 DISALLOW_COPY_AND_ASSIGN(HistoryService);
802 }; 811 };
803 812
804 #endif // CHROME_BROWSER_HISTORY_HISTORY_H__ 813 #endif // CHROME_BROWSER_HISTORY_HISTORY_H__
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_unittest.cc ('k') | chrome/browser/history/history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698