1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_SYNC_FILE_SYSTEM_INTERNALS_SYNC_FILE_SYSTEM_INTERNALS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_SYNC_FILE_SYSTEM_INTERNALS_SYNC_FILE_SYSTEM_INTERNALS_HANDLER_H_
10 #include "base/compiler_specific.h"
11 #include "chrome/browser/sync_file_system/sync_event_observer.h"
12 #include "chrome/browser/sync_file_system/task_logger.h"
13 #include "content/public/browser/web_ui_message_handler.h"
17 namespace syncfs_internals {
19 // This class handles message from WebUI page of chrome://syncfs-internals/
20 // for the Sync Service tab. It corresponds to browser/resources/
21 // sync_file_system_internals/sync_service.html. All methods in this class
22 // should be called on UI thread.
23 class SyncFileSystemInternalsHandler
24 : public content::WebUIMessageHandler,
25 public sync_file_system::SyncEventObserver,
26 public sync_file_system::TaskLogger::Observer {
28 explicit SyncFileSystemInternalsHandler(Profile* profile);
29 ~SyncFileSystemInternalsHandler() override;
31 // content::WebUIMessageHandler implementation.
32 void RegisterMessages() override;
34 // sync_file_system::SyncEventObserver interface implementation.
35 void OnSyncStateUpdated(const GURL& app_origin,
36 sync_file_system::SyncServiceState state,
37 const std::string& description) override;
38 void OnFileSynced(const storage::FileSystemURL& url,
39 sync_file_system::SyncFileType file_type,
40 sync_file_system::SyncFileStatus status,
41 sync_file_system::SyncAction action,
42 sync_file_system::SyncDirection direction) override;
44 // sync_file_system::TaskLogger::Observer implementation.
46 const sync_file_system::TaskLogger::TaskLog& task_log) override;
49 void GetServiceStatus(const base::ListValue* args);
50 void GetNotificationSource(const base::ListValue* args);
51 void GetLog(const base::ListValue* args);
52 void ClearLogs(const base::ListValue* args);
53 void ObserveTaskLog(const base::ListValue* args);
56 bool observing_task_log_;
58 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemInternalsHandler);
61 } // namespace syncfs_internals
63 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_FILE_SYSTEM_INTERNALS_SYNC_FILE_SYSTEM_INTERNALS_HANDLER_H_