| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 DOMUI::RenderViewCreated(render_view_host); | 233 DOMUI::RenderViewCreated(render_view_host); |
| 234 } | 234 } |
| 235 | 235 |
| 236 // static | 236 // static |
| 237 RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { | 237 RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { |
| 238 return ResourceBundle::GetSharedInstance(). | 238 return ResourceBundle::GetSharedInstance(). |
| 239 LoadDataResourceBytes(IDR_SETTINGS_FAVICON); | 239 LoadDataResourceBytes(IDR_SETTINGS_FAVICON); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void OptionsUI::InitializeHandlers() { | 242 void OptionsUI::InitializeHandlers() { |
| 243 DCHECK(!GetProfile()->IsOffTheRecord()); |
| 244 |
| 243 std::vector<DOMMessageHandler*>::iterator iter; | 245 std::vector<DOMMessageHandler*>::iterator iter; |
| 244 for (iter = handlers_.begin(); iter != handlers_.end(); ++iter) { | 246 for (iter = handlers_.begin(); iter != handlers_.end(); ++iter) { |
| 245 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); | 247 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); |
| 246 } | 248 } |
| 247 } | 249 } |
| 248 | 250 |
| 249 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 251 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
| 250 OptionsPageUIHandler* handler_raw) { | 252 OptionsPageUIHandler* handler_raw) { |
| 251 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); | 253 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); |
| 252 DCHECK(handler.get()); | 254 DCHECK(handler.get()); |
| 253 // Add only if handler's service is enabled. | 255 // Add only if handler's service is enabled. |
| 254 if (handler->IsEnabled()) { | 256 if (handler->IsEnabled()) { |
| 255 handler->GetLocalizedValues(localized_strings); | 257 handler->GetLocalizedValues(localized_strings); |
| 256 // Add handler to the list and also pass the ownership. | 258 // Add handler to the list and also pass the ownership. |
| 257 AddMessageHandler(handler.release()->Attach(this)); | 259 AddMessageHandler(handler.release()->Attach(this)); |
| 258 } | 260 } |
| 259 } | 261 } |
| OLD | NEW |