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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } | 371 } |
372 | 372 |
373 #if defined(OS_CHROMEOS) | 373 #if defined(OS_CHROMEOS) |
374 pointer_device_observer_->CheckDevices(); | 374 pointer_device_observer_->CheckDevices(); |
375 #endif | 375 #endif |
376 | 376 |
377 // Always initialize the page as when handlers are left over we still need to | 377 // Always initialize the page as when handlers are left over we still need to |
378 // do various things like show/hide sections and send data to the Javascript. | 378 // do various things like show/hide sections and send data to the Javascript. |
379 for (size_t i = 0; i < handlers_.size(); ++i) | 379 for (size_t i = 0; i < handlers_.size(); ++i) |
380 handlers_[i]->InitializePage(); | 380 handlers_[i]->InitializePage(); |
| 381 |
| 382 web_ui()->CallJavascriptFunction( |
| 383 "BrowserOptions.notifyInitializationComplete"); |
381 } | 384 } |
382 | 385 |
383 void OptionsUI::RenderViewCreated(content::RenderViewHost* render_view_host) { | 386 void OptionsUI::RenderViewCreated(content::RenderViewHost* render_view_host) { |
384 content::WebUIController::RenderViewCreated(render_view_host); | 387 content::WebUIController::RenderViewCreated(render_view_host); |
385 for (size_t i = 0; i < handlers_.size(); ++i) | 388 for (size_t i = 0; i < handlers_.size(); ++i) |
386 handlers_[i]->PageLoadStarted(); | 389 handlers_[i]->PageLoadStarted(); |
387 } | 390 } |
388 | 391 |
389 void OptionsUI::RenderViewReused(content::RenderViewHost* render_view_host) { | 392 void OptionsUI::RenderViewReused(content::RenderViewHost* render_view_host) { |
390 content::WebUIController::RenderViewReused(render_view_host); | 393 content::WebUIController::RenderViewReused(render_view_host); |
391 for (size_t i = 0; i < handlers_.size(); ++i) | 394 for (size_t i = 0; i < handlers_.size(); ++i) |
392 handlers_[i]->PageLoadStarted(); | 395 handlers_[i]->PageLoadStarted(); |
393 } | 396 } |
394 | 397 |
395 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 398 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
396 OptionsPageUIHandler* handler_raw) { | 399 OptionsPageUIHandler* handler_raw) { |
397 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); | 400 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); |
398 DCHECK(handler.get()); | 401 DCHECK(handler.get()); |
399 // Add only if handler's service is enabled. | 402 // Add only if handler's service is enabled. |
400 if (handler->IsEnabled()) { | 403 if (handler->IsEnabled()) { |
401 // Add handler to the list and also pass the ownership. | 404 // Add handler to the list and also pass the ownership. |
402 web_ui()->AddMessageHandler(handler.release()); | 405 web_ui()->AddMessageHandler(handler.release()); |
403 handler_raw->GetLocalizedValues(localized_strings); | 406 handler_raw->GetLocalizedValues(localized_strings); |
404 handlers_.push_back(handler_raw); | 407 handlers_.push_back(handler_raw); |
405 } | 408 } |
406 } | 409 } |
407 | 410 |
408 } // namespace options | 411 } // namespace options |
OLD | NEW |