sync_file_system_internals_handler.h revision 7d4cd473f85ac64c3747c96c277f9e506a0d2246
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 12class Profile; 13 14namespace 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. 20class 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 // The last log ID sent to the JavaScript side. 49 int last_log_id_sent_; 50 51 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemInternalsHandler); 52}; 53 54} // namespace syncfs_internals 55 56#endif // CHROME_BROWSER_UI_WEBUI_SYNC_FILE_SYSTEM_INTERNALS_SYNC_FILE_SYSTEM_INTERNALS_HANDLER_H_ 57