| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 DOMUI::DidBecomeActiveForReusedRenderView(); | 248 DOMUI::DidBecomeActiveForReusedRenderView(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 // static | 251 // static |
| 252 RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { | 252 RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { |
| 253 return ResourceBundle::GetSharedInstance(). | 253 return ResourceBundle::GetSharedInstance(). |
| 254 LoadDataResourceBytes(IDR_SETTINGS_FAVICON); | 254 LoadDataResourceBytes(IDR_SETTINGS_FAVICON); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void OptionsUI::InitializeHandlers() { | 257 void OptionsUI::InitializeHandlers() { |
| 258 DCHECK(!GetProfile()->IsOffTheRecord()); | 258 DCHECK(!GetProfile()->IsOffTheRecord() || Profile::IsGuestSession()); |
| 259 | 259 |
| 260 // The reinitialize call from DidBecomeActiveForReusedRenderView end up being | 260 // The reinitialize call from DidBecomeActiveForReusedRenderView end up being |
| 261 // delivered after a new web page DOM has been brought up in an existing | 261 // delivered after a new web page DOM has been brought up in an existing |
| 262 // renderer (due to IPC delays), causing this method to be called twice. If | 262 // renderer (due to IPC delays), causing this method to be called twice. If |
| 263 // that happens, ignore the second call. | 263 // that happens, ignore the second call. |
| 264 if (initialized_handlers_) | 264 if (initialized_handlers_) |
| 265 return; | 265 return; |
| 266 initialized_handlers_ = true; | 266 initialized_handlers_ = true; |
| 267 | 267 |
| 268 std::vector<DOMMessageHandler*>::iterator iter; | 268 std::vector<DOMMessageHandler*>::iterator iter; |
| 269 // Skip over the generic handler. | 269 // Skip over the generic handler. |
| 270 for (iter = handlers_.begin() + 1; iter != handlers_.end(); ++iter) { | 270 for (iter = handlers_.begin() + 1; iter != handlers_.end(); ++iter) { |
| 271 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); | 271 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 | 274 |
| 275 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 275 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
| 276 OptionsPageUIHandler* handler_raw) { | 276 OptionsPageUIHandler* handler_raw) { |
| 277 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); | 277 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); |
| 278 DCHECK(handler.get()); | 278 DCHECK(handler.get()); |
| 279 // Add only if handler's service is enabled. | 279 // Add only if handler's service is enabled. |
| 280 if (handler->IsEnabled()) { | 280 if (handler->IsEnabled()) { |
| 281 handler->GetLocalizedValues(localized_strings); | 281 handler->GetLocalizedValues(localized_strings); |
| 282 // Add handler to the list and also pass the ownership. | 282 // Add handler to the list and also pass the ownership. |
| 283 AddMessageHandler(handler.release()->Attach(this)); | 283 AddMessageHandler(handler.release()->Attach(this)); |
| 284 } | 284 } |
| 285 } | 285 } |
| OLD | NEW |