OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 10 matching lines...) Expand all Loading... |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef LinkImport_h | 31 #ifndef FrameHost_h |
32 #define LinkImport_h | 32 #define FrameHost_h |
33 | 33 |
34 #include "core/html/HTMLImportChildClient.h" | |
35 #include "core/html/LinkResource.h" | |
36 #include "wtf/FastAllocBase.h" | 34 #include "wtf/FastAllocBase.h" |
| 35 #include "wtf/Noncopyable.h" |
37 #include "wtf/PassOwnPtr.h" | 36 #include "wtf/PassOwnPtr.h" |
38 #include "wtf/RefPtr.h" | |
39 | 37 |
40 namespace WebCore { | 38 namespace WebCore { |
41 | 39 |
42 class Document; | 40 class Page; |
43 class HTMLImportChild; | 41 class Chrome; |
| 42 class Settings; |
44 | 43 |
45 // | 44 // FrameHost is the set of global data shared between multiple frames |
46 // A LinkResource subclasss used for @rel=import. | 45 // and is provided by the embedder to each frame when created. |
47 // | 46 // FrameHost currently corresponds to the Page object in core/page |
48 class LinkImport : public LinkResource, public HTMLImportChildClient { | 47 // however the concept of a Page is moving up out of Blink. |
49 WTF_MAKE_FAST_ALLOCATED; | 48 // In an out-of-process iframe world, a single Page may have |
| 49 // multiple frames in different process, thus Page becomes a |
| 50 // browser-level concept and Blink core/ only knows about its Frame (and FrameHo
st). |
| 51 // Separating Page from the rest of core/ through this indirection |
| 52 // allows us to slowly refactor Page without breaking the rest of core. |
| 53 class FrameHost { |
| 54 WTF_MAKE_NONCOPYABLE(FrameHost); WTF_MAKE_FAST_ALLOCATED; |
50 public: | 55 public: |
| 56 static PassOwnPtr<FrameHost> create(Page&); |
51 | 57 |
52 static PassOwnPtr<LinkImport> create(HTMLLinkElement* owner); | 58 // Careful: This function will eventually be removed. |
| 59 Page& page() const { return m_page; } |
53 | 60 |
54 explicit LinkImport(HTMLLinkElement* owner); | 61 Settings& settings() const; |
55 virtual ~LinkImport(); | 62 Chrome& chrome() const; |
56 | 63 |
57 // LinkResource | 64 // Corresponds to pixel density of the device where this Page is |
58 virtual void process() OVERRIDE; | 65 // being displayed. In multi-monitor setups this can vary between pages. |
59 virtual Type type() const OVERRIDE { return Import; } | 66 // This value does not account for Page zoom, use Frame::devicePixelRatio in
stead. |
60 virtual void ownerRemoved() OVERRIDE; | 67 float deviceScaleFactor() const; |
61 virtual bool hasLoaded() const OVERRIDE; | |
62 | |
63 // HTMLImportChildClient | |
64 virtual void didFinish() OVERRIDE; | |
65 virtual void importWillBeDestroyed() OVERRIDE; | |
66 | |
67 Document* importedDocument() const; | |
68 | 68 |
69 private: | 69 private: |
70 void clear(); | 70 explicit FrameHost(Page&); |
71 | 71 |
72 HTMLImportChild* m_loader; | 72 Page& m_page; |
73 }; | 73 }; |
74 | 74 |
75 } // namespace WebCore | 75 } |
76 | 76 |
77 #endif // LinkImport_h | 77 #endif // FrameHost_h |
OLD | NEW |