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

Side by Side Diff: ash/accelerators/exit_warning_handler.cc

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_delegate.h" 8 #include "ash/shell_delegate.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "grit/ash_strings.h" 13 #include "grit/ash_strings.h"
14 #include "ui/aura/root_window.h" 14 #include "ui/aura/window.h"
15 #include "ui/base/accessibility/accessible_view_state.h" 15 #include "ui/base/accessibility/accessible_view_state.h"
16 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
18 #include "ui/gfx/canvas.h" 18 #include "ui/gfx/canvas.h"
19 #include "ui/gfx/font.h" 19 #include "ui/gfx/font.h"
20 #include "ui/views/controls/label.h" 20 #include "ui/views/controls/label.h"
21 #include "ui/views/layout/fill_layout.h" 21 #include "ui/views/layout/fill_layout.h"
22 #include "ui/views/view.h" 22 #include "ui/views/view.h"
23 #include "ui/views/widget/widget.h" 23 #include "ui/views/widget/widget.h"
24 #include "ui/views/widget/widget_delegate.h" 24 #include "ui/views/widget/widget_delegate.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 &ExitWarningHandler::TimerAction); 158 &ExitWarningHandler::TimerAction);
159 } 159 }
160 160
161 void ExitWarningHandler::CancelTimer() { 161 void ExitWarningHandler::CancelTimer() {
162 timer_.Stop(); 162 timer_.Stop();
163 } 163 }
164 164
165 void ExitWarningHandler::Show() { 165 void ExitWarningHandler::Show() {
166 if (widget_) 166 if (widget_)
167 return; 167 return;
168 aura::RootWindow* root_window = Shell::GetTargetRootWindow(); 168 aura::Window* root_window = Shell::GetTargetRootWindow();
169 ExitWarningWidgetDelegateView* delegate = new ExitWarningWidgetDelegateView; 169 ExitWarningWidgetDelegateView* delegate = new ExitWarningWidgetDelegateView;
170 gfx::Size rs = root_window->bounds().size(); 170 gfx::Size rs = root_window->bounds().size();
171 gfx::Size ps = delegate->GetPreferredSize(); 171 gfx::Size ps = delegate->GetPreferredSize();
172 gfx::Rect bounds((rs.width() - ps.width()) / 2, 172 gfx::Rect bounds((rs.width() - ps.width()) / 2,
173 (rs.height() - ps.height()) / 3, 173 (rs.height() - ps.height()) / 3,
174 ps.width(), ps.height()); 174 ps.width(), ps.height());
175 views::Widget::InitParams params; 175 views::Widget::InitParams params;
176 params.type = views::Widget::InitParams::TYPE_POPUP; 176 params.type = views::Widget::InitParams::TYPE_POPUP;
177 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 177 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
178 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 178 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
(...skipping 13 matching lines...) Expand all
192 widget_->Show(); 192 widget_->Show();
193 193
194 delegate->NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true); 194 delegate->NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true);
195 } 195 }
196 196
197 void ExitWarningHandler::Hide() { 197 void ExitWarningHandler::Hide() {
198 widget_.reset(); 198 widget_.reset();
199 } 199 }
200 200
201 } // namespace ash 201 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller_unittest.cc ('k') | ash/accelerators/nested_dispatcher_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698