[email protected] | 92d45780 | 2013-04-01 19:18:49 | [diff] [blame^] | 1 | // Copyright (c) 2013 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 CONTENT_RENDERER_INTERNAL_DOCUMENT_STATE_DATA_H_ |
| 6 | #define CONTENT_RENDERER_INTERNAL_DOCUMENT_STATE_DATA_H_ |
| 7 | |
| 8 | #include "base/supports_user_data.h" |
| 9 | |
| 10 | namespace WebKit { |
| 11 | class WebDataSource; |
| 12 | } |
| 13 | |
| 14 | namespace content { |
| 15 | |
| 16 | // Stores internal state per WebDataSource. |
| 17 | class InternalDocumentStateData : public base::SupportsUserData::Data { |
| 18 | public: |
| 19 | InternalDocumentStateData(); |
| 20 | |
| 21 | static InternalDocumentStateData* FromDataSource(WebKit::WebDataSource* ds); |
| 22 | |
| 23 | // Set to true once RenderViewImpl::didFirstVisuallyNonEmptyLayout() is |
| 24 | // invoked. |
| 25 | bool did_first_visually_non_empty_layout() const { |
| 26 | return did_first_visually_non_empty_layout_; |
| 27 | } |
| 28 | void set_did_first_visually_non_empty_layout(bool value) { |
| 29 | did_first_visually_non_empty_layout_ = value; |
| 30 | } |
| 31 | |
| 32 | // Set to true once RenderViewImpl::DidFlushPaint() is inovked after |
| 33 | // RenderViewImpl::didFirstVisuallyNonEmptyLayout(). In other words after the |
| 34 | // page has painted something. |
| 35 | bool did_first_visually_non_empty_paint() const { |
| 36 | return did_first_visually_non_empty_paint_; |
| 37 | } |
| 38 | void set_did_first_visually_non_empty_paint(bool value) { |
| 39 | did_first_visually_non_empty_paint_ = value; |
| 40 | } |
| 41 | |
| 42 | protected: |
| 43 | virtual ~InternalDocumentStateData(); |
| 44 | |
| 45 | private: |
| 46 | bool did_first_visually_non_empty_layout_; |
| 47 | bool did_first_visually_non_empty_paint_; |
| 48 | |
| 49 | DISALLOW_COPY_AND_ASSIGN(InternalDocumentStateData); |
| 50 | }; |
| 51 | |
| 52 | } // namespace content |
| 53 | |
| 54 | #endif // CONTENT_RENDERER_INTERNAL_DOCUMENT_STATE_DATA_H_ |