| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * | 10 * |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include <memory> | 37 #include <memory> |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 class GraphicsContext; | 41 class GraphicsContext; |
| 42 class WebViewImpl; | 42 class WebViewImpl; |
| 43 | 43 |
| 44 // Manages a layer that is overlaid on a WebView's content. | 44 // Manages a layer that is overlaid on a WebView's content. |
| 45 class WEB_EXPORT PageOverlay : public GraphicsLayerClient, public DisplayItemCli
ent { | 45 class WEB_EXPORT PageOverlay : public GraphicsLayerClient, public DisplayItemCli
ent { |
| 46 public: | 46 public: |
| 47 class Delegate : public GarbageCollectedFinalized<Delegate> { | 47 class Delegate { |
| 48 public: | 48 public: |
| 49 DEFINE_INLINE_VIRTUAL_TRACE() { } | 49 virtual ~Delegate() { } |
| 50 | 50 |
| 51 // Paints page overlay contents. | 51 // Paints page overlay contents. |
| 52 virtual void paintPageOverlay(const PageOverlay&, GraphicsContext&, cons
t WebSize& webViewSize) const = 0; | 52 virtual void paintPageOverlay(const PageOverlay&, GraphicsContext&, cons
t WebSize& webViewSize) const = 0; |
| 53 virtual ~Delegate() { } | |
| 54 }; | 53 }; |
| 55 | 54 |
| 56 static std::unique_ptr<PageOverlay> create(WebViewImpl*, PageOverlay::Delega
te*); | 55 static std::unique_ptr<PageOverlay> create(WebViewImpl*, std::unique_ptr<Pag
eOverlay::Delegate>); |
| 57 | 56 |
| 58 ~PageOverlay(); | 57 ~PageOverlay(); |
| 59 | 58 |
| 60 void update(); | 59 void update(); |
| 61 | 60 |
| 62 GraphicsLayer* graphicsLayer() const { return m_layer.get(); } | 61 GraphicsLayer* graphicsLayer() const { return m_layer.get(); } |
| 63 | 62 |
| 64 // DisplayItemClient methods. | 63 // DisplayItemClient methods. |
| 65 String debugName() const final { return "PageOverlay"; } | 64 String debugName() const final { return "PageOverlay"; } |
| 66 LayoutRect visualRect() const override; | 65 LayoutRect visualRect() const override; |
| 67 | 66 |
| 68 // GraphicsLayerClient implementation | 67 // GraphicsLayerClient implementation |
| 69 bool needsRepaint(const GraphicsLayer&) const { return true; } | 68 bool needsRepaint(const GraphicsLayer&) const { return true; } |
| 70 IntRect computeInterestRect(const GraphicsLayer*, const IntRect&) const over
ride; | 69 IntRect computeInterestRect(const GraphicsLayer*, const IntRect&) const over
ride; |
| 71 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain
tingPhase, const IntRect& interestRect) const override; | 70 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain
tingPhase, const IntRect& interestRect) const override; |
| 72 String debugName(const GraphicsLayer*) const override; | 71 String debugName(const GraphicsLayer*) const override; |
| 73 | 72 |
| 74 private: | 73 private: |
| 75 PageOverlay(WebViewImpl*, PageOverlay::Delegate*); | 74 PageOverlay(WebViewImpl*, std::unique_ptr<PageOverlay::Delegate>); |
| 76 | 75 |
| 77 WebViewImpl* m_viewImpl; | 76 WebViewImpl* m_viewImpl; |
| 78 Persistent<PageOverlay::Delegate> m_delegate; | 77 std::unique_ptr<PageOverlay::Delegate> m_delegate; |
| 79 std::unique_ptr<GraphicsLayer> m_layer; | 78 std::unique_ptr<GraphicsLayer> m_layer; |
| 80 }; | 79 }; |
| 81 | 80 |
| 82 } // namespace blink | 81 } // namespace blink |
| 83 | 82 |
| 84 #endif // PageOverlay_h | 83 #endif // PageOverlay_h |
| OLD | NEW |