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