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" |
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/webui/web_ui.h" |
21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
22 #include "content/public/browser/web_ui_message_handler.h" | 23 #include "content/public/browser/web_ui_message_handler.h" |
23 #include "grit/browser_resources.h" | 24 #include "grit/browser_resources.h" |
24 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
26 #include "grit/theme_resources_standard.h" | 27 #include "grit/theme_resources_standard.h" |
27 #include "grit/theme_resources.h" | 28 #include "grit/theme_resources.h" |
28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
29 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
30 | 31 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 147 } |
147 | 148 |
148 } // namespace | 149 } // namespace |
149 | 150 |
150 /////////////////////////////////////////////////////////////////////////////// | 151 /////////////////////////////////////////////////////////////////////////////// |
151 // | 152 // |
152 // FlagsUI | 153 // FlagsUI |
153 // | 154 // |
154 /////////////////////////////////////////////////////////////////////////////// | 155 /////////////////////////////////////////////////////////////////////////////// |
155 | 156 |
156 FlagsUI::FlagsUI(WebContents* contents) : WebUI(contents, this) { | 157 FlagsUI::FlagsUI(WebUI* web_ui) : WebUIController(web_ui) { |
157 AddMessageHandler(new FlagsDOMHandler()); | 158 web_ui->AddMessageHandler(new FlagsDOMHandler()); |
158 | 159 |
159 // Set up the about:flags source. | 160 // Set up the about:flags source. |
160 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 161 Profile* profile = Profile::FromBrowserContext( |
| 162 web_ui->web_contents()->GetBrowserContext()); |
161 profile->GetChromeURLDataManager()->AddDataSource(CreateFlagsUIHTMLSource()); | 163 profile->GetChromeURLDataManager()->AddDataSource(CreateFlagsUIHTMLSource()); |
162 } | 164 } |
163 | 165 |
164 // static | 166 // static |
165 RefCountedMemory* FlagsUI::GetFaviconResourceBytes() { | 167 RefCountedMemory* FlagsUI::GetFaviconResourceBytes() { |
166 return ResourceBundle::GetSharedInstance(). | 168 return ResourceBundle::GetSharedInstance(). |
167 LoadDataResourceBytes(IDR_FLAGS); | 169 LoadDataResourceBytes(IDR_FLAGS); |
168 } | 170 } |
169 | 171 |
170 // static | 172 // static |
171 void FlagsUI::RegisterPrefs(PrefService* prefs) { | 173 void FlagsUI::RegisterPrefs(PrefService* prefs) { |
172 prefs->RegisterListPref(prefs::kEnabledLabsExperiments); | 174 prefs->RegisterListPref(prefs::kEnabledLabsExperiments); |
173 } | 175 } |
OLD | NEW |