| 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/options/options_ui.h" | 5 #include "chrome/browser/dom_ui/options/options_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 #endif | 185 #endif |
| 186 | 186 |
| 187 // |localized_strings| ownership is taken over by this constructor. | 187 // |localized_strings| ownership is taken over by this constructor. |
| 188 OptionsUIHTMLSource* html_source = | 188 OptionsUIHTMLSource* html_source = |
| 189 new OptionsUIHTMLSource(localized_strings); | 189 new OptionsUIHTMLSource(localized_strings); |
| 190 | 190 |
| 191 // Set up the chrome://settings/ source. | 191 // Set up the chrome://settings/ source. |
| 192 BrowserThread::PostTask( | 192 BrowserThread::PostTask( |
| 193 BrowserThread::IO, FROM_HERE, | 193 BrowserThread::IO, FROM_HERE, |
| 194 NewRunnableMethod( | 194 NewRunnableMethod( |
| 195 Singleton<ChromeURLDataManager>::get(), | 195 ChromeURLDataManager::GetInstance(), |
| 196 &ChromeURLDataManager::AddDataSource, | 196 &ChromeURLDataManager::AddDataSource, |
| 197 make_scoped_refptr(html_source))); | 197 make_scoped_refptr(html_source))); |
| 198 | 198 |
| 199 // Set up chrome://theme/ source. | 199 // Set up chrome://theme/ source. |
| 200 DOMUIThemeSource* theme = new DOMUIThemeSource(GetProfile()); | 200 DOMUIThemeSource* theme = new DOMUIThemeSource(GetProfile()); |
| 201 BrowserThread::PostTask( | 201 BrowserThread::PostTask( |
| 202 BrowserThread::IO, FROM_HERE, | 202 BrowserThread::IO, FROM_HERE, |
| 203 NewRunnableMethod( | 203 NewRunnableMethod( |
| 204 Singleton<ChromeURLDataManager>::get(), | 204 ChromeURLDataManager::GetInstance(), |
| 205 &ChromeURLDataManager::AddDataSource, | 205 &ChromeURLDataManager::AddDataSource, |
| 206 make_scoped_refptr(theme))); | 206 make_scoped_refptr(theme))); |
| 207 } | 207 } |
| 208 | 208 |
| 209 OptionsUI::~OptionsUI() { | 209 OptionsUI::~OptionsUI() { |
| 210 // Uninitialize all registered handlers. The base class owns them and it will | 210 // Uninitialize all registered handlers. The base class owns them and it will |
| 211 // eventually delete them. | 211 // eventually delete them. |
| 212 for (std::vector<DOMMessageHandler*>::iterator iter = handlers_.begin(); | 212 for (std::vector<DOMMessageHandler*>::iterator iter = handlers_.begin(); |
| 213 iter != handlers_.end(); | 213 iter != handlers_.end(); |
| 214 ++iter) { | 214 ++iter) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 OptionsPageUIHandler* handler_raw) { | 262 OptionsPageUIHandler* handler_raw) { |
| 263 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); | 263 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); |
| 264 DCHECK(handler.get()); | 264 DCHECK(handler.get()); |
| 265 // Add only if handler's service is enabled. | 265 // Add only if handler's service is enabled. |
| 266 if (handler->IsEnabled()) { | 266 if (handler->IsEnabled()) { |
| 267 handler->GetLocalizedValues(localized_strings); | 267 handler->GetLocalizedValues(localized_strings); |
| 268 // Add handler to the list and also pass the ownership. | 268 // Add handler to the list and also pass the ownership. |
| 269 AddMessageHandler(handler.release()->Attach(this)); | 269 AddMessageHandler(handler.release()->Attach(this)); |
| 270 } | 270 } |
| 271 } | 271 } |
| OLD | NEW |