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