| 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 27 matching lines...) Expand all Loading... |
| 38 #include "wtf/OwnPtr.h" | 38 #include "wtf/OwnPtr.h" |
| 39 #include "wtf/PassOwnPtr.h" | 39 #include "wtf/PassOwnPtr.h" |
| 40 #include "wtf/text/AtomicString.h" | 40 #include "wtf/text/AtomicString.h" |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 class ChromeClient; | 44 class ChromeClient; |
| 45 class ConsoleMessageStorage; | 45 class ConsoleMessageStorage; |
| 46 class Deprecation; | 46 class Deprecation; |
| 47 class EventHandlerRegistry; | 47 class EventHandlerRegistry; |
| 48 class OverscrollController; |
| 48 class Page; | 49 class Page; |
| 49 struct PageScaleConstraints; | 50 struct PageScaleConstraints; |
| 50 class PageScaleConstraintsSet; | 51 class PageScaleConstraintsSet; |
| 51 class Settings; | 52 class Settings; |
| 52 class TopControls; | 53 class TopControls; |
| 53 class UseCounter; | 54 class UseCounter; |
| 54 class Visitor; | 55 class Visitor; |
| 55 class VisualViewport; | 56 class VisualViewport; |
| 56 | 57 |
| 57 // FrameHost is the set of global data shared between multiple frames | 58 // FrameHost is the set of global data shared between multiple frames |
| 58 // and is provided by the embedder to each frame when created. | 59 // and is provided by the embedder to each frame when created. |
| 59 // FrameHost currently corresponds to the Page object in core/page | 60 // FrameHost currently corresponds to the Page object in core/page |
| 60 // however the concept of a Page is moving up out of Blink. | 61 // however the concept of a Page is moving up out of Blink. |
| 61 // In an out-of-process iframe world, a single Page may have | 62 // In an out-of-process iframe world, a single Page may have |
| 62 // multiple frames in different process, thus Page becomes a | 63 // multiple frames in different process, thus Page becomes a |
| 63 // browser-level concept and Blink core/ only knows about its LocalFrame (and Fr
ameHost). | 64 // browser-level concept and Blink core/ only knows about its LocalFrame (and Fr
ameHost). |
| 64 // Separating Page from the rest of core/ through this indirection | 65 // Separating Page from the rest of core/ through this indirection |
| 65 // allows us to slowly refactor Page without breaking the rest of core. | 66 // allows us to slowly refactor Page without breaking the rest of core. |
| 66 class CORE_EXPORT FrameHost final : public GarbageCollectedFinalized<FrameHost>
{ | 67 class CORE_EXPORT FrameHost final : public GarbageCollectedFinalized<FrameHost>
{ |
| 67 WTF_MAKE_NONCOPYABLE(FrameHost); | 68 WTF_MAKE_NONCOPYABLE(FrameHost); |
| 68 public: | 69 public: |
| 69 static FrameHost* create(Page&); | 70 static FrameHost* create(Page&); |
| 70 ~FrameHost(); | 71 ~FrameHost(); |
| 71 | 72 |
| 72 // Careful: This function will eventually be removed. | 73 // Careful: This function will eventually be removed. |
| 73 Page& page() const { return *m_page; } | 74 Page& page(); |
| 74 Settings& settings() const; | 75 const Page& page() const; |
| 75 ChromeClient& chromeClient() const; | 76 |
| 76 UseCounter& useCounter() const; | 77 Settings& settings(); |
| 77 Deprecation& deprecation() const; | 78 const Settings& settings() const; |
| 79 |
| 80 ChromeClient& chromeClient(); |
| 81 const ChromeClient& chromeClient() const; |
| 82 |
| 83 UseCounter& useCounter(); |
| 84 const UseCounter& useCounter() const; |
| 85 |
| 86 Deprecation& deprecation(); |
| 87 const Deprecation& deprecation() const; |
| 78 | 88 |
| 79 // Corresponds to pixel density of the device where this Page is | 89 // Corresponds to pixel density of the device where this Page is |
| 80 // being displayed. In multi-monitor setups this can vary between pages. | 90 // being displayed. In multi-monitor setups this can vary between pages. |
| 81 // This value does not account for Page zoom, use LocalFrame::devicePixelRat
io instead. | 91 // This value does not account for Page zoom, use LocalFrame::devicePixelRat
io instead. |
| 82 float deviceScaleFactor() const; | 92 float deviceScaleFactor() const; |
| 83 | 93 |
| 84 TopControls& topControls() const; | 94 TopControls& topControls(); |
| 85 VisualViewport& visualViewport() const; | 95 const TopControls& topControls() const; |
| 86 PageScaleConstraintsSet& pageScaleConstraintsSet() const; | 96 |
| 87 EventHandlerRegistry& eventHandlerRegistry() const; | 97 OverscrollController& overscrollController(); |
| 98 const OverscrollController& overscrollController() const; |
| 99 |
| 100 VisualViewport& visualViewport(); |
| 101 const VisualViewport& visualViewport() const; |
| 102 |
| 103 PageScaleConstraintsSet& pageScaleConstraintsSet(); |
| 104 const PageScaleConstraintsSet& pageScaleConstraintsSet() const; |
| 105 |
| 106 EventHandlerRegistry& eventHandlerRegistry(); |
| 107 const EventHandlerRegistry& eventHandlerRegistry() const; |
| 88 | 108 |
| 89 const AtomicString& overrideEncoding() const { return m_overrideEncoding; } | 109 const AtomicString& overrideEncoding() const { return m_overrideEncoding; } |
| 90 void setOverrideEncoding(const AtomicString& encoding) { m_overrideEncoding
= encoding; } | 110 void setOverrideEncoding(const AtomicString& encoding) { m_overrideEncoding
= encoding; } |
| 91 | 111 |
| 92 ConsoleMessageStorage& consoleMessageStorage() const; | 112 ConsoleMessageStorage& consoleMessageStorage(); |
| 113 const ConsoleMessageStorage& consoleMessageStorage() const; |
| 93 | 114 |
| 94 DECLARE_TRACE(); | 115 DECLARE_TRACE(); |
| 95 | 116 |
| 96 // Don't allow more than a certain number of frames in a page. | 117 // Don't allow more than a certain number of frames in a page. |
| 97 // This seems like a reasonable upper bound, and otherwise mutually | 118 // This seems like a reasonable upper bound, and otherwise mutually |
| 98 // recursive frameset pages can quickly bring the program to its knees | 119 // recursive frameset pages can quickly bring the program to its knees |
| 99 // with exponential growth in the number of frames. | 120 // with exponential growth in the number of frames. |
| 100 static const int maxNumberOfFrames = 1000; | 121 static const int maxNumberOfFrames = 1000; |
| 101 void incrementSubframeCount() { ++m_subframeCount; } | 122 void incrementSubframeCount() { ++m_subframeCount; } |
| 102 void decrementSubframeCount() { ASSERT(m_subframeCount); --m_subframeCount;
} | 123 void decrementSubframeCount() { ASSERT(m_subframeCount); --m_subframeCount;
} |
| 103 int subframeCount() const; | 124 int subframeCount() const; |
| 104 | 125 |
| 105 void setDefaultPageScaleLimits(float minScale, float maxScale); | 126 void setDefaultPageScaleLimits(float minScale, float maxScale); |
| 106 void setUserAgentPageScaleConstraints(const PageScaleConstraints& newConstra
ints); | 127 void setUserAgentPageScaleConstraints(const PageScaleConstraints& newConstra
ints); |
| 107 | 128 |
| 108 private: | 129 private: |
| 109 explicit FrameHost(Page&); | 130 explicit FrameHost(Page&); |
| 110 | 131 |
| 111 Member<Page> m_page; | 132 const Member<Page> m_page; |
| 112 const Member<TopControls> m_topControls; | 133 const Member<TopControls> m_topControls; |
| 113 const OwnPtr<PageScaleConstraintsSet> m_pageScaleConstraintsSet; | 134 const OwnPtr<PageScaleConstraintsSet> m_pageScaleConstraintsSet; |
| 114 const Member<VisualViewport> m_visualViewport; | 135 const Member<VisualViewport> m_visualViewport; |
| 136 const Member<OverscrollController> m_overscrollController; |
| 115 const Member<EventHandlerRegistry> m_eventHandlerRegistry; | 137 const Member<EventHandlerRegistry> m_eventHandlerRegistry; |
| 116 const Member<ConsoleMessageStorage> m_consoleMessageStorage; | 138 const Member<ConsoleMessageStorage> m_consoleMessageStorage; |
| 117 | 139 |
| 118 AtomicString m_overrideEncoding; | 140 AtomicString m_overrideEncoding; |
| 119 int m_subframeCount; | 141 int m_subframeCount; |
| 120 }; | 142 }; |
| 121 | 143 |
| 122 } // namespace blink | 144 } // namespace blink |
| 123 | 145 |
| 124 #endif // FrameHost_h | 146 #endif // FrameHost_h |
| OLD | NEW |