- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / webui / sync_file_system_internals / sync_file_system_internals_handler.h
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.
4
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_
7
8 #include "base/compiler_specific.h"
9 #include "chrome/browser/sync_file_system/sync_event_observer.h"
10 #include "content/public/browser/web_ui_message_handler.h"
11
12 class Profile;
13
14 namespace syncfs_internals {
15
16 // This class handles message from WebUI page of chrome://syncfs-internals/
17 // for the Sync Service tab. It corresponds to browser/resources/
18 // sync_file_system_internals/sync_service.html. All methods in this class
19 // should be called on UI thread.
20 class SyncFileSystemInternalsHandler
21     : public content::WebUIMessageHandler,
22       public sync_file_system::SyncEventObserver {
23  public:
24   explicit SyncFileSystemInternalsHandler(Profile* profile);
25   virtual ~SyncFileSystemInternalsHandler();
26
27   // content::WebUIMessageHandler implementation.
28   virtual void RegisterMessages() OVERRIDE;
29
30   // sync_file_system::SyncEventObserver interface implementation.
31   virtual void OnSyncStateUpdated(
32       const GURL& app_origin,
33       sync_file_system::SyncServiceState state,
34       const std::string& description) OVERRIDE;
35   virtual void OnFileSynced(
36       const fileapi::FileSystemURL& url,
37       sync_file_system::SyncFileStatus status,
38       sync_file_system::SyncAction action,
39       sync_file_system::SyncDirection direction) OVERRIDE;
40
41  private:
42   void GetServiceStatus(const base::ListValue* args);
43   void GetNotificationSource(const base::ListValue* args);
44   void GetLog(const base::ListValue* args);
45
46   Profile* profile_;
47
48   DISALLOW_COPY_AND_ASSIGN(SyncFileSystemInternalsHandler);
49 };
50
51 }  // namespace syncfs_internals
52
53 #endif  // CHROME_BROWSER_UI_WEBUI_SYNC_FILE_SYSTEM_INTERNALS_SYNC_FILE_SYSTEM_INTERNALS_HANDLER_H_