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

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

Issue 286733002: [Refactor] Consolidate the logic for whether a widget can be activated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/display/shared_display_edge_indicator.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/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
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;
191 params.keep_on_top = true; 190 params.keep_on_top = true;
192 params.remove_standard_frame = true; 191 params.remove_standard_frame = true;
193 params.delegate = delegate; 192 params.delegate = delegate;
194 params.bounds = bounds; 193 params.bounds = bounds;
195 params.parent = 194 params.parent =
196 Shell::GetContainer(root_window, kShellWindowId_SettingBubbleContainer); 195 Shell::GetContainer(root_window, kShellWindowId_SettingBubbleContainer);
197 widget_.reset(new views::Widget); 196 widget_.reset(new views::Widget);
198 widget_->Init(params); 197 widget_->Init(params);
199 widget_->SetContentsView(delegate); 198 widget_->SetContentsView(delegate);
200 widget_->GetNativeView()->SetName("ExitWarningWindow"); 199 widget_->GetNativeView()->SetName("ExitWarningWindow");
201 widget_->Show(); 200 widget_->Show();
202 201
203 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 202 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
204 } 203 }
205 204
206 void ExitWarningHandler::Hide() { 205 void ExitWarningHandler::Hide() {
207 widget_.reset(); 206 widget_.reset();
208 } 207 }
209 208
210 } // namespace ash 209 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/display/shared_display_edge_indicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698