Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: ui/views/mus/native_widget_mus.cc

Issue 2384083005: Revert of mus: Use TooltipManagerAura in NativeWidgetMus. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/mus/native_widget_mus.h ('k') | ui/views/widget/tooltip_manager_aura.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
28 #include "ui/aura/window.h" 28 #include "ui/aura/window.h"
29 #include "ui/aura/window_property.h" 29 #include "ui/aura/window_property.h"
30 #include "ui/base/hit_test.h" 30 #include "ui/base/hit_test.h"
31 #include "ui/display/display.h" 31 #include "ui/display/display.h"
32 #include "ui/display/screen.h" 32 #include "ui/display/screen.h"
33 #include "ui/events/event.h" 33 #include "ui/events/event.h"
34 #include "ui/gfx/canvas.h" 34 #include "ui/gfx/canvas.h"
35 #include "ui/gfx/path.h" 35 #include "ui/gfx/path.h"
36 #include "ui/native_theme/native_theme_aura.h" 36 #include "ui/native_theme/native_theme_aura.h"
37 #include "ui/platform_window/platform_window_delegate.h" 37 #include "ui/platform_window/platform_window_delegate.h"
38 #include "ui/views/corewm/tooltip.h"
39 #include "ui/views/corewm/tooltip_aura.h"
40 #include "ui/views/corewm/tooltip_controller.h"
41 #include "ui/views/drag_utils.h" 38 #include "ui/views/drag_utils.h"
42 #include "ui/views/mus/drag_drop_client_mus.h" 39 #include "ui/views/mus/drag_drop_client_mus.h"
43 #include "ui/views/mus/drop_target_mus.h" 40 #include "ui/views/mus/drop_target_mus.h"
44 #include "ui/views/mus/window_manager_connection.h" 41 #include "ui/views/mus/window_manager_connection.h"
45 #include "ui/views/mus/window_manager_constants_converters.h" 42 #include "ui/views/mus/window_manager_constants_converters.h"
46 #include "ui/views/mus/window_manager_frame_values.h" 43 #include "ui/views/mus/window_manager_frame_values.h"
47 #include "ui/views/mus/window_tree_host_mus.h" 44 #include "ui/views/mus/window_tree_host_mus.h"
48 #include "ui/views/widget/drop_helper.h" 45 #include "ui/views/widget/drop_helper.h"
49 #include "ui/views/widget/native_widget_aura.h" 46 #include "ui/views/widget/native_widget_aura.h"
50 #include "ui/views/widget/tooltip_manager_aura.h"
51 #include "ui/views/widget/widget_delegate.h" 47 #include "ui/views/widget/widget_delegate.h"
52 #include "ui/views/window/custom_frame_view.h" 48 #include "ui/views/window/custom_frame_view.h"
53 #include "ui/wm/core/base_focus_rules.h" 49 #include "ui/wm/core/base_focus_rules.h"
54 #include "ui/wm/core/capture_controller.h" 50 #include "ui/wm/core/capture_controller.h"
55 #include "ui/wm/core/cursor_manager.h" 51 #include "ui/wm/core/cursor_manager.h"
56 #include "ui/wm/core/default_screen_position_client.h" 52 #include "ui/wm/core/default_screen_position_client.h"
57 #include "ui/wm/core/focus_controller.h" 53 #include "ui/wm/core/focus_controller.h"
58 #include "ui/wm/core/native_cursor_manager.h" 54 #include "ui/wm/core/native_cursor_manager.h"
59 55
60 DECLARE_WINDOW_PROPERTY_TYPE(ui::Window*); 56 DECLARE_WINDOW_PROPERTY_TYPE(ui::Window*);
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 return native_widget->GetWidget(); 582 return native_widget->GetWidget();
587 } 583 }
588 584
589 aura::Window* NativeWidgetMus::GetRootWindow() { 585 aura::Window* NativeWidgetMus::GetRootWindow() {
590 return window_tree_host_->window(); 586 return window_tree_host_->window();
591 } 587 }
592 588
593 void NativeWidgetMus::OnPlatformWindowClosed() { 589 void NativeWidgetMus::OnPlatformWindowClosed() {
594 native_widget_delegate_->OnNativeWidgetDestroying(); 590 native_widget_delegate_->OnNativeWidgetDestroying();
595 591
596 tooltip_manager_.reset();
597 if (tooltip_controller_.get()) {
598 window_tree_host_->window()->RemovePreTargetHandler(
599 tooltip_controller_.get());
600 aura::client::SetTooltipClient(window_tree_host_->window(), NULL);
601 tooltip_controller_.reset();
602 }
603
604 window_tree_client_.reset(); // Uses |content_|. 592 window_tree_client_.reset(); // Uses |content_|.
605 capture_client_.reset(); // Uses |content_|. 593 capture_client_.reset(); // Uses |content_|.
606 594
607 window_tree_host_->RemoveObserver(this); 595 window_tree_host_->RemoveObserver(this);
608 window_tree_host_.reset(); 596 window_tree_host_.reset();
609 597
610 cursor_manager_.reset(); // Uses |window_|. 598 cursor_manager_.reset(); // Uses |window_|.
611 599
612 mus_window_observer_.reset(nullptr); 600 mus_window_observer_.reset(nullptr);
613 601
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 aura::client::SetScreenPositionClient(hosted_window, 712 aura::client::SetScreenPositionClient(hosted_window,
725 screen_position_client_.get()); 713 screen_position_client_.get());
726 714
727 drag_drop_client_ = base::MakeUnique<DragDropClientMus>(window_); 715 drag_drop_client_ = base::MakeUnique<DragDropClientMus>(window_);
728 aura::client::SetDragDropClient(hosted_window, drag_drop_client_.get()); 716 aura::client::SetDragDropClient(hosted_window, drag_drop_client_.get());
729 drop_target_ = base::MakeUnique<DropTargetMus>(content_); 717 drop_target_ = base::MakeUnique<DropTargetMus>(content_);
730 window_->SetCanAcceptDrops(drop_target_.get()); 718 window_->SetCanAcceptDrops(drop_target_.get());
731 drop_helper_ = base::MakeUnique<DropHelper>(GetWidget()->GetRootView()); 719 drop_helper_ = base::MakeUnique<DropHelper>(GetWidget()->GetRootView());
732 aura::client::SetDragDropDelegate(content_, this); 720 aura::client::SetDragDropDelegate(content_, this);
733 721
734 if (params.type != Widget::InitParams::TYPE_TOOLTIP) {
735 tooltip_manager_ = base::MakeUnique<TooltipManagerAura>(GetWidget());
736 tooltip_controller_ = base::MakeUnique<corewm::TooltipController>(
737 base::MakeUnique<corewm::TooltipAura>());
738 aura::client::SetTooltipClient(window_tree_host_->window(),
739 tooltip_controller_.get());
740 window_tree_host_->window()->AddPreTargetHandler(tooltip_controller_.get());
741 }
742
743 // TODO(erg): Remove this check when ash/mus/move_event_handler.cc's 722 // TODO(erg): Remove this check when ash/mus/move_event_handler.cc's
744 // direct usage of ui::Window::SetPredefinedCursor() is switched to a 723 // direct usage of ui::Window::SetPredefinedCursor() is switched to a
745 // private method on WindowManagerClient. 724 // private method on WindowManagerClient.
746 if (!is_parallel_widget_in_window_manager()) { 725 if (!is_parallel_widget_in_window_manager()) {
747 cursor_manager_ = base::MakeUnique<wm::CursorManager>( 726 cursor_manager_ = base::MakeUnique<wm::CursorManager>(
748 base::MakeUnique<NativeCursorManagerMus>(window_)); 727 base::MakeUnique<NativeCursorManagerMus>(window_));
749 aura::client::SetCursorClient(hosted_window, cursor_manager_.get()); 728 aura::client::SetCursorClient(hosted_window, cursor_manager_.get());
750 } 729 }
751 730
752 window_tree_client_ = 731 window_tree_client_ =
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 } 835 }
857 836
858 void* NativeWidgetMus::GetNativeWindowProperty(const char* name) const { 837 void* NativeWidgetMus::GetNativeWindowProperty(const char* name) const {
859 auto it = native_window_properties_.find(name); 838 auto it = native_window_properties_.find(name);
860 if (it == native_window_properties_.end()) 839 if (it == native_window_properties_.end())
861 return nullptr; 840 return nullptr;
862 return it->second; 841 return it->second;
863 } 842 }
864 843
865 TooltipManager* NativeWidgetMus::GetTooltipManager() const { 844 TooltipManager* NativeWidgetMus::GetTooltipManager() const {
866 return tooltip_manager_.get(); 845 // NOTIMPLEMENTED();
846 return nullptr;
867 } 847 }
868 848
869 void NativeWidgetMus::SetCapture() { 849 void NativeWidgetMus::SetCapture() {
870 if (content_) 850 if (content_)
871 content_->SetCapture(); 851 content_->SetCapture();
872 } 852 }
873 853
874 void NativeWidgetMus::ReleaseCapture() { 854 void NativeWidgetMus::ReleaseCapture() {
875 if (content_) 855 if (content_)
876 content_->ReleaseCapture(); 856 content_->ReleaseCapture();
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 } 1378 }
1399 // Renderer may send a key event back to us if the key event wasn't handled, 1379 // Renderer may send a key event back to us if the key event wasn't handled,
1400 // and the window may be invisible by that time. 1380 // and the window may be invisible by that time.
1401 if (!content_->IsVisible()) 1381 if (!content_->IsVisible())
1402 return; 1382 return;
1403 1383
1404 native_widget_delegate_->OnKeyEvent(event); 1384 native_widget_delegate_->OnKeyEvent(event);
1405 } 1385 }
1406 1386
1407 void NativeWidgetMus::OnMouseEvent(ui::MouseEvent* event) { 1387 void NativeWidgetMus::OnMouseEvent(ui::MouseEvent* event) {
1388 // TODO(sky): forward to tooltipmanager. See NativeWidgetDesktopAura.
1408 DCHECK(content_->IsVisible()); 1389 DCHECK(content_->IsVisible());
1409
1410 if (tooltip_manager_.get())
1411 tooltip_manager_->UpdateTooltip();
1412 TooltipManagerAura::UpdateTooltipManagerForCapture(GetWidget());
1413
1414 native_widget_delegate_->OnMouseEvent(event); 1390 native_widget_delegate_->OnMouseEvent(event);
1415 // WARNING: we may have been deleted. 1391 // WARNING: we may have been deleted.
1416 } 1392 }
1417 1393
1418 void NativeWidgetMus::OnScrollEvent(ui::ScrollEvent* event) { 1394 void NativeWidgetMus::OnScrollEvent(ui::ScrollEvent* event) {
1419 if (event->type() == ui::ET_SCROLL) { 1395 if (event->type() == ui::ET_SCROLL) {
1420 native_widget_delegate_->OnScrollEvent(event); 1396 native_widget_delegate_->OnScrollEvent(event);
1421 if (event->handled()) 1397 if (event->handled())
1422 return; 1398 return;
1423 1399
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 1508
1533 gfx::Path mask_path; 1509 gfx::Path mask_path;
1534 native_widget_delegate_->GetHitTestMask(&mask_path); 1510 native_widget_delegate_->GetHitTestMask(&mask_path);
1535 // TODO(jamescook): Use the full path for the mask. 1511 // TODO(jamescook): Use the full path for the mask.
1536 gfx::Rect mask_rect = 1512 gfx::Rect mask_rect =
1537 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); 1513 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds()));
1538 window_->SetHitTestMask(mask_rect); 1514 window_->SetHitTestMask(mask_rect);
1539 } 1515 }
1540 1516
1541 } // namespace views 1517 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/native_widget_mus.h ('k') | ui/views/widget/tooltip_manager_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698