Index: chrome/browser/chromeos/enrollment_dialog_view.cc |
diff --git a/chrome/browser/chromeos/enrollment_dialog_view.cc b/chrome/browser/chromeos/enrollment_dialog_view.cc |
index f63fbeea838313d459518c5742900609ddbab644..b6f92c8bff848ee287da50347a590f2b096a54f6 100644 |
--- a/chrome/browser/chromeos/enrollment_dialog_view.cc |
+++ b/chrome/browser/chromeos/enrollment_dialog_view.cc |
@@ -4,12 +4,16 @@ |
#include "chrome/browser/chromeos/enrollment_dialog_view.h" |
+#include "ash/shell.h" |
#include "base/bind.h" |
+#include "base/callback.h" |
#include "base/macros.h" |
#include "base/strings/utf_string_conversions.h" |
#include "chrome/browser/chromeos/profiles/profile_helper.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/profiles/profile_manager.h" |
+#include "chrome/browser/ui/ash/ash_util.h" |
+#include "chrome/browser/ui/ash/system_tray_client.h" |
#include "chrome/browser/ui/browser_finder.h" |
#include "chrome/browser/ui/browser_navigator.h" |
#include "chrome/browser/ui/browser_navigator_params.h" |
@@ -21,6 +25,8 @@ |
#include "chromeos/network/network_state_handler.h" |
#include "extensions/browser/extension_host.h" |
#include "extensions/common/constants.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/base/page_transition_types.h" |
#include "ui/views/controls/label.h" |
@@ -29,6 +35,8 @@ |
#include "ui/views/widget/widget.h" |
#include "ui/views/window/dialog_delegate.h" |
+using views::Widget; |
+ |
namespace chromeos { |
namespace { |
@@ -103,11 +111,28 @@ void EnrollmentDialogView::ShowDialog(gfx::NativeWindow owning_window, |
const base::Closure& connect) { |
EnrollmentDialogView* dialog_view = |
new EnrollmentDialogView(network_name, profile, target_uri, connect); |
- views::DialogDelegate::CreateDialogWidget(dialog_view, NULL, owning_window); |
+ if (owning_window) { |
+ views::DialogDelegate::CreateDialogWidget(dialog_view, nullptr, |
+ owning_window); |
+ } else { |
+ // Place the dialog in the appropriate modal dialog container, either above |
+ // or below the lock screen, based on the login state. |
+ Widget::InitParams params = DialogDelegate::GetDialogWidgetInitParams( |
+ dialog_view, nullptr, nullptr, gfx::Rect()); |
+ int container_id = SystemTrayClient::GetDialogParentContainerId(); |
James Cook
2016/10/27 18:20:37
As I noted in the last CL: I would like to move Ge
stevenjb
2016/10/27 18:45:13
The added dependencies are somewhat unfortunate.
James Cook
2016/10/27 22:28:27
Done. In a follow-up CL I'll migrate NetworkConfig
|
+ 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; |
+ widget->Init(params); |
+ } |
dialog_view->InitDialog(); |
- views::Widget* widget = dialog_view->GetWidget(); |
- DCHECK(widget); |
- widget->Show(); |
+ dialog_view->GetWidget()->Show(); |
} |
bool EnrollmentDialogView::Accept() { |