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

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

Issue 2886253002: mash: remove more shell/shelf WmWindow usage. (Closed)
Patch Set: Fix WmShelf::ForWindow. Created 3 years, 7 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
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/app_list/app_list_delegate_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/public/cpp/shell_window_ids.h" 7 #include "ash/public/cpp/shell_window_ids.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_delegate.h" 10 #include "ash/shell_delegate.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 &ExitWarningHandler::TimerAction); 137 &ExitWarningHandler::TimerAction);
138 } 138 }
139 139
140 void ExitWarningHandler::CancelTimer() { 140 void ExitWarningHandler::CancelTimer() {
141 timer_.Stop(); 141 timer_.Stop();
142 } 142 }
143 143
144 void ExitWarningHandler::Show() { 144 void ExitWarningHandler::Show() {
145 if (widget_) 145 if (widget_)
146 return; 146 return;
147 WmWindow* root_window = Shell::GetWmRootWindowForNewWindows(); 147 aura::Window* root_window = Shell::GetRootWindowForNewWindows();
148 ExitWarningWidgetDelegateView* delegate = new ExitWarningWidgetDelegateView; 148 ExitWarningWidgetDelegateView* delegate = new ExitWarningWidgetDelegateView;
149 gfx::Size rs = root_window->GetBounds().size(); 149 gfx::Size rs = root_window->bounds().size();
150 gfx::Size ps = delegate->GetPreferredSize(); 150 gfx::Size ps = delegate->GetPreferredSize();
151 gfx::Rect bounds((rs.width() - ps.width()) / 2, 151 gfx::Rect bounds((rs.width() - ps.width()) / 2,
152 (rs.height() - ps.height()) / 3, ps.width(), ps.height()); 152 (rs.height() - ps.height()) / 3, ps.width(), ps.height());
153 views::Widget::InitParams params; 153 views::Widget::InitParams params;
154 params.type = views::Widget::InitParams::TYPE_POPUP; 154 params.type = views::Widget::InitParams::TYPE_POPUP;
155 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 155 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
156 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 156 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
157 params.accept_events = false; 157 params.accept_events = false;
158 params.keep_on_top = true; 158 params.keep_on_top = true;
159 params.remove_standard_frame = true; 159 params.remove_standard_frame = true;
160 params.delegate = delegate; 160 params.delegate = delegate;
161 params.bounds = bounds; 161 params.bounds = bounds;
162 params.name = "ExitWarningWindow"; 162 params.name = "ExitWarningWindow";
163 widget_.reset(new views::Widget); 163 widget_.reset(new views::Widget);
164 root_window->GetRootWindowController()->ConfigureWidgetInitParamsForContainer( 164 GetRootWindowController(root_window)
165 widget_.get(), kShellWindowId_SettingBubbleContainer, &params); 165 ->ConfigureWidgetInitParamsForContainer(
166 widget_.get(), kShellWindowId_SettingBubbleContainer, &params);
166 widget_->Init(params); 167 widget_->Init(params);
167 widget_->Show(); 168 widget_->Show();
168 169
169 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 170 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
170 } 171 }
171 172
172 void ExitWarningHandler::Hide() { 173 void ExitWarningHandler::Hide() {
173 widget_.reset(); 174 widget_.reset();
174 } 175 }
175 176
176 } // namespace ash 177 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/app_list/app_list_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698