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/options/options_ui.h" | 5 #include "chrome/browser/ui/webui/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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 329 |
330 // The reinitialize call from DidBecomeActiveForReusedRenderView end up being | 330 // The reinitialize call from DidBecomeActiveForReusedRenderView end up being |
331 // delivered after a new web page DOM has been brought up in an existing | 331 // delivered after a new web page DOM has been brought up in an existing |
332 // renderer (due to IPC delays), causing this method to be called twice. If | 332 // renderer (due to IPC delays), causing this method to be called twice. If |
333 // that happens, ignore the second call. | 333 // that happens, ignore the second call. |
334 if (initialized_handlers_) | 334 if (initialized_handlers_) |
335 return; | 335 return; |
336 initialized_handlers_ = true; | 336 initialized_handlers_ = true; |
337 | 337 |
338 for (size_t i = 0; i < handlers_.size(); ++i) | 338 for (size_t i = 0; i < handlers_.size(); ++i) |
339 handlers_[i]->Initialize(); | 339 handlers_[i]->InitializeHandler(); |
340 } | 340 } |
341 | 341 |
342 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 342 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
343 OptionsPageUIHandler* handler_raw) { | 343 OptionsPageUIHandler* handler_raw) { |
344 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); | 344 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); |
345 DCHECK(handler.get()); | 345 DCHECK(handler.get()); |
346 // Add only if handler's service is enabled. | 346 // Add only if handler's service is enabled. |
347 if (handler->IsEnabled()) { | 347 if (handler->IsEnabled()) { |
348 handler->GetLocalizedValues(localized_strings); | 348 handler->GetLocalizedValues(localized_strings); |
349 // Add handler to the list and also pass the ownership. | 349 // Add handler to the list and also pass the ownership. |
350 web_ui()->AddMessageHandler(handler.release()); | 350 web_ui()->AddMessageHandler(handler.release()); |
351 handlers_.push_back(handler_raw); | 351 handlers_.push_back(handler_raw); |
352 } | 352 } |
353 } | 353 } |
354 | 354 |
355 void OptionsUI::SetCommandLineString(RenderViewHost* render_view_host) { | 355 void OptionsUI::SetCommandLineString(RenderViewHost* render_view_host) { |
356 std::string command_line_string; | 356 std::string command_line_string; |
357 | 357 |
358 #if defined(OS_WIN) | 358 #if defined(OS_WIN) |
359 command_line_string = | 359 command_line_string = |
360 WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString()); | 360 WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString()); |
361 #else | 361 #else |
362 command_line_string = | 362 command_line_string = |
363 CommandLine::ForCurrentProcess()->GetCommandLineString(); | 363 CommandLine::ForCurrentProcess()->GetCommandLineString(); |
364 #endif | 364 #endif |
365 | 365 |
366 render_view_host->SetWebUIProperty("commandLineString", command_line_string); | 366 render_view_host->SetWebUIProperty("commandLineString", command_line_string); |
367 } | 367 } |
OLD | NEW |