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