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