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