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 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1305 bool Widget::SetInitialFocus(ui::WindowShowState show_state) { | 1305 bool Widget::SetInitialFocus(ui::WindowShowState show_state) { |
1306 View* v = widget_delegate_->GetInitiallyFocusedView(); | 1306 View* v = widget_delegate_->GetInitiallyFocusedView(); |
1307 if (!focus_on_creation_ || show_state == ui::SHOW_STATE_INACTIVE || | 1307 if (!focus_on_creation_ || show_state == ui::SHOW_STATE_INACTIVE || |
1308 show_state == ui::SHOW_STATE_MINIMIZED) { | 1308 show_state == ui::SHOW_STATE_MINIMIZED) { |
1309 // If not focusing the window now, tell the focus manager which view to | 1309 // If not focusing the window now, tell the focus manager which view to |
1310 // focus when the window is restored. | 1310 // focus when the window is restored. |
1311 if (v && focus_manager_.get()) | 1311 if (v && focus_manager_.get()) |
1312 focus_manager_->SetStoredFocusView(v); | 1312 focus_manager_->SetStoredFocusView(v); |
1313 return true; | 1313 return true; |
1314 } | 1314 } |
1315 if (v) | 1315 if (v) { |
1316 v->RequestFocus(); | 1316 v->RequestFocus(); |
tapted
2017/01/04 03:59:38
This is a bit inconsistent. View::RequestFocus() u
Patti Lor
2017/01/06 06:15:09
Done.
| |
1317 // If the request for focus was unsuccessful, fall back to using the first | |
1318 // focusable View instead. | |
1319 if (focus_manager_ && v != focus_manager_->GetFocusedView()) | |
tapted
2017/01/04 03:59:38
Is it enough just to call focus_manager->AdvanceFo
Patti Lor
2017/01/06 06:15:09
No - AdvanceFocusIfNecessary is only meant to make
| |
1320 focus_manager_->AdvanceFocus(false); | |
1321 } | |
1317 return !!v; | 1322 return !!v; |
1318 } | 1323 } |
1319 | 1324 |
1320 //////////////////////////////////////////////////////////////////////////////// | 1325 //////////////////////////////////////////////////////////////////////////////// |
1321 // Widget, ui::EventSource implementation: | 1326 // Widget, ui::EventSource implementation: |
1322 ui::EventProcessor* Widget::GetEventProcessor() { | 1327 ui::EventProcessor* Widget::GetEventProcessor() { |
1323 return root_view_.get(); | 1328 return root_view_.get(); |
1324 } | 1329 } |
1325 | 1330 |
1326 //////////////////////////////////////////////////////////////////////////////// | 1331 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1490 | 1495 |
1491 //////////////////////////////////////////////////////////////////////////////// | 1496 //////////////////////////////////////////////////////////////////////////////// |
1492 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1497 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1493 | 1498 |
1494 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1499 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1495 return this; | 1500 return this; |
1496 } | 1501 } |
1497 | 1502 |
1498 } // namespace internal | 1503 } // namespace internal |
1499 } // namespace views | 1504 } // namespace views |
OLD | NEW |