| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_UI_WEBUI_BROWSING_HISTORY_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_BROWSING_HISTORY_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_BROWSING_HISTORY_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_BROWSING_HISTORY_HANDLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <set> | |
| 12 #include <string> | 11 #include <string> |
| 13 #include <vector> | |
| 14 | 12 |
| 15 #include "base/macros.h" | 13 #include "base/macros.h" |
| 16 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 17 #include "base/scoped_observer.h" | 15 #include "base/scoped_observer.h" |
| 18 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 19 #include "base/task/cancelable_task_tracker.h" | 17 #include "base/task/cancelable_task_tracker.h" |
| 20 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
| 21 #include "base/values.h" | 19 #include "base/values.h" |
| 22 #include "components/history/core/browser/history_service_observer.h" | 20 #include "components/history/core/browser/history_service_observer.h" |
| 23 #include "components/history/core/browser/url_row.h" | 21 #include "components/history/core/browser/url_row.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 36 namespace browser_sync { | 34 namespace browser_sync { |
| 37 class ProfileSyncService; | 35 class ProfileSyncService; |
| 38 } // namespace browser_sync | 36 } // namespace browser_sync |
| 39 | 37 |
| 40 namespace history { | 38 namespace history { |
| 41 class HistoryService; | 39 class HistoryService; |
| 42 class QueryResults; | 40 class QueryResults; |
| 43 struct QueryOptions; | 41 struct QueryOptions; |
| 44 } // namespace history | 42 } // namespace history |
| 45 | 43 |
| 46 namespace syncer { | 44 namespace sync_driver { |
| 47 class SyncServiceObserver; | 45 class SyncServiceObserver; |
| 48 } // namespace syncer | 46 } // namespace sync_driver |
| 49 | 47 |
| 50 // The handler for Javascript messages related to the "history" view. | 48 // The handler for Javascript messages related to the "history" view. |
| 51 class BrowsingHistoryHandler : public content::WebUIMessageHandler, | 49 class BrowsingHistoryHandler : public content::WebUIMessageHandler, |
| 52 public history::HistoryServiceObserver, | 50 public history::HistoryServiceObserver, |
| 53 public history::WebHistoryServiceObserver, | 51 public history::WebHistoryServiceObserver, |
| 54 public syncer::SyncServiceObserver { | 52 public sync_driver::SyncServiceObserver { |
| 55 public: | 53 public: |
| 56 // Represents a history entry to be shown to the user, representing either | 54 // Represents a history entry to be shown to the user, representing either |
| 57 // a local or remote visit. A single entry can represent multiple visits, | 55 // a local or remote visit. A single entry can represent multiple visits, |
| 58 // since only the most recent visit on a particular day is shown. | 56 // since only the most recent visit on a particular day is shown. |
| 59 struct HistoryEntry { | 57 struct HistoryEntry { |
| 60 // Values indicating whether an entry represents only local visits, only | 58 // Values indicating whether an entry represents only local visits, only |
| 61 // remote visits, or a mixture of both. | 59 // remote visits, or a mixture of both. |
| 62 enum EntryType { | 60 enum EntryType { |
| 63 EMPTY_ENTRY = 0, | 61 EMPTY_ENTRY = 0, |
| 64 LOCAL_ENTRY, | 62 LOCAL_ENTRY, |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 240 |
| 243 // HistoryService (local history) observer. | 241 // HistoryService (local history) observer. |
| 244 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> | 242 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> |
| 245 history_service_observer_; | 243 history_service_observer_; |
| 246 | 244 |
| 247 // WebHistoryService (synced history) observer. | 245 // WebHistoryService (synced history) observer. |
| 248 ScopedObserver<history::WebHistoryService, history::WebHistoryServiceObserver> | 246 ScopedObserver<history::WebHistoryService, history::WebHistoryServiceObserver> |
| 249 web_history_service_observer_; | 247 web_history_service_observer_; |
| 250 | 248 |
| 251 // ProfileSyncService observer listens to late initialization of history sync. | 249 // ProfileSyncService observer listens to late initialization of history sync. |
| 252 ScopedObserver<browser_sync::ProfileSyncService, syncer::SyncServiceObserver> | 250 ScopedObserver<browser_sync::ProfileSyncService, |
| 251 sync_driver::SyncServiceObserver> |
| 253 sync_service_observer_; | 252 sync_service_observer_; |
| 254 | 253 |
| 255 // Whether the last call to Web History returned synced results. | 254 // Whether the last call to Web History returned synced results. |
| 256 bool has_synced_results_; | 255 bool has_synced_results_; |
| 257 | 256 |
| 258 // Whether there are other forms of browsing history on the history server. | 257 // Whether there are other forms of browsing history on the history server. |
| 259 bool has_other_forms_of_browsing_history_; | 258 bool has_other_forms_of_browsing_history_; |
| 260 | 259 |
| 261 base::WeakPtrFactory<BrowsingHistoryHandler> weak_factory_; | 260 base::WeakPtrFactory<BrowsingHistoryHandler> weak_factory_; |
| 262 | 261 |
| 263 DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryHandler); | 262 DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryHandler); |
| 264 }; | 263 }; |
| 265 | 264 |
| 266 #endif // CHROME_BROWSER_UI_WEBUI_BROWSING_HISTORY_HANDLER_H_ | 265 #endif // CHROME_BROWSER_UI_WEBUI_BROWSING_HISTORY_HANDLER_H_ |
| OLD | NEW |