| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/ui/webui/flags_ui.h" | 5 #include "chrome/browser/ui/webui/flags_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 FlagsUI::FlagsUI(content::WebUI* web_ui) | 285 FlagsUI::FlagsUI(content::WebUI* web_ui) |
| 286 : WebUIController(web_ui), | 286 : WebUIController(web_ui), |
| 287 weak_factory_(this) { | 287 weak_factory_(this) { |
| 288 Profile* profile = Profile::FromWebUI(web_ui); | 288 Profile* profile = Profile::FromWebUI(web_ui); |
| 289 | 289 |
| 290 FlagsDOMHandler* handler = new FlagsDOMHandler(); | 290 FlagsDOMHandler* handler = new FlagsDOMHandler(); |
| 291 web_ui->AddMessageHandler(handler); | 291 web_ui->AddMessageHandler(handler); |
| 292 | 292 |
| 293 #if defined(OS_CHROMEOS) | 293 #if defined(OS_CHROMEOS) |
| 294 if (base::SysInfo::IsRunningOnChromeOS() && | 294 if (base::SysInfo::IsRunningOnChromeOS() && |
| 295 chromeos::OwnerSettingsServiceChromeOSFactory::GetForProfile(profile)) { | 295 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( |
| 296 profile)) { |
| 296 chromeos::OwnerSettingsServiceChromeOS* service = | 297 chromeos::OwnerSettingsServiceChromeOS* service = |
| 297 chromeos::OwnerSettingsServiceChromeOSFactory::GetForProfile(profile); | 298 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( |
| 299 profile); |
| 298 service->IsOwnerAsync(base::Bind( | 300 service->IsOwnerAsync(base::Bind( |
| 299 &FinishInitialization, weak_factory_.GetWeakPtr(), profile, handler)); | 301 &FinishInitialization, weak_factory_.GetWeakPtr(), profile, handler)); |
| 300 } else { | 302 } else { |
| 301 FinishInitialization(weak_factory_.GetWeakPtr(), | 303 FinishInitialization(weak_factory_.GetWeakPtr(), profile, handler, |
| 302 profile, | |
| 303 handler, | |
| 304 false /* current_user_is_owner */); | 304 false /* current_user_is_owner */); |
| 305 } | 305 } |
| 306 #else | 306 #else |
| 307 handler->Init(new about_flags::PrefServiceFlagsStorage( | 307 handler->Init(new about_flags::PrefServiceFlagsStorage( |
| 308 g_browser_process->local_state()), | 308 g_browser_process->local_state()), |
| 309 about_flags::kOwnerAccessToFlags); | 309 about_flags::kOwnerAccessToFlags); |
| 310 #endif | 310 #endif |
| 311 | 311 |
| 312 // Set up the about:flags source. | 312 // Set up the about:flags source. |
| 313 content::WebUIDataSource::Add(profile, CreateFlagsUIHTMLSource()); | 313 content::WebUIDataSource::Add(profile, CreateFlagsUIHTMLSource()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 329 } | 329 } |
| 330 | 330 |
| 331 #if defined(OS_CHROMEOS) | 331 #if defined(OS_CHROMEOS) |
| 332 // static | 332 // static |
| 333 void FlagsUI::RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 333 void FlagsUI::RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 334 registry->RegisterListPref(prefs::kEnabledLabsExperiments, | 334 registry->RegisterListPref(prefs::kEnabledLabsExperiments, |
| 335 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 335 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 336 } | 336 } |
| 337 | 337 |
| 338 #endif | 338 #endif |
| OLD | NEW |