| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/kiosk_external_update_notification.h" | 5 #include "chrome/browser/chromeos/ui/kiosk_external_update_notification.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 const base::string16& message) { | 114 const base::string16& message) { |
| 115 if (view_) | 115 if (view_) |
| 116 view_->SetMessage(message); | 116 view_->SetMessage(message); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void KioskExternalUpdateNotification::CreateAndShowNotificationView( | 119 void KioskExternalUpdateNotification::CreateAndShowNotificationView( |
| 120 const base::string16& message) { | 120 const base::string16& message) { |
| 121 view_ = new KioskExternalUpdateNotificationView(this); | 121 view_ = new KioskExternalUpdateNotificationView(this); |
| 122 view_->SetMessage(message); | 122 view_->SetMessage(message); |
| 123 | 123 |
| 124 aura::Window* root_window = ash::Shell::GetTargetRootWindow(); | 124 aura::Window* root_window = ash::Shell::GetRootWindowForNewWindows(); |
| 125 gfx::Size rs = root_window->bounds().size(); | 125 gfx::Size rs = root_window->bounds().size(); |
| 126 gfx::Size ps = view_->GetPreferredSize(); | 126 gfx::Size ps = view_->GetPreferredSize(); |
| 127 gfx::Rect bounds((rs.width() - ps.width()) / 2, | 127 gfx::Rect bounds((rs.width() - ps.width()) / 2, |
| 128 (rs.height() - ps.height()) / 10, | 128 (rs.height() - ps.height()) / 10, |
| 129 ps.width(), | 129 ps.width(), |
| 130 ps.height()); | 130 ps.height()); |
| 131 views::Widget::InitParams params; | 131 views::Widget::InitParams params; |
| 132 params.type = views::Widget::InitParams::TYPE_POPUP; | 132 params.type = views::Widget::InitParams::TYPE_POPUP; |
| 133 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 133 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 134 params.ownership = views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET; | 134 params.ownership = views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 148 | 148 |
| 149 void KioskExternalUpdateNotification::Dismiss() { | 149 void KioskExternalUpdateNotification::Dismiss() { |
| 150 if (view_) { | 150 if (view_) { |
| 151 KioskExternalUpdateNotificationView* view = view_; | 151 KioskExternalUpdateNotificationView* view = view_; |
| 152 view_ = NULL; | 152 view_ = NULL; |
| 153 view->CloseByOwner(); | 153 view->CloseByOwner(); |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace chromeos | 157 } // namespace chromeos |
| OLD | NEW |