| 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. |
| 6 // See base/logging for details on this. |
| 7 #define NOTIMPLEMENTED_POLICY 5 |
| 8 |
| 5 #include "ui/views/mus/native_widget_mus.h" | 9 #include "ui/views/mus/native_widget_mus.h" |
| 6 | 10 |
| 7 #include <utility> | 11 #include <utility> |
| 8 #include <vector> | 12 #include <vector> |
| 9 | 13 |
| 10 #include "base/callback.h" | 14 #include "base/callback.h" |
| 11 #include "base/macros.h" | 15 #include "base/macros.h" |
| 12 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 13 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 : native_widget_mus_(native_widget_mus), | 409 : native_widget_mus_(native_widget_mus), |
| 406 show_state_(ui::mojom::ShowState::DEFAULT) { | 410 show_state_(ui::mojom::ShowState::DEFAULT) { |
| 407 mus_window()->AddObserver(this); | 411 mus_window()->AddObserver(this); |
| 408 } | 412 } |
| 409 | 413 |
| 410 ~MusWindowObserver() override { | 414 ~MusWindowObserver() override { |
| 411 mus_window()->RemoveObserver(this); | 415 mus_window()->RemoveObserver(this); |
| 412 } | 416 } |
| 413 | 417 |
| 414 // ui::WindowObserver: | 418 // ui::WindowObserver: |
| 415 void OnWindowVisibilityChanging(ui::Window* window) override { | 419 void OnWindowVisibilityChanging(ui::Window* window, bool visible) override { |
| 416 native_widget_mus_->OnMusWindowVisibilityChanging(window); | 420 native_widget_mus_->OnMusWindowVisibilityChanging(window, visible); |
| 417 } | 421 } |
| 418 void OnWindowVisibilityChanged(ui::Window* window) override { | 422 void OnWindowVisibilityChanged(ui::Window* window, bool visible) override { |
| 419 native_widget_mus_->OnMusWindowVisibilityChanged(window); | 423 native_widget_mus_->OnMusWindowVisibilityChanged(window, visible); |
| 420 } | 424 } |
| 421 void OnWindowPredefinedCursorChanged(ui::Window* window, | 425 void OnWindowPredefinedCursorChanged(ui::Window* window, |
| 422 ui::mojom::Cursor cursor) override { | 426 ui::mojom::Cursor cursor) override { |
| 423 DCHECK_EQ(window, mus_window()); | 427 DCHECK_EQ(window, mus_window()); |
| 424 native_widget_mus_->set_last_cursor(cursor); | 428 native_widget_mus_->set_last_cursor(cursor); |
| 425 } | 429 } |
| 426 void OnWindowSharedPropertyChanged( | 430 void OnWindowSharedPropertyChanged( |
| 427 ui::Window* window, | 431 ui::Window* window, |
| 428 const std::string& name, | 432 const std::string& name, |
| 429 const std::vector<uint8_t>* old_data, | 433 const std::vector<uint8_t>* old_data, |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 void NativeWidgetMus::OnWidgetInitDone() { | 793 void NativeWidgetMus::OnWidgetInitDone() { |
| 790 // The client area is calculated from the NonClientView. During | 794 // The client area is calculated from the NonClientView. During |
| 791 // InitNativeWidget() the NonClientView has not been created. When this | 795 // InitNativeWidget() the NonClientView has not been created. When this |
| 792 // function is called the NonClientView has been created, so that we can | 796 // function is called the NonClientView has been created, so that we can |
| 793 // correctly calculate the client area and push it to the ui::Window. | 797 // correctly calculate the client area and push it to the ui::Window. |
| 794 UpdateClientArea(); | 798 UpdateClientArea(); |
| 795 UpdateHitTestMask(); | 799 UpdateHitTestMask(); |
| 796 } | 800 } |
| 797 | 801 |
| 798 bool NativeWidgetMus::ShouldUseNativeFrame() const { | 802 bool NativeWidgetMus::ShouldUseNativeFrame() const { |
| 799 // NOTIMPLEMENTED(); | 803 NOTIMPLEMENTED(); |
| 800 return false; | 804 return false; |
| 801 } | 805 } |
| 802 | 806 |
| 803 bool NativeWidgetMus::ShouldWindowContentsBeTransparent() const { | 807 bool NativeWidgetMus::ShouldWindowContentsBeTransparent() const { |
| 804 // NOTIMPLEMENTED(); | 808 NOTIMPLEMENTED(); |
| 805 return true; | 809 return true; |
| 806 } | 810 } |
| 807 | 811 |
| 808 void NativeWidgetMus::FrameTypeChanged() { | 812 void NativeWidgetMus::FrameTypeChanged() { |
| 809 // NOTIMPLEMENTED(); | 813 NOTIMPLEMENTED(); |
| 810 } | 814 } |
| 811 | 815 |
| 812 Widget* NativeWidgetMus::GetWidget() { | 816 Widget* NativeWidgetMus::GetWidget() { |
| 813 return native_widget_delegate_->AsWidget(); | 817 return native_widget_delegate_->AsWidget(); |
| 814 } | 818 } |
| 815 | 819 |
| 816 const Widget* NativeWidgetMus::GetWidget() const { | 820 const Widget* NativeWidgetMus::GetWidget() const { |
| 817 return native_widget_delegate_->AsWidget(); | 821 return native_widget_delegate_->AsWidget(); |
| 818 } | 822 } |
| 819 | 823 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 831 | 835 |
| 832 const ui::Compositor* NativeWidgetMus::GetCompositor() const { | 836 const ui::Compositor* NativeWidgetMus::GetCompositor() const { |
| 833 return window_tree_host_->compositor(); | 837 return window_tree_host_->compositor(); |
| 834 } | 838 } |
| 835 | 839 |
| 836 const ui::Layer* NativeWidgetMus::GetLayer() const { | 840 const ui::Layer* NativeWidgetMus::GetLayer() const { |
| 837 return content_ ? content_->layer() : nullptr; | 841 return content_ ? content_->layer() : nullptr; |
| 838 } | 842 } |
| 839 | 843 |
| 840 void NativeWidgetMus::ReorderNativeViews() { | 844 void NativeWidgetMus::ReorderNativeViews() { |
| 841 // NOTIMPLEMENTED(); | 845 NOTIMPLEMENTED(); |
| 842 } | 846 } |
| 843 | 847 |
| 844 void NativeWidgetMus::ViewRemoved(View* view) { | 848 void NativeWidgetMus::ViewRemoved(View* view) { |
| 845 // NOTIMPLEMENTED(); | 849 NOTIMPLEMENTED(); |
| 846 } | 850 } |
| 847 | 851 |
| 848 // These methods are wrong in mojo. They're not usually used to associate | 852 // These methods are wrong in mojo. They're not usually used to associate |
| 849 // data with a window; they are used exclusively in chrome/ to unsafely pass | 853 // data with a window; they are used exclusively in chrome/ to unsafely pass |
| 850 // raw pointers around. I can only find two places where we do the "safe" | 854 // raw pointers around. I can only find two places where we do the "safe" |
| 851 // thing (and even that requires casting an integer to a void*). They can't be | 855 // thing (and even that requires casting an integer to a void*). They can't be |
| 852 // used safely in a world where we separate things with mojo. They should be | 856 // used safely in a world where we separate things with mojo. They should be |
| 853 // removed; not ported. | 857 // removed; not ported. |
| 854 void NativeWidgetMus::SetNativeWindowProperty(const char* name, void* value) { | 858 void NativeWidgetMus::SetNativeWindowProperty(const char* name, void* value) { |
| 855 native_window_properties_[name] = value; | 859 native_window_properties_[name] = value; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 gfx::Rect bounds = display::Screen::GetScreen() | 898 gfx::Rect bounds = display::Screen::GetScreen() |
| 895 ->GetDisplayNearestWindow(content_) | 899 ->GetDisplayNearestWindow(content_) |
| 896 .work_area(); | 900 .work_area(); |
| 897 bounds.ClampToCenteredSize(size); | 901 bounds.ClampToCenteredSize(size); |
| 898 window_->SetBounds(bounds); | 902 window_->SetBounds(bounds); |
| 899 } | 903 } |
| 900 | 904 |
| 901 void NativeWidgetMus::GetWindowPlacement( | 905 void NativeWidgetMus::GetWindowPlacement( |
| 902 gfx::Rect* bounds, | 906 gfx::Rect* bounds, |
| 903 ui::WindowShowState* maximized) const { | 907 ui::WindowShowState* maximized) const { |
| 904 // NOTIMPLEMENTED(); | 908 NOTIMPLEMENTED(); |
| 905 } | 909 } |
| 906 | 910 |
| 907 bool NativeWidgetMus::SetWindowTitle(const base::string16& title) { | 911 bool NativeWidgetMus::SetWindowTitle(const base::string16& title) { |
| 908 if (!window_ || is_parallel_widget_in_window_manager()) | 912 if (!window_ || is_parallel_widget_in_window_manager()) |
| 909 return false; | 913 return false; |
| 910 const char* kWindowTitle_Property = | 914 const char* kWindowTitle_Property = |
| 911 ui::mojom::WindowManager::kWindowTitle_Property; | 915 ui::mojom::WindowManager::kWindowTitle_Property; |
| 912 const base::string16 current_title = | 916 const base::string16 current_title = |
| 913 window_->HasSharedProperty(kWindowTitle_Property) | 917 window_->HasSharedProperty(kWindowTitle_Property) |
| 914 ? window_->GetSharedProperty<base::string16>(kWindowTitle_Property) | 918 ? window_->GetSharedProperty<base::string16>(kWindowTitle_Property) |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 | 1016 |
| 1013 void NativeWidgetMus::SetSize(const gfx::Size& size) { | 1017 void NativeWidgetMus::SetSize(const gfx::Size& size) { |
| 1014 if (!window_tree_host_) | 1018 if (!window_tree_host_) |
| 1015 return; | 1019 return; |
| 1016 | 1020 |
| 1017 gfx::Rect bounds = window_tree_host_->GetBounds(); | 1021 gfx::Rect bounds = window_tree_host_->GetBounds(); |
| 1018 SetBounds(gfx::Rect(bounds.origin(), size)); | 1022 SetBounds(gfx::Rect(bounds.origin(), size)); |
| 1019 } | 1023 } |
| 1020 | 1024 |
| 1021 void NativeWidgetMus::StackAbove(gfx::NativeView native_view) { | 1025 void NativeWidgetMus::StackAbove(gfx::NativeView native_view) { |
| 1022 // NOTIMPLEMENTED(); | 1026 NOTIMPLEMENTED(); |
| 1023 } | 1027 } |
| 1024 | 1028 |
| 1025 void NativeWidgetMus::StackAtTop() { | 1029 void NativeWidgetMus::StackAtTop() { |
| 1026 // NOTIMPLEMENTED(); | 1030 NOTIMPLEMENTED(); |
| 1027 } | 1031 } |
| 1028 | 1032 |
| 1029 void NativeWidgetMus::StackBelow(gfx::NativeView native_view) { | 1033 void NativeWidgetMus::StackBelow(gfx::NativeView native_view) { |
| 1030 // NOTIMPLEMENTED(); | 1034 NOTIMPLEMENTED(); |
| 1031 } | 1035 } |
| 1032 | 1036 |
| 1033 void NativeWidgetMus::SetShape(std::unique_ptr<SkRegion> shape) { | 1037 void NativeWidgetMus::SetShape(std::unique_ptr<SkRegion> shape) { |
| 1034 // NOTIMPLEMENTED(); | 1038 NOTIMPLEMENTED(); |
| 1035 } | 1039 } |
| 1036 | 1040 |
| 1037 void NativeWidgetMus::Close() { | 1041 void NativeWidgetMus::Close() { |
| 1038 Hide(); | 1042 Hide(); |
| 1039 if (!close_widget_factory_.HasWeakPtrs()) { | 1043 if (!close_widget_factory_.HasWeakPtrs()) { |
| 1040 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1044 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1041 FROM_HERE, base::Bind(&NativeWidgetMus::CloseNow, | 1045 FROM_HERE, base::Bind(&NativeWidgetMus::CloseNow, |
| 1042 close_widget_factory_.GetWeakPtr())); | 1046 close_widget_factory_.GetWeakPtr())); |
| 1043 } | 1047 } |
| 1044 } | 1048 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 bool NativeWidgetMus::IsFullscreen() const { | 1205 bool NativeWidgetMus::IsFullscreen() const { |
| 1202 return GetShowState(window_) == ui::mojom::ShowState::FULLSCREEN; | 1206 return GetShowState(window_) == ui::mojom::ShowState::FULLSCREEN; |
| 1203 } | 1207 } |
| 1204 | 1208 |
| 1205 void NativeWidgetMus::SetOpacity(float opacity) { | 1209 void NativeWidgetMus::SetOpacity(float opacity) { |
| 1206 if (window_) | 1210 if (window_) |
| 1207 window_->SetOpacity(opacity); | 1211 window_->SetOpacity(opacity); |
| 1208 } | 1212 } |
| 1209 | 1213 |
| 1210 void NativeWidgetMus::FlashFrame(bool flash_frame) { | 1214 void NativeWidgetMus::FlashFrame(bool flash_frame) { |
| 1211 // NOTIMPLEMENTED(); | 1215 NOTIMPLEMENTED(); |
| 1212 } | 1216 } |
| 1213 | 1217 |
| 1214 void NativeWidgetMus::RunShellDrag(View* view, | 1218 void NativeWidgetMus::RunShellDrag(View* view, |
| 1215 const ui::OSExchangeData& data, | 1219 const ui::OSExchangeData& data, |
| 1216 const gfx::Point& location, | 1220 const gfx::Point& location, |
| 1217 int drag_operations, | 1221 int drag_operations, |
| 1218 ui::DragDropTypes::DragEventSource source) { | 1222 ui::DragDropTypes::DragEventSource source) { |
| 1219 if (window_) | 1223 if (window_) |
| 1220 views::RunShellDrag(content_, data, location, drag_operations, source); | 1224 views::RunShellDrag(content_, data, location, drag_operations, source); |
| 1221 } | 1225 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1234 // we support right now. If native_type() == kCursorCustom, than we should | 1238 // we support right now. If native_type() == kCursorCustom, than we should |
| 1235 // also send an image, but as the cursor code is currently written, the image | 1239 // also send an image, but as the cursor code is currently written, the image |
| 1236 // is in a platform native format that's already uploaded to the window | 1240 // is in a platform native format that's already uploaded to the window |
| 1237 // server. | 1241 // server. |
| 1238 ui::mojom::Cursor new_cursor = ui::mojom::Cursor(cursor.native_type()); | 1242 ui::mojom::Cursor new_cursor = ui::mojom::Cursor(cursor.native_type()); |
| 1239 if (last_cursor_ != new_cursor) | 1243 if (last_cursor_ != new_cursor) |
| 1240 window_->SetPredefinedCursor(new_cursor); | 1244 window_->SetPredefinedCursor(new_cursor); |
| 1241 } | 1245 } |
| 1242 | 1246 |
| 1243 bool NativeWidgetMus::IsMouseEventsEnabled() const { | 1247 bool NativeWidgetMus::IsMouseEventsEnabled() const { |
| 1244 // NOTIMPLEMENTED(); | 1248 NOTIMPLEMENTED(); |
| 1245 return true; | 1249 return true; |
| 1246 } | 1250 } |
| 1247 | 1251 |
| 1248 void NativeWidgetMus::ClearNativeFocus() { | 1252 void NativeWidgetMus::ClearNativeFocus() { |
| 1249 if (!IsActive()) | 1253 if (!IsActive()) |
| 1250 return; | 1254 return; |
| 1251 ui::Window* focused = | 1255 ui::Window* focused = |
| 1252 window_ ? window_->window_tree()->GetFocusedWindow() : nullptr; | 1256 window_ ? window_->window_tree()->GetFocusedWindow() : nullptr; |
| 1253 if (focused && window_->Contains(focused) && focused != window_) | 1257 if (focused && window_->Contains(focused) && focused != window_) |
| 1254 window_->SetFocus(); | 1258 window_->SetFocus(); |
| 1255 // Move aura-focus back to |content_|, so that the Widget still receives | 1259 // Move aura-focus back to |content_|, so that the Widget still receives |
| 1256 // events correctly. | 1260 // events correctly. |
| 1257 aura::client::GetFocusClient(content_)->ResetFocusWithinActiveWindow( | 1261 aura::client::GetFocusClient(content_)->ResetFocusWithinActiveWindow( |
| 1258 content_); | 1262 content_); |
| 1259 } | 1263 } |
| 1260 | 1264 |
| 1261 gfx::Rect NativeWidgetMus::GetWorkAreaBoundsInScreen() const { | 1265 gfx::Rect NativeWidgetMus::GetWorkAreaBoundsInScreen() const { |
| 1262 // NOTIMPLEMENTED(); | 1266 NOTIMPLEMENTED(); |
| 1263 return gfx::Rect(); | 1267 return gfx::Rect(); |
| 1264 } | 1268 } |
| 1265 | 1269 |
| 1266 Widget::MoveLoopResult NativeWidgetMus::RunMoveLoop( | 1270 Widget::MoveLoopResult NativeWidgetMus::RunMoveLoop( |
| 1267 const gfx::Vector2d& drag_offset, | 1271 const gfx::Vector2d& drag_offset, |
| 1268 Widget::MoveLoopSource source, | 1272 Widget::MoveLoopSource source, |
| 1269 Widget::MoveLoopEscapeBehavior escape_behavior) { | 1273 Widget::MoveLoopEscapeBehavior escape_behavior) { |
| 1270 ReleaseCapture(); | 1274 ReleaseCapture(); |
| 1271 | 1275 |
| 1272 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); | 1276 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1288 run_loop.Run(); | 1292 run_loop.Run(); |
| 1289 | 1293 |
| 1290 return success ? Widget::MOVE_LOOP_SUCCESSFUL : Widget::MOVE_LOOP_CANCELED; | 1294 return success ? Widget::MOVE_LOOP_SUCCESSFUL : Widget::MOVE_LOOP_CANCELED; |
| 1291 } | 1295 } |
| 1292 | 1296 |
| 1293 void NativeWidgetMus::EndMoveLoop() { | 1297 void NativeWidgetMus::EndMoveLoop() { |
| 1294 window_->CancelWindowMove(); | 1298 window_->CancelWindowMove(); |
| 1295 } | 1299 } |
| 1296 | 1300 |
| 1297 void NativeWidgetMus::SetVisibilityChangedAnimationsEnabled(bool value) { | 1301 void NativeWidgetMus::SetVisibilityChangedAnimationsEnabled(bool value) { |
| 1298 // NOTIMPLEMENTED(); | 1302 NOTIMPLEMENTED(); |
| 1299 } | 1303 } |
| 1300 | 1304 |
| 1301 void NativeWidgetMus::SetVisibilityAnimationDuration( | 1305 void NativeWidgetMus::SetVisibilityAnimationDuration( |
| 1302 const base::TimeDelta& duration) { | 1306 const base::TimeDelta& duration) { |
| 1303 // NOTIMPLEMENTED(); | 1307 NOTIMPLEMENTED(); |
| 1304 } | 1308 } |
| 1305 | 1309 |
| 1306 void NativeWidgetMus::SetVisibilityAnimationTransition( | 1310 void NativeWidgetMus::SetVisibilityAnimationTransition( |
| 1307 Widget::VisibilityTransition transition) { | 1311 Widget::VisibilityTransition transition) { |
| 1308 // NOTIMPLEMENTED(); | 1312 NOTIMPLEMENTED(); |
| 1309 } | 1313 } |
| 1310 | 1314 |
| 1311 ui::NativeTheme* NativeWidgetMus::GetNativeTheme() const { | 1315 ui::NativeTheme* NativeWidgetMus::GetNativeTheme() const { |
| 1312 return ui::NativeThemeAura::instance(); | 1316 return ui::NativeThemeAura::instance(); |
| 1313 } | 1317 } |
| 1314 | 1318 |
| 1315 void NativeWidgetMus::OnRootViewLayout() { | 1319 void NativeWidgetMus::OnRootViewLayout() { |
| 1316 // NOTIMPLEMENTED(); | 1320 NOTIMPLEMENTED(); |
| 1317 } | 1321 } |
| 1318 | 1322 |
| 1319 bool NativeWidgetMus::IsTranslucentWindowOpacitySupported() const { | 1323 bool NativeWidgetMus::IsTranslucentWindowOpacitySupported() const { |
| 1320 // NOTIMPLEMENTED(); | 1324 NOTIMPLEMENTED(); |
| 1321 return true; | 1325 return true; |
| 1322 } | 1326 } |
| 1323 | 1327 |
| 1324 void NativeWidgetMus::OnSizeConstraintsChanged() { | 1328 void NativeWidgetMus::OnSizeConstraintsChanged() { |
| 1325 if (!window_ || is_parallel_widget_in_window_manager()) | 1329 if (!window_ || is_parallel_widget_in_window_manager()) |
| 1326 return; | 1330 return; |
| 1327 | 1331 |
| 1328 window_->SetSharedProperty<int32_t>( | 1332 window_->SetSharedProperty<int32_t>( |
| 1329 ui::mojom::WindowManager::kResizeBehavior_Property, | 1333 ui::mojom::WindowManager::kResizeBehavior_Property, |
| 1330 ResizeBehaviorFromDelegate(GetWidget()->widget_delegate())); | 1334 ResizeBehaviorFromDelegate(GetWidget()->widget_delegate())); |
| 1331 } | 1335 } |
| 1332 | 1336 |
| 1333 void NativeWidgetMus::RepostNativeEvent(gfx::NativeEvent native_event) { | 1337 void NativeWidgetMus::RepostNativeEvent(gfx::NativeEvent native_event) { |
| 1334 // NOTIMPLEMENTED(); | 1338 NOTIMPLEMENTED(); |
| 1335 } | 1339 } |
| 1336 | 1340 |
| 1337 std::string NativeWidgetMus::GetName() const { | 1341 std::string NativeWidgetMus::GetName() const { |
| 1338 return window_->GetName(); | 1342 return window_->GetName(); |
| 1339 } | 1343 } |
| 1340 | 1344 |
| 1341 //////////////////////////////////////////////////////////////////////////////// | 1345 //////////////////////////////////////////////////////////////////////////////// |
| 1342 // NativeWidgetMus, aura::WindowDelegate implementation: | 1346 // NativeWidgetMus, aura::WindowDelegate implementation: |
| 1343 | 1347 |
| 1344 gfx::Size NativeWidgetMus::GetMinimumSize() const { | 1348 gfx::Size NativeWidgetMus::GetMinimumSize() const { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 std::unique_ptr<ui::Event> event = ui::Event::Clone(event_in); | 1519 std::unique_ptr<ui::Event> event = ui::Event::Clone(event_in); |
| 1516 // TODO(markdittmer): This should be this->OnEvent(event.get()), but that | 1520 // TODO(markdittmer): This should be this->OnEvent(event.get()), but that |
| 1517 // can't happen until IME is refactored out of in WindowTreeHostMus. | 1521 // can't happen until IME is refactored out of in WindowTreeHostMus. |
| 1518 platform_window_delegate()->DispatchEvent(event.get()); | 1522 platform_window_delegate()->DispatchEvent(event.get()); |
| 1519 // NOTE: |this| may be deleted. | 1523 // NOTE: |this| may be deleted. |
| 1520 | 1524 |
| 1521 ack_handler.set_handled(event->handled()); | 1525 ack_handler.set_handled(event->handled()); |
| 1522 // |ack_handler| acks the event on destruction if necessary. | 1526 // |ack_handler| acks the event on destruction if necessary. |
| 1523 } | 1527 } |
| 1524 | 1528 |
| 1525 void NativeWidgetMus::OnMusWindowVisibilityChanging(ui::Window* window) { | 1529 void NativeWidgetMus::OnMusWindowVisibilityChanging(ui::Window* window, |
| 1526 if (window == window_) { | 1530 bool visible) { |
| 1527 native_widget_delegate_->OnNativeWidgetVisibilityChanging( | 1531 if (window == window_) |
| 1528 !window->visible()); | 1532 native_widget_delegate_->OnNativeWidgetVisibilityChanging(visible); |
| 1529 } | |
| 1530 } | 1533 } |
| 1531 | 1534 |
| 1532 void NativeWidgetMus::OnMusWindowVisibilityChanged(ui::Window* window) { | 1535 void NativeWidgetMus::OnMusWindowVisibilityChanged(ui::Window* window, |
| 1536 bool visible) { |
| 1533 if (window != window_) | 1537 if (window != window_) |
| 1534 return; | 1538 return; |
| 1535 | 1539 |
| 1536 if (window->visible()) { | 1540 if (visible) { |
| 1537 window_tree_host_->Show(); | 1541 window_tree_host_->Show(); |
| 1538 GetNativeWindow()->Show(); | 1542 GetNativeWindow()->Show(); |
| 1539 } else { | 1543 } else { |
| 1540 window_tree_host_->Hide(); | 1544 window_tree_host_->Hide(); |
| 1541 GetNativeWindow()->Hide(); | 1545 GetNativeWindow()->Hide(); |
| 1542 } | 1546 } |
| 1543 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible()); | 1547 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); |
| 1544 } | 1548 } |
| 1545 | 1549 |
| 1546 void NativeWidgetMus::UpdateHitTestMask() { | 1550 void NativeWidgetMus::UpdateHitTestMask() { |
| 1547 // The window manager (or other underlay window provider) is not allowed to | 1551 // The window manager (or other underlay window provider) is not allowed to |
| 1548 // set a hit test mask, as that could interfere with a client app mask. | 1552 // set a hit test mask, as that could interfere with a client app mask. |
| 1549 if (is_parallel_widget_in_window_manager()) | 1553 if (is_parallel_widget_in_window_manager()) |
| 1550 return; | 1554 return; |
| 1551 | 1555 |
| 1552 if (!native_widget_delegate_->HasHitTestMask()) { | 1556 if (!native_widget_delegate_->HasHitTestMask()) { |
| 1553 window_->ClearHitTestMask(); | 1557 window_->ClearHitTestMask(); |
| 1554 return; | 1558 return; |
| 1555 } | 1559 } |
| 1556 | 1560 |
| 1557 gfx::Path mask_path; | 1561 gfx::Path mask_path; |
| 1558 native_widget_delegate_->GetHitTestMask(&mask_path); | 1562 native_widget_delegate_->GetHitTestMask(&mask_path); |
| 1559 // TODO(jamescook): Use the full path for the mask. | 1563 // TODO(jamescook): Use the full path for the mask. |
| 1560 gfx::Rect mask_rect = | 1564 gfx::Rect mask_rect = |
| 1561 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); | 1565 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); |
| 1562 window_->SetHitTestMask(mask_rect); | 1566 window_->SetHitTestMask(mask_rect); |
| 1563 } | 1567 } |
| 1564 | 1568 |
| 1565 } // namespace views | 1569 } // namespace views |
| OLD | NEW |