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

Unified Diff: chrome/browser/ui/ash/system_tray_client.cc

Issue 2452283003: chromeos: Make network enrollment and SIM unlock dialogs work with mash (Closed)
Patch Set: rebase Created 4 years, 2 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
« no previous file with comments | « chrome/browser/ui/ash/system_tray_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/system_tray_client.cc
diff --git a/chrome/browser/ui/ash/system_tray_client.cc b/chrome/browser/ui/ash/system_tray_client.cc
index b25ea01f65132cc65a1603f102ff8c37b342638d..2b96e3e91aa219d5c8be437a6fe4ca0365e3c32a 100644
--- a/chrome/browser/ui/ash/system_tray_client.cc
+++ b/chrome/browser/ui/ash/system_tray_client.cc
@@ -8,6 +8,7 @@
#include "ash/common/session/session_state_delegate.h"
#include "ash/common/wm_shell.h"
#include "ash/public/cpp/shell_window_ids.h"
+#include "ash/shell.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/logging.h"
@@ -32,10 +33,15 @@
#include "content/public/common/service_manager_connection.h"
#include "net/base/escape.h"
#include "services/service_manager/public/cpp/connector.h"
+#include "services/ui/public/cpp/property_type_converters.h"
+#include "services/ui/public/interfaces/window_manager.mojom.h"
#include "third_party/cros_system_api/dbus/shill/dbus-constants.h"
+#include "ui/views/widget/widget.h"
+#include "ui/views/window/dialog_delegate.h"
using chromeos::DBusThreadManager;
using chromeos::LoginState;
+using views::Widget;
namespace {
@@ -129,6 +135,28 @@ int SystemTrayClient::GetDialogParentContainerId() {
return ash::kShellWindowId_SystemModalContainer;
}
+// static
+Widget* SystemTrayClient::CreateUnownedDialogWidget(
+ views::WidgetDelegate* widget_delegate) {
+ DCHECK(widget_delegate);
+ Widget::InitParams params = views::DialogDelegate::GetDialogWidgetInitParams(
+ widget_delegate, nullptr, nullptr, gfx::Rect());
+ // Place the dialog in the appropriate modal dialog container, either above
+ // or below the lock screen, based on the login state.
+ int container_id = GetDialogParentContainerId();
+ if (chrome::IsRunningInMash()) {
+ using ui::mojom::WindowManager;
+ params.mus_properties[WindowManager::kInitialContainerId_Property] =
+ mojo::ConvertTo<std::vector<uint8_t>>(container_id);
+ } else {
+ params.parent = ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(),
+ container_id);
+ }
+ Widget* widget = new Widget; // Owned by native widget.
+ widget->Init(params);
+ return widget;
+}
+
////////////////////////////////////////////////////////////////////////////////
// ash::mojom::SystemTrayClient:
« no previous file with comments | « chrome/browser/ui/ash/system_tray_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698