OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromeos/bluetooth_pairing_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/bluetooth_pairing_ui.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.h" | 9 #include "chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.h" |
10 #include "chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler
.h" | 10 #include "chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler
.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 web_ui->AddMessageHandler(core_handler_); | 27 web_ui->AddMessageHandler(core_handler_); |
28 core_handler_->set_handlers_host(this); | 28 core_handler_->set_handlers_host(this); |
29 core_handler_->GetLocalizedValues(&localized_strings); | 29 core_handler_->GetLocalizedValues(&localized_strings); |
30 | 30 |
31 web_ui->AddMessageHandler(bluetooth_handler_); | 31 web_ui->AddMessageHandler(bluetooth_handler_); |
32 bluetooth_handler_->GetLocalizedValues(&localized_strings); | 32 bluetooth_handler_->GetLocalizedValues(&localized_strings); |
33 | 33 |
34 content::WebUIDataSource* source = | 34 content::WebUIDataSource* source = |
35 content::WebUIDataSource::Create(chrome::kChromeUIBluetoothPairingHost); | 35 content::WebUIDataSource::Create(chrome::kChromeUIBluetoothPairingHost); |
36 source->SetUseJsonJSFormatV2(); | |
37 source->AddLocalizedStrings(localized_strings); | 36 source->AddLocalizedStrings(localized_strings); |
38 source->SetJsonPath("strings.js"); | 37 source->SetJsonPath("strings.js"); |
39 source->SetDefaultResource(IDR_BLUETOOTH_PAIR_DEVICE_HTML); | 38 source->SetDefaultResource(IDR_BLUETOOTH_PAIR_DEVICE_HTML); |
40 source->DisableContentSecurityPolicy(); | 39 source->DisableContentSecurityPolicy(); |
41 | 40 |
42 Profile* profile = Profile::FromWebUI(web_ui); | 41 Profile* profile = Profile::FromWebUI(web_ui); |
43 content::WebUIDataSource::Add(profile, source); | 42 content::WebUIDataSource::Add(profile, source); |
44 } | 43 } |
45 | 44 |
46 BluetoothPairingUI::~BluetoothPairingUI() { | 45 BluetoothPairingUI::~BluetoothPairingUI() { |
47 // Uninitialize all registered handlers. The base class owns them and it will | 46 // Uninitialize all registered handlers. The base class owns them and it will |
48 // eventually delete them. | 47 // eventually delete them. |
49 core_handler_->Uninitialize(); | 48 core_handler_->Uninitialize(); |
50 bluetooth_handler_->Uninitialize(); | 49 bluetooth_handler_->Uninitialize(); |
51 } | 50 } |
52 | 51 |
53 void BluetoothPairingUI::InitializeHandlers() { | 52 void BluetoothPairingUI::InitializeHandlers() { |
54 core_handler_->InitializeHandler(); | 53 core_handler_->InitializeHandler(); |
55 bluetooth_handler_->InitializeHandler(); | 54 bluetooth_handler_->InitializeHandler(); |
56 core_handler_->InitializePage(); | 55 core_handler_->InitializePage(); |
57 bluetooth_handler_->InitializePage(); | 56 bluetooth_handler_->InitializePage(); |
58 } | 57 } |
59 | 58 |
60 } // namespace chromeos | 59 } // namespace chromeos |
OLD | NEW |