| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/flags_ui.h" | 5 #include "chrome/browser/dom_ui/flags_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/singleton.h" | 9 #include "base/singleton.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/about_flags.h" | 11 #include "chrome/browser/about_flags.h" |
| 12 #include "chrome/browser/browser_list.h" | 12 #include "chrome/browser/browser_list.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/browser_thread.h" | 14 #include "chrome/browser/browser_thread.h" |
| 15 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 15 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/tab_contents/tab_contents.h" |
| 17 #include "chrome/common/jstemplate_builder.h" | 19 #include "chrome/common/jstemplate_builder.h" |
| 18 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 19 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
| 20 #include "grit/browser_resources.h" | 22 #include "grit/browser_resources.h" |
| 21 #include "grit/chromium_strings.h" | 23 #include "grit/chromium_strings.h" |
| 22 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 23 #include "grit/theme_resources.h" | 25 #include "grit/theme_resources.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 25 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 26 | 28 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // FlagsUI | 175 // FlagsUI |
| 174 // | 176 // |
| 175 /////////////////////////////////////////////////////////////////////////////// | 177 /////////////////////////////////////////////////////////////////////////////// |
| 176 | 178 |
| 177 FlagsUI::FlagsUI(TabContents* contents) : DOMUI(contents) { | 179 FlagsUI::FlagsUI(TabContents* contents) : DOMUI(contents) { |
| 178 AddMessageHandler((new FlagsDOMHandler())->Attach(this)); | 180 AddMessageHandler((new FlagsDOMHandler())->Attach(this)); |
| 179 | 181 |
| 180 FlagsUIHTMLSource* html_source = new FlagsUIHTMLSource(); | 182 FlagsUIHTMLSource* html_source = new FlagsUIHTMLSource(); |
| 181 | 183 |
| 182 // Set up the about:flags source. | 184 // Set up the about:flags source. |
| 183 BrowserThread::PostTask( | 185 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
| 184 BrowserThread::IO, FROM_HERE, | |
| 185 NewRunnableMethod(ChromeURLDataManager::GetInstance(), | |
| 186 &ChromeURLDataManager::AddDataSource, | |
| 187 make_scoped_refptr(html_source))); | |
| 188 } | 186 } |
| 189 | 187 |
| 190 // static | 188 // static |
| 191 RefCountedMemory* FlagsUI::GetFaviconResourceBytes() { | 189 RefCountedMemory* FlagsUI::GetFaviconResourceBytes() { |
| 192 return ResourceBundle::GetSharedInstance(). | 190 return ResourceBundle::GetSharedInstance(). |
| 193 LoadDataResourceBytes(IDR_FLAGS); | 191 LoadDataResourceBytes(IDR_FLAGS); |
| 194 } | 192 } |
| 195 | 193 |
| 196 // static | 194 // static |
| 197 void FlagsUI::RegisterPrefs(PrefService* prefs) { | 195 void FlagsUI::RegisterPrefs(PrefService* prefs) { |
| 198 prefs->RegisterListPref(prefs::kEnabledLabsExperiments); | 196 prefs->RegisterListPref(prefs::kEnabledLabsExperiments); |
| 199 } | 197 } |
| OLD | NEW |