| 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/chromeos/bluetooth/bluetooth_pairing_dialog.h" | 5 #include "chrome/browser/chromeos/bluetooth/bluetooth_pairing_dialog.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
| 12 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 12 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
| 13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 14 #include "chrome/browser/ui/ash/ash_util.h" | 14 #include "chrome/browser/ui/ash/ash_util.h" |
| 15 #include "chrome/browser/ui/browser_dialogs.h" | 15 #include "chrome/browser/ui/browser_dialogs.h" |
| 16 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 16 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
| 17 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 19 #include "device/bluetooth/bluetooth_device.h" | |
| 20 #include "services/ui/public/cpp/property_type_converters.h" | 19 #include "services/ui/public/cpp/property_type_converters.h" |
| 21 #include "services/ui/public/interfaces/window_manager.mojom.h" | 20 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/gfx/geometry/size.h" | 22 #include "ui/gfx/geometry/size.h" |
| 24 #include "ui/views/controls/webview/web_dialog_view.h" | 23 #include "ui/views/controls/webview/web_dialog_view.h" |
| 25 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
| 26 | 25 |
| 27 using content::WebContents; | 26 using content::WebContents; |
| 28 using content::WebUIMessageHandler; | 27 using content::WebUIMessageHandler; |
| 29 | 28 |
| 30 namespace chromeos { | 29 namespace chromeos { |
| 31 | 30 |
| 32 namespace { | 31 namespace { |
| 33 | 32 |
| 34 // Default width/height ratio of screen size. | 33 // Default width/height ratio of screen size. |
| 35 const int kDefaultWidth = 480; | 34 const int kDefaultWidth = 480; |
| 36 const int kDefaultHeight = 280; | 35 const int kDefaultHeight = 280; |
| 37 | 36 |
| 38 } // namespace | 37 } // namespace |
| 39 | 38 |
| 40 /////////////////////////////////////////////////////////////////////////////// | 39 /////////////////////////////////////////////////////////////////////////////// |
| 41 // BluetoothPairingDialog, public: | 40 // BluetoothPairingDialog, public: |
| 42 | 41 |
| 43 BluetoothPairingDialog::BluetoothPairingDialog( | 42 BluetoothPairingDialog::BluetoothPairingDialog( |
| 44 const device::BluetoothDevice* device) | 43 const std::string& address, |
| 44 const base::string16& name_for_display, |
| 45 bool paired, |
| 46 bool connected) |
| 45 : webui_(nullptr) { | 47 : webui_(nullptr) { |
| 46 device_data_.SetString("address", device->GetAddress()); | 48 device_data_.SetString("address", address); |
| 47 device_data_.SetString("name", device->GetNameForDisplay()); | 49 device_data_.SetString("name", name_for_display); |
| 48 device_data_.SetBoolean("paired", device->IsPaired()); | 50 device_data_.SetBoolean("paired", paired); |
| 49 device_data_.SetBoolean("connected", device->IsConnected()); | 51 device_data_.SetBoolean("connected", connected); |
| 50 } | 52 } |
| 51 | 53 |
| 52 BluetoothPairingDialog::~BluetoothPairingDialog() { | 54 BluetoothPairingDialog::~BluetoothPairingDialog() { |
| 53 } | 55 } |
| 54 | 56 |
| 55 void BluetoothPairingDialog::ShowInContainer(int container_id) { | 57 void BluetoothPairingDialog::ShowInContainer(int container_id) { |
| 56 // Dialog must be in a modal window container. | 58 // Dialog must be in a modal window container. |
| 57 DCHECK(container_id == ash::kShellWindowId_SystemModalContainer || | 59 DCHECK(container_id == ash::kShellWindowId_SystemModalContainer || |
| 58 container_id == ash::kShellWindowId_LockSystemModalContainer); | 60 container_id == ash::kShellWindowId_LockSystemModalContainer); |
| 59 | 61 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 return false; | 135 return false; |
| 134 } | 136 } |
| 135 | 137 |
| 136 bool BluetoothPairingDialog::HandleContextMenu( | 138 bool BluetoothPairingDialog::HandleContextMenu( |
| 137 const content::ContextMenuParams& params) { | 139 const content::ContextMenuParams& params) { |
| 138 // Disable context menu. | 140 // Disable context menu. |
| 139 return true; | 141 return true; |
| 140 } | 142 } |
| 141 | 143 |
| 142 } // namespace chromeos | 144 } // namespace chromeos |
| OLD | NEW |