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 16 class PrefRegistrySimple; 17 class Profile; 18 19 namespace base { 20 class RefCountedMemory; 21 } 22 23 namespace user_prefs { 24 class PrefRegistrySyncable; 25 } 26 27 class FlagsUI : public content::WebUIController { 28 public: 29 explicit FlagsUI(content::WebUI* web_ui); 30 virtual ~FlagsUI(); 31 32 static base::RefCountedMemory* GetFaviconResourceBytes( 33 ui::ScaleFactor scale_factor); 34 static void RegisterPrefs(PrefRegistrySimple* registry); 35 #if defined(OS_CHROMEOS) 36 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 37 #endif 38 39 private: 40 #if defined(OS_CHROMEOS) 41 // On ChromeOS verifying if the owner is signed in is async operation and only 42 // after finishing it the UI can be properly populated. This function is the 43 // callback for whether the owner is signed in. It will respectively pick the 44 // proper PrefService for the flags interface. 45 void FinishInitialization( 46 Profile* profile, 47 chromeos::DeviceSettingsService::OwnershipStatus status, 48 bool current_user_is_owner); 49 #endif 50 base::WeakPtrFactory<FlagsUI> weak_factory_; 51 52 DISALLOW_COPY_AND_ASSIGN(FlagsUI); 53 }; 54 55 #endif // CHROME_BROWSER_UI_WEBUI_FLAGS_UI_H_ 56