OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/widget/widget.h" | 5 #include "ui/views/widget/widget.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 if (!focus_on_creation_ || show_state == ui::SHOW_STATE_INACTIVE || | 1298 if (!focus_on_creation_ || show_state == ui::SHOW_STATE_INACTIVE || |
1299 show_state == ui::SHOW_STATE_MINIMIZED) { | 1299 show_state == ui::SHOW_STATE_MINIMIZED) { |
1300 // If not focusing the window now, tell the focus manager which view to | 1300 // If not focusing the window now, tell the focus manager which view to |
1301 // focus when the window is restored. | 1301 // focus when the window is restored. |
1302 if (v && focus_manager) | 1302 if (v && focus_manager) |
1303 focus_manager->SetStoredFocusView(v); | 1303 focus_manager->SetStoredFocusView(v); |
1304 return true; | 1304 return true; |
1305 } | 1305 } |
1306 if (v) { | 1306 if (v) { |
1307 v->RequestFocus(); | 1307 v->RequestFocus(); |
1308 // If the request for focus was unsuccessful, fall back to using the first | 1308 // If the Widget is active (thus allowing its child Views to receive focus), |
| 1309 // but the request for focus was unsuccessful, fall back to using the first |
1309 // focusable View instead. | 1310 // focusable View instead. |
1310 if (focus_manager && focus_manager->GetFocusedView() == nullptr) | 1311 if (focus_manager && focus_manager->GetFocusedView() == nullptr && |
| 1312 IsActive()) { |
1311 focus_manager->AdvanceFocus(false); | 1313 focus_manager->AdvanceFocus(false); |
| 1314 } |
1312 } | 1315 } |
1313 return !!focus_manager->GetFocusedView(); | 1316 return !!focus_manager->GetFocusedView(); |
1314 } | 1317 } |
1315 | 1318 |
1316 bool Widget::ShouldDescendIntoChildForEventHandling( | 1319 bool Widget::ShouldDescendIntoChildForEventHandling( |
1317 ui::Layer* root_layer, | 1320 ui::Layer* root_layer, |
1318 gfx::NativeView child, | 1321 gfx::NativeView child, |
1319 ui::Layer* child_layer, | 1322 ui::Layer* child_layer, |
1320 const gfx::Point& location) { | 1323 const gfx::Point& location) { |
1321 if (widget_delegate_ && | 1324 if (widget_delegate_ && |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 | 1547 |
1545 //////////////////////////////////////////////////////////////////////////////// | 1548 //////////////////////////////////////////////////////////////////////////////// |
1546 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1549 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1547 | 1550 |
1548 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1551 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1549 return this; | 1552 return this; |
1550 } | 1553 } |
1551 | 1554 |
1552 } // namespace internal | 1555 } // namespace internal |
1553 } // namespace views | 1556 } // namespace views |
OLD | NEW |