OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_EXO_NOTIFICATION_SURFACE_IMPL_H_ |
| 6 #define COMPONENTS_EXO_NOTIFICATION_SURFACE_IMPL_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "components/exo/notification_surface.h" |
| 13 #include "components/exo/surface_delegate.h" |
| 14 #include "components/exo/surface_observer.h" |
| 15 #include "ui/gfx/geometry/size.h" |
| 16 |
| 17 namespace aura { |
| 18 class Window; |
| 19 } |
| 20 |
| 21 namespace exo { |
| 22 class NotificationSurfaceManager; |
| 23 class Surface; |
| 24 |
| 25 // Handles notification surface role of a given surface. |
| 26 class NotificationSurfaceImpl : public NotificationSurface, |
| 27 public SurfaceDelegate, |
| 28 public SurfaceObserver { |
| 29 public: |
| 30 NotificationSurfaceImpl(NotificationSurfaceManager* manager, |
| 31 Surface* surface, |
| 32 const std::string& notification_id); |
| 33 ~NotificationSurfaceImpl() override; |
| 34 |
| 35 gfx::Size GetSize() const override; |
| 36 void AttachWindow(views::NativeViewHost* nvh) override; |
| 37 |
| 38 aura::Window* GetWindow() const override; |
| 39 const std::string& GetNotificationId() const override; |
| 40 |
| 41 // Overridden from SurfaceDelegate: |
| 42 void OnSurfaceCommit() override; |
| 43 bool IsSurfaceSynchronized() const override; |
| 44 |
| 45 // Overridden from SurfaceObserver: |
| 46 void OnSurfaceDestroying(Surface* surface) override; |
| 47 |
| 48 private: |
| 49 NotificationSurfaceManager* const manager_; // Not owned. |
| 50 Surface* surface_; // Not owned. |
| 51 const std::string notification_id_; |
| 52 |
| 53 std::unique_ptr<aura::Window> window_; |
| 54 bool added_to_manager_ = false; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(NotificationSurfaceImpl); |
| 57 }; |
| 58 |
| 59 } // namespace exo |
| 60 |
| 61 #endif // COMPONENTS_EXO_NOTIFICATION_SURFACE_IMPL_H_ |
OLD | NEW |