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

Side by Side Diff: components/exo/surface.cc

Issue 2028443002: exo: Implement lazy cursor changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « components/exo/surface.h ('k') | no next file » | 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 "components/exo/surface.h" 5 #include "components/exo/surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 public: 71 public:
72 explicit CustomWindowDelegate(Surface* surface) : surface_(surface) {} 72 explicit CustomWindowDelegate(Surface* surface) : surface_(surface) {}
73 ~CustomWindowDelegate() override {} 73 ~CustomWindowDelegate() override {}
74 74
75 // Overridden from aura::WindowDelegate: 75 // Overridden from aura::WindowDelegate:
76 gfx::Size GetMinimumSize() const override { return gfx::Size(); } 76 gfx::Size GetMinimumSize() const override { return gfx::Size(); }
77 gfx::Size GetMaximumSize() const override { return gfx::Size(); } 77 gfx::Size GetMaximumSize() const override { return gfx::Size(); }
78 void OnBoundsChanged(const gfx::Rect& old_bounds, 78 void OnBoundsChanged(const gfx::Rect& old_bounds,
79 const gfx::Rect& new_bounds) override {} 79 const gfx::Rect& new_bounds) override {}
80 gfx::NativeCursor GetCursor(const gfx::Point& point) override { 80 gfx::NativeCursor GetCursor(const gfx::Point& point) override {
81 return ui::kCursorNone; 81 // If surface has a cursor provider then return 'none' as cursor providers
82 // are responsible for drawing cursors. Use default cursor if no cursor
83 // provider is registered.
84 return surface_->HasCursorProvider() ? ui::kCursorNone : ui::kCursorNull;
Daniele Castagna 2016/05/31 19:32:03 I understand that when kCursorNull is returns the
82 } 85 }
83 int GetNonClientComponent(const gfx::Point& point) const override { 86 int GetNonClientComponent(const gfx::Point& point) const override {
84 return HTNOWHERE; 87 return HTNOWHERE;
85 } 88 }
86 bool ShouldDescendIntoChildForEventHandling( 89 bool ShouldDescendIntoChildForEventHandling(
87 aura::Window* child, 90 aura::Window* child,
88 const gfx::Point& location) override { 91 const gfx::Point& location) override {
89 return true; 92 return true;
90 } 93 }
91 bool CanFocus() override { return true; } 94 bool CanFocus() override { return true; }
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 Surface* sub_surface = sub_surface_entry.first; 736 Surface* sub_surface = sub_surface_entry.first;
734 if (!sub_surface->has_contents()) 737 if (!sub_surface->has_contents())
735 continue; 738 continue;
736 non_transparent_bounds.Union(sub_surface->GetNonTransparentBounds() + 739 non_transparent_bounds.Union(sub_surface->GetNonTransparentBounds() +
737 sub_surface->bounds().OffsetFromOrigin()); 740 sub_surface->bounds().OffsetFromOrigin());
738 } 741 }
739 742
740 return non_transparent_bounds; 743 return non_transparent_bounds;
741 } 744 }
742 745
746 void Surface::RegisterCursorProvider(Pointer* provider) {
747 cursor_providers_.insert(provider);
748 }
749
750 void Surface::UnregisterCursorProvider(Pointer* provider) {
751 cursor_providers_.erase(provider);
752 }
753
754 bool Surface::HasCursorProvider() const {
755 return !cursor_providers_.empty();
756 }
757
743 void Surface::SetSurfaceDelegate(SurfaceDelegate* delegate) { 758 void Surface::SetSurfaceDelegate(SurfaceDelegate* delegate) {
744 DCHECK(!delegate_ || !delegate); 759 DCHECK(!delegate_ || !delegate);
745 delegate_ = delegate; 760 delegate_ = delegate;
746 } 761 }
747 762
748 bool Surface::HasSurfaceDelegate() const { 763 bool Surface::HasSurfaceDelegate() const {
749 return !!delegate_; 764 return !!delegate_;
750 } 765 }
751 766
752 void Surface::AddSurfaceObserver(SurfaceObserver* observer) { 767 void Surface::AddSurfaceObserver(SurfaceObserver* observer) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 void Surface::WillDraw(cc::SurfaceId id) { 865 void Surface::WillDraw(cc::SurfaceId id) {
851 while (!active_frame_callbacks_.empty()) { 866 while (!active_frame_callbacks_.empty()) {
852 active_frame_callbacks_.front().Run(base::TimeTicks::Now()); 867 active_frame_callbacks_.front().Run(base::TimeTicks::Now());
853 active_frame_callbacks_.pop_front(); 868 active_frame_callbacks_.pop_front();
854 } 869 }
855 } 870 }
856 871
857 bool Surface::use_surface_layer_ = false; 872 bool Surface::use_surface_layer_ = false;
858 873
859 } // namespace exo 874 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698