| 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 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 if (state == ui::SHOW_STATE_MINIMIZED) | 1106 if (state == ui::SHOW_STATE_MINIMIZED) |
| 1107 Minimize(); | 1107 Minimize(); |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 bool NativeWidgetMus::IsVisible() const { | 1110 bool NativeWidgetMus::IsVisible() const { |
| 1111 // TODO(beng): this should probably be wired thru PlatformWindow. | 1111 // TODO(beng): this should probably be wired thru PlatformWindow. |
| 1112 return window_ && window_->visible(); | 1112 return window_ && window_->visible(); |
| 1113 } | 1113 } |
| 1114 | 1114 |
| 1115 void NativeWidgetMus::Activate() { | 1115 void NativeWidgetMus::Activate() { |
| 1116 if (!window_) |
| 1117 return; |
| 1118 |
| 1116 static_cast<aura::client::ActivationClient*>(focus_client_.get()) | 1119 static_cast<aura::client::ActivationClient*>(focus_client_.get()) |
| 1117 ->ActivateWindow(content_); | 1120 ->ActivateWindow(content_); |
| 1118 // FocusControllerMus should have focused |window_| when |content_| is | |
| 1119 // activated. | |
| 1120 DCHECK(!window_ || window_->HasFocus()); | |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 void NativeWidgetMus::Deactivate() { | 1123 void NativeWidgetMus::Deactivate() { |
| 1124 if (IsActive()) | 1124 if (IsActive()) |
| 1125 window_->window_tree()->ClearFocus(); | 1125 window_->window_tree()->ClearFocus(); |
| 1126 } | 1126 } |
| 1127 | 1127 |
| 1128 bool NativeWidgetMus::IsActive() const { | 1128 bool NativeWidgetMus::IsActive() const { |
| 1129 ui::Window* focused = | 1129 ui::Window* focused = |
| 1130 window_ ? window_->window_tree()->GetFocusedWindow() : nullptr; | 1130 window_ ? window_->window_tree()->GetFocusedWindow() : nullptr; |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1558 | 1558 |
| 1559 gfx::Path mask_path; | 1559 gfx::Path mask_path; |
| 1560 native_widget_delegate_->GetHitTestMask(&mask_path); | 1560 native_widget_delegate_->GetHitTestMask(&mask_path); |
| 1561 // TODO(jamescook): Use the full path for the mask. | 1561 // TODO(jamescook): Use the full path for the mask. |
| 1562 gfx::Rect mask_rect = | 1562 gfx::Rect mask_rect = |
| 1563 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); | 1563 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); |
| 1564 window_->SetHitTestMask(mask_rect); | 1564 window_->SetHitTestMask(mask_rect); |
| 1565 } | 1565 } |
| 1566 | 1566 |
| 1567 } // namespace views | 1567 } // namespace views |
| OLD | NEW |