summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/webui/components_ui.h
blob: f184dbeeb0f8705d300c1e1a05e2a38f2e484bf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_WEBUI_COMPONENTS_UI_H_
#define CHROME_BROWSER_UI_WEBUI_COMPONENTS_UI_H_

#include <string>

#include "components/component_updater/component_updater_service.h"
#include "components/update_client/crx_update_item.h"
#include "content/public/browser/web_ui_controller.h"
#include "ui/base/layout.h"

namespace base {
class RefCountedMemory;
}

namespace user_prefs {
class PrefRegistrySyncable;
}

class ComponentsUI : public content::WebUIController,
                     public component_updater::ServiceObserver {
 public:
  explicit ComponentsUI(content::WebUI* web_ui);
  ~ComponentsUI() override;

  static void OnDemandUpdate(const std::string& component_id);

  static base::ListValue* LoadComponents();

  static base::RefCountedMemory* GetFaviconResourceBytes(
      ui::ScaleFactor scale_factor);

  // ServiceObserver implementation.
  void OnEvent(Events event, const std::string& id) override;

 private:
  static base::string16 ComponentEventToString(Events event);
  static base::string16 ServiceStatusToString(
      update_client::CrxUpdateItem::State state);
  DISALLOW_COPY_AND_ASSIGN(ComponentsUI);
};

#endif  // CHROME_BROWSER_UI_WEBUI_COMPONENTS_UI_H_