OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This has to be before any other includes, else default is picked up. | 5 // This has to be before any other includes, else default is picked up. |
6 // See base/logging for details on this. | 6 // See base/logging for details on this. |
7 #define NOTIMPLEMENTED_POLICY 5 | 7 #define NOTIMPLEMENTED_POLICY 5 |
8 | 8 |
9 #include "ui/views/mus/native_widget_mus.h" | 9 #include "ui/views/mus/native_widget_mus.h" |
10 | 10 |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 if (state == ui::SHOW_STATE_MINIMIZED) | 1108 if (state == ui::SHOW_STATE_MINIMIZED) |
1109 Minimize(); | 1109 Minimize(); |
1110 } | 1110 } |
1111 | 1111 |
1112 bool NativeWidgetMus::IsVisible() const { | 1112 bool NativeWidgetMus::IsVisible() const { |
1113 // TODO(beng): this should probably be wired thru PlatformWindow. | 1113 // TODO(beng): this should probably be wired thru PlatformWindow. |
1114 return window_ && window_->visible(); | 1114 return window_ && window_->visible(); |
1115 } | 1115 } |
1116 | 1116 |
1117 void NativeWidgetMus::Activate() { | 1117 void NativeWidgetMus::Activate() { |
| 1118 if (!window_) |
| 1119 return; |
| 1120 |
1118 static_cast<aura::client::ActivationClient*>(focus_client_.get()) | 1121 static_cast<aura::client::ActivationClient*>(focus_client_.get()) |
1119 ->ActivateWindow(content_); | 1122 ->ActivateWindow(content_); |
1120 // FocusControllerMus should have focused |window_| when |content_| is | |
1121 // activated. | |
1122 DCHECK(!window_ || window_->HasFocus()); | |
1123 } | 1123 } |
1124 | 1124 |
1125 void NativeWidgetMus::Deactivate() { | 1125 void NativeWidgetMus::Deactivate() { |
1126 if (IsActive()) | 1126 if (IsActive()) |
1127 window_->window_tree()->ClearFocus(); | 1127 window_->window_tree()->ClearFocus(); |
1128 } | 1128 } |
1129 | 1129 |
1130 bool NativeWidgetMus::IsActive() const { | 1130 bool NativeWidgetMus::IsActive() const { |
1131 ui::Window* focused = | 1131 ui::Window* focused = |
1132 window_ ? window_->window_tree()->GetFocusedWindow() : nullptr; | 1132 window_ ? window_->window_tree()->GetFocusedWindow() : nullptr; |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 | 1567 |
1568 gfx::Path mask_path; | 1568 gfx::Path mask_path; |
1569 native_widget_delegate_->GetHitTestMask(&mask_path); | 1569 native_widget_delegate_->GetHitTestMask(&mask_path); |
1570 // TODO(jamescook): Use the full path for the mask. | 1570 // TODO(jamescook): Use the full path for the mask. |
1571 gfx::Rect mask_rect = | 1571 gfx::Rect mask_rect = |
1572 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); | 1572 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); |
1573 window_->SetHitTestMask(mask_rect); | 1573 window_->SetHitTestMask(mask_rect); |
1574 } | 1574 } |
1575 | 1575 |
1576 } // namespace views | 1576 } // namespace views |
OLD | NEW |