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