Commit 36fade6a authored by James Cook's avatar James Cook Committed by Commit Bot

cros: Always show kiosk usb update notification on primary display

This eliminates a call into ash::Shell::GetRootWindowForNewWindows,
which we need to do for out-of-process ash (go/mustash).

The existing code looks like it was just copied from another place
that shows a similar notification. Regardless, the primary display
should be fine.

Bug: 372857, 826569
Test: browser_tests KioskUpdateTest.*
Change-Id: Iebe8a3a614bdb346fc30f8baab8b77e24ad466c2
Reviewed-on: https://chromium-review.googlesource.com/1029115Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553821}
parent f5243dcd
......@@ -5,12 +5,14 @@
#include "chrome/browser/chromeos/ui/kiosk_external_update_notification.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h"
#include "base/macros.h"
#include "chrome/browser/ui/ash/ash_util.h"
#include "ui/aura/window.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/gfx/canvas.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/fill_layout.h"
......@@ -120,13 +122,12 @@ void KioskExternalUpdateNotification::CreateAndShowNotificationView(
view_ = new KioskExternalUpdateNotificationView(this);
view_->SetMessage(message);
aura::Window* root_window = ash::Shell::GetRootWindowForNewWindows();
gfx::Size rs = root_window->bounds().size();
gfx::Size ps = view_->GetPreferredSize();
gfx::Rect bounds((rs.width() - ps.width()) / 2,
(rs.height() - ps.height()) / 10,
ps.width(),
ps.height());
gfx::Size display_size =
display::Screen::GetScreen()->GetPrimaryDisplay().size();
gfx::Size view_size = view_->GetPreferredSize();
gfx::Rect bounds((display_size.width() - view_size.width()) / 2,
(display_size.height() - view_size.height()) / 10,
view_size.width(), view_size.height());
views::Widget::InitParams params;
params.type = views::Widget::InitParams::TYPE_POPUP;
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
......@@ -136,8 +137,9 @@ void KioskExternalUpdateNotification::CreateAndShowNotificationView(
params.remove_standard_frame = true;
params.delegate = view_;
params.bounds = bounds;
params.parent = ash::Shell::GetContainer(
root_window, ash::kShellWindowId_SettingBubbleContainer);
// The notification is shown on the primary display.
ash_util::SetupWidgetInitParamsForContainer(
&params, ash::kShellWindowId_SettingBubbleContainer);
views::Widget* widget = new views::Widget;
widget->Init(params);
gfx::NativeView native_view = widget->GetNativeView();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment