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/dom_ui/options/options_ui.h" | 5 #include "chrome/browser/dom_ui/options/options_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 #endif | 200 #endif |
201 #if defined(USE_NSS) | 201 #if defined(USE_NSS) |
202 AddOptionsPageUIHandler(localized_strings, new CertificateManagerHandler()); | 202 AddOptionsPageUIHandler(localized_strings, new CertificateManagerHandler()); |
203 #endif | 203 #endif |
204 | 204 |
205 // |localized_strings| ownership is taken over by this constructor. | 205 // |localized_strings| ownership is taken over by this constructor. |
206 OptionsUIHTMLSource* html_source = | 206 OptionsUIHTMLSource* html_source = |
207 new OptionsUIHTMLSource(localized_strings); | 207 new OptionsUIHTMLSource(localized_strings); |
208 | 208 |
209 // Set up the chrome://settings/ source. | 209 // Set up the chrome://settings/ source. |
210 BrowserThread::PostTask( | 210 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
211 BrowserThread::IO, FROM_HERE, | |
212 NewRunnableMethod( | |
213 ChromeURLDataManager::GetInstance(), | |
214 &ChromeURLDataManager::AddDataSource, | |
215 make_scoped_refptr(html_source))); | |
216 | 211 |
217 // Set up the chrome://theme/ source. | 212 // Set up the chrome://theme/ source. |
218 WebUIThemeSource* theme = new WebUIThemeSource(GetProfile()); | 213 WebUIThemeSource* theme = new WebUIThemeSource(contents->profile()); |
219 BrowserThread::PostTask( | 214 contents->profile()->GetChromeURLDataManager()->AddDataSource(theme); |
220 BrowserThread::IO, FROM_HERE, | |
221 NewRunnableMethod( | |
222 ChromeURLDataManager::GetInstance(), | |
223 &ChromeURLDataManager::AddDataSource, | |
224 make_scoped_refptr(theme))); | |
225 | 215 |
226 // Initialize the chrome://about/ source in case the user clicks the credits | 216 // Initialize the chrome://about/ source in case the user clicks the credits |
227 // link. | 217 // link. |
228 InitializeAboutDataSource(); | 218 InitializeAboutDataSource(contents->profile()); |
229 } | 219 } |
230 | 220 |
231 OptionsUI::~OptionsUI() { | 221 OptionsUI::~OptionsUI() { |
232 // Uninitialize all registered handlers. The base class owns them and it will | 222 // Uninitialize all registered handlers. The base class owns them and it will |
233 // eventually delete them. Skip over the generic handler. | 223 // eventually delete them. Skip over the generic handler. |
234 for (std::vector<WebUIMessageHandler*>::iterator iter = handlers_.begin() + 1; | 224 for (std::vector<WebUIMessageHandler*>::iterator iter = handlers_.begin() + 1; |
235 iter != handlers_.end(); | 225 iter != handlers_.end(); |
236 ++iter) { | 226 ++iter) { |
237 static_cast<OptionsPageUIHandler*>(*iter)->Uninitialize(); | 227 static_cast<OptionsPageUIHandler*>(*iter)->Uninitialize(); |
238 } | 228 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 OptionsPageUIHandler* handler_raw) { | 283 OptionsPageUIHandler* handler_raw) { |
294 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); | 284 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); |
295 DCHECK(handler.get()); | 285 DCHECK(handler.get()); |
296 // Add only if handler's service is enabled. | 286 // Add only if handler's service is enabled. |
297 if (handler->IsEnabled()) { | 287 if (handler->IsEnabled()) { |
298 handler->GetLocalizedValues(localized_strings); | 288 handler->GetLocalizedValues(localized_strings); |
299 // Add handler to the list and also pass the ownership. | 289 // Add handler to the list and also pass the ownership. |
300 AddMessageHandler(handler.release()->Attach(this)); | 290 AddMessageHandler(handler.release()->Attach(this)); |
301 } | 291 } |
302 } | 292 } |
OLD | NEW |