OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_SYNC_FILE_SYSTEM_INTERNALS_SYNC_FILE_SYSTEM_INTE
RNALS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SYNC_FILE_SYSTEM_INTERNALS_SYNC_FILE_SYSTEM_INTE
RNALS_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_SYNC_FILE_SYSTEM_INTERNALS_SYNC_FILE_SYSTEM_INTE
RNALS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_FILE_SYSTEM_INTERNALS_SYNC_FILE_SYSTEM_INTE
RNALS_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "chrome/browser/sync_file_system/sync_event_observer.h" | 11 #include "chrome/browser/sync_file_system/sync_event_observer.h" |
12 #include "chrome/browser/sync_file_system/task_logger.h" | 12 #include "chrome/browser/sync_file_system/task_logger.h" |
13 #include "content/public/browser/web_ui_message_handler.h" | 13 #include "content/public/browser/web_ui_message_handler.h" |
14 | 14 |
15 class Profile; | 15 class Profile; |
16 | 16 |
17 namespace syncfs_internals { | 17 namespace syncfs_internals { |
18 | 18 |
19 // This class handles message from WebUI page of chrome://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/ | 20 // for the Sync Service tab. It corresponds to browser/resources/ |
21 // sync_file_system_internals/sync_service.html. All methods in this class | 21 // sync_file_system_internals/sync_service.html. All methods in this class |
22 // should be called on UI thread. | 22 // should be called on UI thread. |
23 class SyncFileSystemInternalsHandler | 23 class SyncFileSystemInternalsHandler |
24 : public content::WebUIMessageHandler, | 24 : public content::WebUIMessageHandler, |
25 public sync_file_system::SyncEventObserver, | 25 public sync_file_system::SyncEventObserver, |
26 public sync_file_system::TaskLogger::Observer { | 26 public sync_file_system::TaskLogger::Observer { |
27 public: | 27 public: |
28 explicit SyncFileSystemInternalsHandler(Profile* profile); | 28 explicit SyncFileSystemInternalsHandler(Profile* profile); |
29 virtual ~SyncFileSystemInternalsHandler(); | 29 ~SyncFileSystemInternalsHandler() override; |
30 | 30 |
31 // content::WebUIMessageHandler implementation. | 31 // content::WebUIMessageHandler implementation. |
32 virtual void RegisterMessages() override; | 32 void RegisterMessages() override; |
33 | 33 |
34 // sync_file_system::SyncEventObserver interface implementation. | 34 // sync_file_system::SyncEventObserver interface implementation. |
35 virtual void OnSyncStateUpdated( | 35 void OnSyncStateUpdated(const GURL& app_origin, |
36 const GURL& app_origin, | 36 sync_file_system::SyncServiceState state, |
37 sync_file_system::SyncServiceState state, | 37 const std::string& description) override; |
38 const std::string& description) override; | 38 void OnFileSynced(const storage::FileSystemURL& url, |
39 virtual void OnFileSynced(const storage::FileSystemURL& url, | 39 sync_file_system::SyncFileType file_type, |
40 sync_file_system::SyncFileType file_type, | 40 sync_file_system::SyncFileStatus status, |
41 sync_file_system::SyncFileStatus status, | 41 sync_file_system::SyncAction action, |
42 sync_file_system::SyncAction action, | 42 sync_file_system::SyncDirection direction) override; |
43 sync_file_system::SyncDirection direction) override; | |
44 | 43 |
45 // sync_file_system::TaskLogger::Observer implementation. | 44 // sync_file_system::TaskLogger::Observer implementation. |
46 virtual void OnLogRecorded( | 45 void OnLogRecorded( |
47 const sync_file_system::TaskLogger::TaskLog& task_log) override; | 46 const sync_file_system::TaskLogger::TaskLog& task_log) override; |
48 | 47 |
49 private: | 48 private: |
50 void GetServiceStatus(const base::ListValue* args); | 49 void GetServiceStatus(const base::ListValue* args); |
51 void GetNotificationSource(const base::ListValue* args); | 50 void GetNotificationSource(const base::ListValue* args); |
52 void GetLog(const base::ListValue* args); | 51 void GetLog(const base::ListValue* args); |
53 void ClearLogs(const base::ListValue* args); | 52 void ClearLogs(const base::ListValue* args); |
54 void ObserveTaskLog(const base::ListValue* args); | 53 void ObserveTaskLog(const base::ListValue* args); |
55 | 54 |
56 Profile* profile_; | 55 Profile* profile_; |
57 bool observing_task_log_; | 56 bool observing_task_log_; |
58 | 57 |
59 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemInternalsHandler); | 58 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemInternalsHandler); |
60 }; | 59 }; |
61 | 60 |
62 } // namespace syncfs_internals | 61 } // namespace syncfs_internals |
63 | 62 |
64 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_FILE_SYSTEM_INTERNALS_SYNC_FILE_SYSTEM_I
NTERNALS_HANDLER_H_ | 63 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_FILE_SYSTEM_INTERNALS_SYNC_FILE_SYSTEM_I
NTERNALS_HANDLER_H_ |
OLD | NEW |