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_EXTENSION_STATUSES_HANDLER_H_ 6#define CHROME_BROWSER_UI_WEBUI_SYNC_FILE_SYSTEM_INTERNALS_EXTENSION_STATUSES_HANDLER_H_ 7 8#include "base/compiler_specific.h" 9#include "base/memory/weak_ptr.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 Extension Statuses tab. It corresponds to browser/resources/ 18// sync_file_system_internals/extension_statuses.html. All methods in this class 19// should be called on UI thread. 20class ExtensionStatusesHandler : public content::WebUIMessageHandler { 21 public: 22 explicit ExtensionStatusesHandler(Profile* profile); 23 virtual ~ExtensionStatusesHandler(); 24 25 // Shared by Extension Statuses Tab and also File Metadata Tab to generate the 26 // extension drop down. 27 static void GetExtensionStatusesAsDictionary( 28 Profile* profile, 29 const base::Callback<void(const base::ListValue&)>& callback); 30 31 // WebUIMessageHandler implementation. 32 virtual void RegisterMessages() OVERRIDE; 33 34 private: 35 void GetExtensionStatuses(const base::ListValue* args); 36 void DidGetExtensionStatuses(const base::ListValue& list); 37 38 Profile* profile_; 39 base::WeakPtrFactory<ExtensionStatusesHandler> weak_ptr_factory_; 40 41 DISALLOW_COPY_AND_ASSIGN(ExtensionStatusesHandler); 42}; 43 44} // namespace syncfs_internals 45 46#endif // CHROME_BROWSER_UI_WEBUI_SYNC_FILE_SYSTEM_INTERNALS_EXTENSION_STATUSES_HANDLER_H_ 47