| 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 #ifndef COMPONENTS_EXO_SURFACE_H_ | 5 #ifndef COMPONENTS_EXO_SURFACE_H_ |
| 6 #define COMPONENTS_EXO_SURFACE_H_ | 6 #define COMPONENTS_EXO_SURFACE_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> |
| 10 #include <utility> | 11 #include <utility> |
| 11 | 12 |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 16 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 17 #include "cc/surfaces/surface_factory_client.h" | 18 #include "cc/surfaces/surface_factory_client.h" |
| 18 #include "third_party/skia/include/core/SkRegion.h" | 19 #include "third_party/skia/include/core/SkRegion.h" |
| 19 #include "third_party/skia/include/core/SkXfermode.h" | 20 #include "third_party/skia/include/core/SkXfermode.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 32 class SurfaceFactory; | 33 class SurfaceFactory; |
| 33 enum class SurfaceDrawStatus; | 34 enum class SurfaceDrawStatus; |
| 34 } | 35 } |
| 35 | 36 |
| 36 namespace gfx { | 37 namespace gfx { |
| 37 class Path; | 38 class Path; |
| 38 } | 39 } |
| 39 | 40 |
| 40 namespace exo { | 41 namespace exo { |
| 41 class Buffer; | 42 class Buffer; |
| 43 class Pointer; |
| 42 class SurfaceDelegate; | 44 class SurfaceDelegate; |
| 43 class SurfaceObserver; | 45 class SurfaceObserver; |
| 44 class Surface; | 46 class Surface; |
| 45 | 47 |
| 48 // The pointer class is currently the only cursor provider class but this can |
| 49 // change in the future when better hardware cursor support is added. |
| 50 using CursorProvider = Pointer; |
| 51 |
| 46 // This class owns the SurfaceFactory and keeps track of references to the | 52 // This class owns the SurfaceFactory and keeps track of references to the |
| 47 // contents of Buffers. It's keeped alive by references from | 53 // contents of Buffers. It's keeped alive by references from |
| 48 // release_callbacks_. It's destroyed when its owning Surface is destroyed and | 54 // release_callbacks_. It's destroyed when its owning Surface is destroyed and |
| 49 // the last outstanding release callback is called. | 55 // the last outstanding release callback is called. |
| 50 class SurfaceFactoryOwner : public base::RefCounted<SurfaceFactoryOwner>, | 56 class SurfaceFactoryOwner : public base::RefCounted<SurfaceFactoryOwner>, |
| 51 public cc::SurfaceFactoryClient { | 57 public cc::SurfaceFactoryClient { |
| 52 public: | 58 public: |
| 53 SurfaceFactoryOwner(); | 59 SurfaceFactoryOwner(); |
| 54 | 60 |
| 55 // Overridden from cc::SurfaceFactoryClient: | 61 // Overridden from cc::SurfaceFactoryClient: |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Returns true if the current input region is different than the surface | 166 // Returns true if the current input region is different than the surface |
| 161 // bounds. | 167 // bounds. |
| 162 bool HasHitTestMask() const; | 168 bool HasHitTestMask() const; |
| 163 | 169 |
| 164 // Returns the current input region of surface in the form of a hit-test mask. | 170 // Returns the current input region of surface in the form of a hit-test mask. |
| 165 void GetHitTestMask(gfx::Path* mask) const; | 171 void GetHitTestMask(gfx::Path* mask) const; |
| 166 | 172 |
| 167 // Returns the bounds of the surface area that is not know to be transparent. | 173 // Returns the bounds of the surface area that is not know to be transparent. |
| 168 gfx::Rect GetNonTransparentBounds() const; | 174 gfx::Rect GetNonTransparentBounds() const; |
| 169 | 175 |
| 176 // Surface does not own cursor providers. It is the responsibility of the |
| 177 // caller to remove the cursor provider before it is destroyed. |
| 178 void RegisterCursorProvider(CursorProvider* provider); |
| 179 void UnregisterCursorProvider(CursorProvider* provider); |
| 180 |
| 181 // Returns true if surface has at least one cursor provider registered. |
| 182 bool HasCursorProvider() const; |
| 183 |
| 170 // Set the surface delegate. | 184 // Set the surface delegate. |
| 171 void SetSurfaceDelegate(SurfaceDelegate* delegate); | 185 void SetSurfaceDelegate(SurfaceDelegate* delegate); |
| 172 | 186 |
| 173 // Returns true if surface has been assigned a surface delegate. | 187 // Returns true if surface has been assigned a surface delegate. |
| 174 bool HasSurfaceDelegate() const; | 188 bool HasSurfaceDelegate() const; |
| 175 | 189 |
| 176 // Surface does not own observers. It is the responsibility of the observer | 190 // Surface does not own observers. It is the responsibility of the observer |
| 177 // to remove itself when it is done observing. | 191 // to remove itself when it is done observing. |
| 178 void AddSurfaceObserver(SurfaceObserver* observer); | 192 void AddSurfaceObserver(SurfaceObserver* observer); |
| 179 void RemoveSurfaceObserver(SurfaceObserver* observer); | 193 void RemoveSurfaceObserver(SurfaceObserver* observer); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // callbacks when compositing successfully ends. | 312 // callbacks when compositing successfully ends. |
| 299 base::TimeTicks last_compositing_start_time_; | 313 base::TimeTicks last_compositing_start_time_; |
| 300 | 314 |
| 301 // This is true when the contents of the surface should be updated next time | 315 // This is true when the contents of the surface should be updated next time |
| 302 // the compositor successfully ends compositing. | 316 // the compositor successfully ends compositing. |
| 303 bool update_contents_after_successful_compositing_; | 317 bool update_contents_after_successful_compositing_; |
| 304 | 318 |
| 305 // The compsitor being observer or null if not observing a compositor. | 319 // The compsitor being observer or null if not observing a compositor. |
| 306 ui::Compositor* compositor_; | 320 ui::Compositor* compositor_; |
| 307 | 321 |
| 322 // Cursor providers. Surface does not own the cursor providers. |
| 323 std::set<CursorProvider*> cursor_providers_; |
| 324 |
| 308 // This can be set to have some functions delegated. E.g. ShellSurface class | 325 // This can be set to have some functions delegated. E.g. ShellSurface class |
| 309 // can set this to handle Commit() and apply any double buffered state it | 326 // can set this to handle Commit() and apply any double buffered state it |
| 310 // maintains. | 327 // maintains. |
| 311 SurfaceDelegate* delegate_; | 328 SurfaceDelegate* delegate_; |
| 312 | 329 |
| 313 // Surface observer list. Surface does not own the observers. | 330 // Surface observer list. Surface does not own the observers. |
| 314 base::ObserverList<SurfaceObserver, true> observers_; | 331 base::ObserverList<SurfaceObserver, true> observers_; |
| 315 | 332 |
| 316 DISALLOW_COPY_AND_ASSIGN(Surface); | 333 DISALLOW_COPY_AND_ASSIGN(Surface); |
| 317 }; | 334 }; |
| 318 | 335 |
| 319 } // namespace exo | 336 } // namespace exo |
| 320 | 337 |
| 321 #endif // COMPONENTS_EXO_SURFACE_H_ | 338 #endif // COMPONENTS_EXO_SURFACE_H_ |
| OLD | NEW |