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

Unified Diff: ui/aura/window.cc

Issue 9181012: Don't activate a window if screen is locked. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/window.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window.cc
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index f985944cfcfe31d790bccaf4dfdba49e26641e14..dec6c891acc2ddf3c0ac95aa4e2a9fdf02e44d94 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -348,22 +348,20 @@ bool Window::HasFocus() const {
return focus_manager ? focus_manager->IsFocusedWindow(this) : false;
}
-// For a given window, we determine its focusability by inspecting each sibling
-// after it (i.e. drawn in front of it in the z-order) to see if it stops
-// propagation of events that would otherwise be targeted at windows behind it.
-// We then perform this same check on every window up to the root.
+// For a given window, we determine its focusability and ability to
+// receive events by inspecting each sibling after it (i.e. drawn in
+// front of it in the z-order) to see if it stops propagation of
+// events that would otherwise be targeted at windows behind it. We
+// then perform this same check on every window up to the root.
bool Window::CanFocus() const {
if (!IsVisible() || !parent_ || (delegate_ && !delegate_->CanFocus()))
return false;
+ return !IsBehindStopEventsWindow() && parent_->CanFocus();
+}
- Windows::const_iterator i = std::find(parent_->children().begin(),
- parent_->children().end(),
- this);
- for (++i; i != parent_->children().end(); ++i) {
- if ((*i)->StopsEventPropagation())
- return false;
- }
- return parent_->CanFocus();
+bool Window::CanReceiveEvents() const {
+ return parent_ && IsVisible() && !IsBehindStopEventsWindow() &&
+ parent_->CanReceiveEvents();
}
internal::FocusManager* Window::GetFocusManager() {
@@ -425,6 +423,15 @@ int Window::GetIntProperty(const char* name) const {
GetProperty(name)));
}
+bool Window::StopsEventPropagation() const {
+ if (!stops_event_propagation_ || children_.empty())
+ return false;
+ aura::Window::Windows::const_iterator it =
+ std::find_if(children_.begin(), children_.end(),
+ std::mem_fun(&aura::Window::IsVisible));
+ return it != children_.end();
+}
+
RootWindow* Window::GetRootWindow() {
return parent_ ? parent_->GetRootWindow() : NULL;
}
@@ -487,10 +494,6 @@ void Window::SchedulePaint() {
SchedulePaintInRect(gfx::Rect(0, 0, bounds().width(), bounds().height()));
}
-bool Window::StopsEventPropagation() const {
- return stops_event_propagation_ && !children_.empty();
-}
-
Window* Window::GetWindowForPoint(const gfx::Point& local_point,
bool return_tightest,
bool for_event_handling) {
@@ -556,4 +559,15 @@ void Window::UpdateLayerName(const std::string& name) {
#endif
}
+bool Window::IsBehindStopEventsWindow() const {
+ Windows::const_iterator i = std::find(parent_->children().begin(),
+ parent_->children().end(),
+ this);
+ for (++i; i != parent_->children().end(); ++i) {
+ if ((*i)->StopsEventPropagation())
+ return true;
+ }
+ return false;
+}
+
} // namespace aura
« no previous file with comments | « ui/aura/window.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698