| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/about_flags.h" | 13 #include "chrome/browser/about_flags.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/browser_list.h" | 17 #include "chrome/browser/ui/browser_list.h" |
| 18 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 18 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 20 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 21 #include "content/browser/tab_contents/tab_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 22 #include "grit/browser_resources.h" | 22 #include "grit/browser_resources.h" |
| 23 #include "grit/chromium_strings.h" | 23 #include "grit/chromium_strings.h" |
| 24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 25 #include "grit/theme_resources_standard.h" | 25 #include "grit/theme_resources_standard.h" |
| 26 #include "grit/theme_resources.h" | 26 #include "grit/theme_resources.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 29 | 29 |
| 30 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
| 31 #include "chrome/browser/chromeos/cros_settings.h" | 31 #include "chrome/browser/chromeos/cros_settings.h" |
| 32 #include "chrome/browser/chromeos/login/user_manager.h" | 32 #include "chrome/browser/chromeos/login/user_manager.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 using content::WebContents; |
| 36 |
| 35 namespace { | 37 namespace { |
| 36 | 38 |
| 37 ChromeWebUIDataSource* CreateFlagsUIHTMLSource() { | 39 ChromeWebUIDataSource* CreateFlagsUIHTMLSource() { |
| 38 ChromeWebUIDataSource* source = | 40 ChromeWebUIDataSource* source = |
| 39 new ChromeWebUIDataSource(chrome::kChromeUIFlagsHost); | 41 new ChromeWebUIDataSource(chrome::kChromeUIFlagsHost); |
| 40 | 42 |
| 41 source->AddLocalizedString("flagsLongTitle", IDS_FLAGS_LONG_TITLE); | 43 source->AddLocalizedString("flagsLongTitle", IDS_FLAGS_LONG_TITLE); |
| 42 source->AddLocalizedString("flagsTableTitle", IDS_FLAGS_TABLE_TITLE); | 44 source->AddLocalizedString("flagsTableTitle", IDS_FLAGS_TABLE_TITLE); |
| 43 source->AddLocalizedString("flagsNoExperimentsAvailable", | 45 source->AddLocalizedString("flagsNoExperimentsAvailable", |
| 44 IDS_FLAGS_NO_EXPERIMENTS_AVAILABLE); | 46 IDS_FLAGS_NO_EXPERIMENTS_AVAILABLE); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 150 } |
| 149 | 151 |
| 150 } // namespace | 152 } // namespace |
| 151 | 153 |
| 152 /////////////////////////////////////////////////////////////////////////////// | 154 /////////////////////////////////////////////////////////////////////////////// |
| 153 // | 155 // |
| 154 // FlagsUI | 156 // FlagsUI |
| 155 // | 157 // |
| 156 /////////////////////////////////////////////////////////////////////////////// | 158 /////////////////////////////////////////////////////////////////////////////// |
| 157 | 159 |
| 158 FlagsUI::FlagsUI(TabContents* contents) : ChromeWebUI(contents) { | 160 FlagsUI::FlagsUI(WebContents* contents) : ChromeWebUI(contents) { |
| 159 AddMessageHandler(new FlagsDOMHandler()); | 161 AddMessageHandler(new FlagsDOMHandler()); |
| 160 | 162 |
| 161 // Set up the about:flags source. | 163 // Set up the about:flags source. |
| 162 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 164 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 163 profile->GetChromeURLDataManager()->AddDataSource(CreateFlagsUIHTMLSource()); | 165 profile->GetChromeURLDataManager()->AddDataSource(CreateFlagsUIHTMLSource()); |
| 164 } | 166 } |
| 165 | 167 |
| 166 // static | 168 // static |
| 167 RefCountedMemory* FlagsUI::GetFaviconResourceBytes() { | 169 RefCountedMemory* FlagsUI::GetFaviconResourceBytes() { |
| 168 return ResourceBundle::GetSharedInstance(). | 170 return ResourceBundle::GetSharedInstance(). |
| 169 LoadDataResourceBytes(IDR_FLAGS); | 171 LoadDataResourceBytes(IDR_FLAGS); |
| 170 } | 172 } |
| 171 | 173 |
| 172 // static | 174 // static |
| 173 void FlagsUI::RegisterPrefs(PrefService* prefs) { | 175 void FlagsUI::RegisterPrefs(PrefService* prefs) { |
| 174 prefs->RegisterListPref(prefs::kEnabledLabsExperiments); | 176 prefs->RegisterListPref(prefs::kEnabledLabsExperiments); |
| 175 } | 177 } |
| OLD | NEW |