| 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 if (!initialized_handlers_) { | 366 if (!initialized_handlers_) { |
| 367 for (size_t i = 0; i < handlers_.size(); ++i) | 367 for (size_t i = 0; i < handlers_.size(); ++i) |
| 368 handlers_[i]->InitializeHandler(); | 368 handlers_[i]->InitializeHandler(); |
| 369 initialized_handlers_ = true; | 369 initialized_handlers_ = true; |
| 370 | 370 |
| 371 #if defined(OS_CHROMEOS) | 371 #if defined(OS_CHROMEOS) |
| 372 pointer_device_observer_->Init(); | 372 pointer_device_observer_->Init(); |
| 373 #endif | 373 #endif |
| 374 } | 374 } |
| 375 | 375 |
| 376 #if defined(OS_CHROMEOS) |
| 377 pointer_device_observer_->CheckDevices(); |
| 378 #endif |
| 379 |
| 376 // Always initialize the page as when handlers are left over we still need to | 380 // Always initialize the page as when handlers are left over we still need to |
| 377 // do various things like show/hide sections and send data to the Javascript. | 381 // do various things like show/hide sections and send data to the Javascript. |
| 378 for (size_t i = 0; i < handlers_.size(); ++i) | 382 for (size_t i = 0; i < handlers_.size(); ++i) |
| 379 handlers_[i]->InitializePage(); | 383 handlers_[i]->InitializePage(); |
| 380 } | 384 } |
| 381 | 385 |
| 382 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 386 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
| 383 OptionsPageUIHandler* handler_raw) { | 387 OptionsPageUIHandler* handler_raw) { |
| 384 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); | 388 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); |
| 385 DCHECK(handler.get()); | 389 DCHECK(handler.get()); |
| 386 // Add only if handler's service is enabled. | 390 // Add only if handler's service is enabled. |
| 387 if (handler->IsEnabled()) { | 391 if (handler->IsEnabled()) { |
| 388 // Add handler to the list and also pass the ownership. | 392 // Add handler to the list and also pass the ownership. |
| 389 web_ui()->AddMessageHandler(handler.release()); | 393 web_ui()->AddMessageHandler(handler.release()); |
| 390 handler_raw->GetLocalizedValues(localized_strings); | 394 handler_raw->GetLocalizedValues(localized_strings); |
| 391 handlers_.push_back(handler_raw); | 395 handlers_.push_back(handler_raw); |
| 392 } | 396 } |
| 393 } | 397 } |
| 394 | 398 |
| 395 } // namespace options2 | 399 } // namespace options2 |
| OLD | NEW |