| 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 21 matching lines...) Expand all Loading... |
| 32 #include <memory> | 32 #include <memory> |
| 33 #include "platform/graphics/GraphicsLayer.h" | 33 #include "platform/graphics/GraphicsLayer.h" |
| 34 #include "platform/graphics/GraphicsLayerClient.h" | 34 #include "platform/graphics/GraphicsLayerClient.h" |
| 35 #include "platform/graphics/paint/DisplayItemClient.h" | 35 #include "platform/graphics/paint/DisplayItemClient.h" |
| 36 #include "platform/wtf/text/WTFString.h" | 36 #include "platform/wtf/text/WTFString.h" |
| 37 #include "web/WebExport.h" | 37 #include "web/WebExport.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 class GraphicsContext; | 41 class GraphicsContext; |
| 42 class WebLocalFrameImpl; | 42 class WebLocalFrameBase; |
| 43 | 43 |
| 44 // Manages a layer that is overlaid on a WebLocalFrame's content. | 44 // Manages a layer that is overlaid on a WebLocalFrame's content. |
| 45 class WEB_EXPORT PageOverlay : public GraphicsLayerClient, | 45 class WEB_EXPORT PageOverlay : public GraphicsLayerClient, |
| 46 public DisplayItemClient { | 46 public DisplayItemClient { |
| 47 public: | 47 public: |
| 48 class Delegate { | 48 class Delegate { |
| 49 public: | 49 public: |
| 50 virtual ~Delegate() {} | 50 virtual ~Delegate() {} |
| 51 | 51 |
| 52 // Paints page overlay contents. | 52 // Paints page overlay contents. |
| 53 virtual void PaintPageOverlay(const PageOverlay&, | 53 virtual void PaintPageOverlay(const PageOverlay&, |
| 54 GraphicsContext&, | 54 GraphicsContext&, |
| 55 const WebSize& web_view_size) const = 0; | 55 const WebSize& web_view_size) const = 0; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 static std::unique_ptr<PageOverlay> Create( | 58 static std::unique_ptr<PageOverlay> Create( |
| 59 WebLocalFrameImpl*, | 59 WebLocalFrameBase*, |
| 60 std::unique_ptr<PageOverlay::Delegate>); | 60 std::unique_ptr<PageOverlay::Delegate>); |
| 61 | 61 |
| 62 ~PageOverlay(); | 62 ~PageOverlay(); |
| 63 | 63 |
| 64 void Update(); | 64 void Update(); |
| 65 | 65 |
| 66 GraphicsLayer* GetGraphicsLayer() const { return layer_.get(); } | 66 GraphicsLayer* GetGraphicsLayer() const { return layer_.get(); } |
| 67 | 67 |
| 68 // DisplayItemClient methods. | 68 // DisplayItemClient methods. |
| 69 String DebugName() const final { return "PageOverlay"; } | 69 String DebugName() const final { return "PageOverlay"; } |
| 70 LayoutRect VisualRect() const override; | 70 LayoutRect VisualRect() const override; |
| 71 | 71 |
| 72 // GraphicsLayerClient implementation | 72 // GraphicsLayerClient implementation |
| 73 bool NeedsRepaint(const GraphicsLayer&) const { return true; } | 73 bool NeedsRepaint(const GraphicsLayer&) const { return true; } |
| 74 IntRect ComputeInterestRect(const GraphicsLayer*, | 74 IntRect ComputeInterestRect(const GraphicsLayer*, |
| 75 const IntRect&) const override; | 75 const IntRect&) const override; |
| 76 void PaintContents(const GraphicsLayer*, | 76 void PaintContents(const GraphicsLayer*, |
| 77 GraphicsContext&, | 77 GraphicsContext&, |
| 78 GraphicsLayerPaintingPhase, | 78 GraphicsLayerPaintingPhase, |
| 79 const IntRect& interest_rect) const override; | 79 const IntRect& interest_rect) const override; |
| 80 String DebugName(const GraphicsLayer*) const override; | 80 String DebugName(const GraphicsLayer*) const override; |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 PageOverlay(WebLocalFrameImpl*, std::unique_ptr<PageOverlay::Delegate>); | 83 PageOverlay(WebLocalFrameBase*, std::unique_ptr<PageOverlay::Delegate>); |
| 84 | 84 |
| 85 Persistent<WebLocalFrameImpl> frame_impl_; | 85 Persistent<WebLocalFrameBase> frame_impl_; |
| 86 std::unique_ptr<PageOverlay::Delegate> delegate_; | 86 std::unique_ptr<PageOverlay::Delegate> delegate_; |
| 87 std::unique_ptr<GraphicsLayer> layer_; | 87 std::unique_ptr<GraphicsLayer> layer_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace blink | 90 } // namespace blink |
| 91 | 91 |
| 92 #endif // PageOverlay_h | 92 #endif // PageOverlay_h |
| OLD | NEW |