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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 | 465 |
466 #if defined(OS_CHROMEOS) | 466 #if defined(OS_CHROMEOS) |
467 pointer_device_observer_->CheckDevices(); | 467 pointer_device_observer_->CheckDevices(); |
468 #endif | 468 #endif |
469 | 469 |
470 // Always initialize the page as when handlers are left over we still need to | 470 // Always initialize the page as when handlers are left over we still need to |
471 // do various things like show/hide sections and send data to the Javascript. | 471 // do various things like show/hide sections and send data to the Javascript. |
472 for (size_t i = 0; i < handlers_.size(); ++i) | 472 for (size_t i = 0; i < handlers_.size(); ++i) |
473 handlers_[i]->InitializePage(); | 473 handlers_[i]->InitializePage(); |
474 | 474 |
475 web_ui()->CallJavascriptFunction( | 475 web_ui()->CallJavascriptFunctionUnsafe( |
476 "BrowserOptions.notifyInitializationComplete"); | 476 "BrowserOptions.notifyInitializationComplete"); |
477 } | 477 } |
478 | 478 |
479 void OptionsUI::OnFinishedLoading() { | 479 void OptionsUI::OnFinishedLoading() { |
480 on_finished_loading_callbacks_.Notify(); | 480 on_finished_loading_callbacks_.Notify(); |
481 } | 481 } |
482 | 482 |
483 void OptionsUI::AddOptionsPageUIHandler( | 483 void OptionsUI::AddOptionsPageUIHandler( |
484 base::DictionaryValue* localized_strings, | 484 base::DictionaryValue* localized_strings, |
485 OptionsPageUIHandler* handler_raw) { | 485 OptionsPageUIHandler* handler_raw) { |
486 std::unique_ptr<OptionsPageUIHandler> handler(handler_raw); | 486 std::unique_ptr<OptionsPageUIHandler> handler(handler_raw); |
487 DCHECK(handler.get()); | 487 DCHECK(handler.get()); |
488 // Add only if handler's service is enabled. | 488 // Add only if handler's service is enabled. |
489 if (handler->IsEnabled()) { | 489 if (handler->IsEnabled()) { |
490 // Add handler to the list and also pass the ownership. | 490 // Add handler to the list and also pass the ownership. |
491 web_ui()->AddMessageHandler(handler.release()); | 491 web_ui()->AddMessageHandler(handler.release()); |
492 handler_raw->GetLocalizedValues(localized_strings); | 492 handler_raw->GetLocalizedValues(localized_strings); |
493 handlers_.push_back(handler_raw); | 493 handlers_.push_back(handler_raw); |
494 } | 494 } |
495 } | 495 } |
496 | 496 |
497 } // namespace options | 497 } // namespace options |
OLD | NEW |