| 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 #include "ui/views/mus/native_widget_mus.h" | 5 #include "ui/views/mus/native_widget_mus.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 GetWidget()->SetInitialFocus(state); | 1060 GetWidget()->SetInitialFocus(state); |
| 1061 } | 1061 } |
| 1062 } | 1062 } |
| 1063 | 1063 |
| 1064 bool NativeWidgetMus::IsVisible() const { | 1064 bool NativeWidgetMus::IsVisible() const { |
| 1065 // TODO(beng): this should probably be wired thru PlatformWindow. | 1065 // TODO(beng): this should probably be wired thru PlatformWindow. |
| 1066 return window_ && window_->visible(); | 1066 return window_ && window_->visible(); |
| 1067 } | 1067 } |
| 1068 | 1068 |
| 1069 void NativeWidgetMus::Activate() { | 1069 void NativeWidgetMus::Activate() { |
| 1070 if (!window_) |
| 1071 return; |
| 1072 |
| 1070 static_cast<aura::client::ActivationClient*>(focus_client_.get()) | 1073 static_cast<aura::client::ActivationClient*>(focus_client_.get()) |
| 1071 ->ActivateWindow(content_); | 1074 ->ActivateWindow(content_); |
| 1072 // FocusControllerMus should have focused |window_| when |content_| is | |
| 1073 // activated. | |
| 1074 DCHECK(!window_ || window_->HasFocus()); | |
| 1075 } | 1075 } |
| 1076 | 1076 |
| 1077 void NativeWidgetMus::Deactivate() { | 1077 void NativeWidgetMus::Deactivate() { |
| 1078 if (IsActive()) | 1078 if (IsActive()) |
| 1079 window_->window_tree()->ClearFocus(); | 1079 window_->window_tree()->ClearFocus(); |
| 1080 } | 1080 } |
| 1081 | 1081 |
| 1082 bool NativeWidgetMus::IsActive() const { | 1082 bool NativeWidgetMus::IsActive() const { |
| 1083 ui::Window* focused = | 1083 ui::Window* focused = |
| 1084 window_ ? window_->window_tree()->GetFocusedWindow() : nullptr; | 1084 window_ ? window_->window_tree()->GetFocusedWindow() : nullptr; |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 | 1508 |
| 1509 gfx::Path mask_path; | 1509 gfx::Path mask_path; |
| 1510 native_widget_delegate_->GetHitTestMask(&mask_path); | 1510 native_widget_delegate_->GetHitTestMask(&mask_path); |
| 1511 // TODO(jamescook): Use the full path for the mask. | 1511 // TODO(jamescook): Use the full path for the mask. |
| 1512 gfx::Rect mask_rect = | 1512 gfx::Rect mask_rect = |
| 1513 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); | 1513 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); |
| 1514 window_->SetHitTestMask(mask_rect); | 1514 window_->SetHitTestMask(mask_rect); |
| 1515 } | 1515 } |
| 1516 | 1516 |
| 1517 } // namespace views | 1517 } // namespace views |
| OLD | NEW |