flags_ui.h revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
1// Copyright (c) 2012 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_FLAGS_UI_H_
6#define CHROME_BROWSER_UI_WEBUI_FLAGS_UI_H_
7
8#include "base/memory/weak_ptr.h"
9#include "content/public/browser/web_ui_controller.h"
10#include "ui/base/layout.h"
11
12#if defined(OS_CHROMEOS)
13#include "chrome/browser/chromeos/settings/device_settings_service.h"
14#endif
15
16class PrefRegistrySimple;
17class PrefRegistrySyncable;
18class Profile;
19
20namespace base {
21class RefCountedMemory;
22}
23
24class FlagsUI : public content::WebUIController {
25 public:
26  explicit FlagsUI(content::WebUI* web_ui);
27  virtual ~FlagsUI();
28
29  static base::RefCountedMemory* GetFaviconResourceBytes(
30      ui::ScaleFactor scale_factor);
31  static void RegisterPrefs(PrefRegistrySimple* registry);
32#if defined(OS_CHROMEOS)
33  static void RegisterUserPrefs(PrefRegistrySyncable* registry);
34#endif
35
36 private:
37#if defined(OS_CHROMEOS)
38  // On ChromeOS verifying if the owner is signed in is async operation and only
39  // after finishing it the UI can be properly populated. This function is the
40  // callback for whether the owner is signed in. It will respectively pick the
41  // proper PrefService for the flags interface.
42  void FinishInitialization(
43      Profile* profile,
44      chromeos::DeviceSettingsService::OwnershipStatus status,
45      bool current_user_is_owner);
46#endif
47  base::WeakPtrFactory<FlagsUI> weak_factory_;
48
49  DISALLOW_COPY_AND_ASSIGN(FlagsUI);
50};
51
52#endif  // CHROME_BROWSER_UI_WEBUI_FLAGS_UI_H_
53