Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4352)

Unified Diff: chrome/browser/chromeos/bluetooth/bluetooth_pairing_dialog.cc

Issue 2684793004: [Harmony] Harmonize Bluetooth dialogs. (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/bluetooth/bluetooth_pairing_dialog.cc
diff --git a/chrome/browser/chromeos/bluetooth/bluetooth_pairing_dialog.cc b/chrome/browser/chromeos/bluetooth/bluetooth_pairing_dialog.cc
index 8de70c711a81f34f078bfccabb80fc9cfa42d2aa..a7f5b6645aa87831272ac852262308e26fdd487c 100644
--- a/chrome/browser/chromeos/bluetooth/bluetooth_pairing_dialog.cc
+++ b/chrome/browser/chromeos/bluetooth/bluetooth_pairing_dialog.cc
@@ -7,14 +7,21 @@
#include <string>
#include "ash/public/cpp/shell_window_ids.h"
+#include "ash/shell.h"
#include "base/json/json_writer.h"
+#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "device/bluetooth/bluetooth_device.h"
+#include "services/ui/public/cpp/property_type_converters.h"
+#include "services/ui/public/interfaces/window_manager.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/geometry/size.h"
+#include "ui/views/controls/webview/web_dialog_view.h"
+#include "ui/views/widget/widget.h"
using content::WebContents;
using content::WebUIMessageHandler;
@@ -44,15 +51,32 @@ BluetoothPairingDialog::BluetoothPairingDialog(
BluetoothPairingDialog::~BluetoothPairingDialog() {
}
-void BluetoothPairingDialog::ShowInContainer(int container_id) {
+void BluetoothPairingDialog::ShowInContainer(int container_id,
+ views::WebDialogView* view) {
// Dialog must be in a modal window container.
DCHECK(container_id == ash::kShellWindowId_SystemModalContainer ||
container_id == ash::kShellWindowId_LockSystemModalContainer);
- // Bluetooth settings are currently stored on the device, accessible for
- // everyone who uses the machine. As such we can use the active user profile.
- chrome::ShowWebDialogInContainer(
- container_id, ProfileManager::GetActiveUserProfile(), this);
+ views::Widget* widget = new views::Widget;
James Cook 2017/02/09 15:18:02 This block of code looks mostly copied from System
xdai1 2017/02/09 22:58:28 I don't think they're same. Actually this block of
+ views::Widget::InitParams params(
+ views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
+ params.delegate = view;
+ if (chrome::IsRunningInMash()) {
+ using ui::mojom::WindowManager;
+ params.mus_properties[WindowManager::kContainerId_InitProperty] =
+ mojo::ConvertTo<std::vector<uint8_t>>(container_id);
+ } else {
+ params.parent = ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(),
+ container_id);
+ }
+ widget->Init(params);
+
+ // Observer is needed for ChromeVox extension to send messages between content
+ // and background scripts.
+ extensions::ChromeExtensionWebContentsObserver::CreateForWebContents(
+ view->web_contents());
+
+ widget->Show();
}
///////////////////////////////////////////////////////////////////////////////
@@ -101,7 +125,7 @@ void BluetoothPairingDialog::OnCloseContents(WebContents* source,
}
bool BluetoothPairingDialog::ShouldShowDialogTitle() const {
- return true;
+ return false;
}
bool BluetoothPairingDialog::HandleContextMenu(

Powered by Google App Engine
This is Rietveld 408576698