| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/accelerators/exit_warning_handler.h" | 5 #include "ash/accelerators/exit_warning_handler.h" |
| 6 | 6 |
| 7 #include "ash/metrics/user_metrics_recorder.h" | 7 #include "ash/metrics/user_metrics_recorder.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 gfx::Size rs = root_window->bounds().size(); | 180 gfx::Size rs = root_window->bounds().size(); |
| 181 gfx::Size ps = delegate->GetPreferredSize(); | 181 gfx::Size ps = delegate->GetPreferredSize(); |
| 182 gfx::Rect bounds((rs.width() - ps.width()) / 2, | 182 gfx::Rect bounds((rs.width() - ps.width()) / 2, |
| 183 (rs.height() - ps.height()) / 3, | 183 (rs.height() - ps.height()) / 3, |
| 184 ps.width(), ps.height()); | 184 ps.width(), ps.height()); |
| 185 views::Widget::InitParams params; | 185 views::Widget::InitParams params; |
| 186 params.type = views::Widget::InitParams::TYPE_POPUP; | 186 params.type = views::Widget::InitParams::TYPE_POPUP; |
| 187 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 187 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 188 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 188 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 189 params.accept_events = false; | 189 params.accept_events = false; |
| 190 params.can_activate = false; |
| 190 params.keep_on_top = true; | 191 params.keep_on_top = true; |
| 191 params.remove_standard_frame = true; | 192 params.remove_standard_frame = true; |
| 192 params.delegate = delegate; | 193 params.delegate = delegate; |
| 193 params.bounds = bounds; | 194 params.bounds = bounds; |
| 194 params.parent = | 195 params.parent = |
| 195 Shell::GetContainer(root_window, kShellWindowId_SettingBubbleContainer); | 196 Shell::GetContainer(root_window, kShellWindowId_SettingBubbleContainer); |
| 196 widget_.reset(new views::Widget); | 197 widget_.reset(new views::Widget); |
| 197 widget_->Init(params); | 198 widget_->Init(params); |
| 198 widget_->SetContentsView(delegate); | 199 widget_->SetContentsView(delegate); |
| 199 widget_->GetNativeView()->SetName("ExitWarningWindow"); | 200 widget_->GetNativeView()->SetName("ExitWarningWindow"); |
| 200 widget_->Show(); | 201 widget_->Show(); |
| 201 | 202 |
| 202 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 203 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 203 } | 204 } |
| 204 | 205 |
| 205 void ExitWarningHandler::Hide() { | 206 void ExitWarningHandler::Hide() { |
| 206 widget_.reset(); | 207 widget_.reset(); |
| 207 } | 208 } |
| 208 | 209 |
| 209 } // namespace ash | 210 } // namespace ash |
| OLD | NEW |