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_COMPONENTS_UI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_COMPONENTS_UI_H_ 7 8 #include "chrome/browser/component_updater/component_updater_service.h" 9 #include "chrome/browser/component_updater/crx_update_item.h" 10 #include "content/public/browser/web_ui_controller.h" 11 #include "ui/base/layout.h" 12 13 namespace base { 14 class RefCountedMemory; 15 } 16 17 namespace user_prefs { 18 class PrefRegistrySyncable; 19 } 20 21 class ComponentsUI : public content::WebUIController, 22 public component_updater::ServiceObserver { 23 public: 24 explicit ComponentsUI(content::WebUI* web_ui); 25 virtual ~ComponentsUI(); 26 27 static void OnDemandUpdate(const std::string& component_id); 28 29 static base::ListValue* LoadComponents(); 30 31 static base::RefCountedMemory* GetFaviconResourceBytes( 32 ui::ScaleFactor scale_factor); 33 34 // ServiceObserver implementation. 35 virtual void OnEvent(Events event, const std::string& id) OVERRIDE; 36 37 private: 38 static base::string16 ComponentEventToString(Events event); 39 static base::string16 ServiceStatusToString( 40 component_updater::CrxUpdateItem::Status status); 41 DISALLOW_COPY_AND_ASSIGN(ComponentsUI); 42 }; 43 44 #endif // CHROME_BROWSER_UI_WEBUI_COMPONENTS_UI_H_ 45