Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/options2/options_ui2.h" | 5 #include "chrome/browser/ui/webui/options2/options_ui2.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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 304 } | 304 } |
| 305 | 305 |
| 306 void OptionsUI::InitializeHandlers() { | 306 void OptionsUI::InitializeHandlers() { |
| 307 Profile* profile = Profile::FromWebUI(web_ui()); | 307 Profile* profile = Profile::FromWebUI(web_ui()); |
| 308 DCHECK(!profile->IsOffTheRecord() || Profile::IsGuestSession()); | 308 DCHECK(!profile->IsOffTheRecord() || Profile::IsGuestSession()); |
| 309 | 309 |
| 310 // The reinitialize call from DidBecomeActiveForReusedRenderView end up being | 310 // The reinitialize call from DidBecomeActiveForReusedRenderView end up being |
| 311 // delivered after a new web page DOM has been brought up in an existing | 311 // delivered after a new web page DOM has been brought up in an existing |
| 312 // renderer (due to IPC delays), causing this method to be called twice. If | 312 // renderer (due to IPC delays), causing this method to be called twice. If |
| 313 // that happens, ignore the second call. | 313 // that happens, ignore the second call. |
| 314 if (initialized_handlers_) | 314 if (!initialized_handlers_) { |
| 315 return; | 315 for (size_t i = 0; i < handlers_.size(); ++i) |
| 316 handlers_[i]->Initialize(); | |
| 317 } | |
| 318 | |
| 316 initialized_handlers_ = true; | 319 initialized_handlers_ = true; |
|
csilv
2012/03/13 20:59:49
Move this line into the 'if' block.
Dan Beam
2012/03/13 23:01:45
Done.
| |
| 317 | 320 |
| 318 for (size_t i = 0; i < handlers_.size(); ++i) | 321 for (size_t i = 0; i < handlers_.size(); ++i) |
| 319 handlers_[i]->Initialize(); | 322 handlers_[i]->SendPageValues(); |
| 320 } | 323 } |
| 321 | 324 |
| 322 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 325 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
| 323 OptionsPageUIHandler* handler_raw) { | 326 OptionsPageUIHandler* handler_raw) { |
| 324 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); | 327 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); |
| 325 DCHECK(handler.get()); | 328 DCHECK(handler.get()); |
| 326 // Add only if handler's service is enabled. | 329 // Add only if handler's service is enabled. |
| 327 if (handler->IsEnabled()) { | 330 if (handler->IsEnabled()) { |
| 328 // Add handler to the list and also pass the ownership. | 331 // Add handler to the list and also pass the ownership. |
| 329 web_ui()->AddMessageHandler(handler.release()); | 332 web_ui()->AddMessageHandler(handler.release()); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 340 WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString()); | 343 WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString()); |
| 341 #else | 344 #else |
| 342 command_line_string = | 345 command_line_string = |
| 343 CommandLine::ForCurrentProcess()->GetCommandLineString(); | 346 CommandLine::ForCurrentProcess()->GetCommandLineString(); |
| 344 #endif | 347 #endif |
| 345 | 348 |
| 346 render_view_host->SetWebUIProperty("commandLineString", command_line_string); | 349 render_view_host->SetWebUIProperty("commandLineString", command_line_string); |
| 347 } | 350 } |
| 348 | 351 |
| 349 } // namespace options2 | 352 } // namespace options2 |
| OLD | NEW |