OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_ |
6 #define CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_ | 6 #define CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/supports_user_data.h" | 12 #include "base/supports_user_data.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "net/http/http_response_info.h" | 15 #include "net/http/http_response_info.h" |
16 #include "third_party/WebKit/public/web/WebDataSource.h" | 16 #include "third_party/WebKit/public/web/WebDataSource.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class NavigationState; | 20 class NavigationState; |
21 | 21 |
22 // The RenderView stores an instance of this class in the "extra data" of each | 22 // The RenderView stores an instance of this class in the "extra data" of each |
23 // WebDataSource (see RenderView::DidCreateDataSource). | 23 // WebDataSource (see RenderView::DidCreateDataSource). |
24 class CONTENT_EXPORT DocumentState | 24 class CONTENT_EXPORT DocumentState |
25 : NON_EXPORTED_BASE(public WebKit::WebDataSource::ExtraData), | 25 : NON_EXPORTED_BASE(public blink::WebDataSource::ExtraData), |
26 public base::SupportsUserData { | 26 public base::SupportsUserData { |
27 public: | 27 public: |
28 // The exact values of this enum are used in histograms, so new values must be | 28 // The exact values of this enum are used in histograms, so new values must be |
29 // added to the end. | 29 // added to the end. |
30 enum LoadType { | 30 enum LoadType { |
31 UNDEFINED_LOAD, // Not yet initialized. | 31 UNDEFINED_LOAD, // Not yet initialized. |
32 RELOAD, // User pressed reload. | 32 RELOAD, // User pressed reload. |
33 HISTORY_LOAD, // Back or forward. | 33 HISTORY_LOAD, // Back or forward. |
34 NORMAL_LOAD, // User entered URL, or omnibox search. | 34 NORMAL_LOAD, // User entered URL, or omnibox search. |
35 LINK_LOAD, // (deprecated) Included next 4 categories. | 35 LINK_LOAD, // (deprecated) Included next 4 categories. |
36 LINK_LOAD_NORMAL, // Commonly following of link. | 36 LINK_LOAD_NORMAL, // Commonly following of link. |
37 LINK_LOAD_RELOAD, // JS/link directed reload. | 37 LINK_LOAD_RELOAD, // JS/link directed reload. |
38 LINK_LOAD_CACHE_STALE_OK, // back/forward or encoding change. | 38 LINK_LOAD_CACHE_STALE_OK, // back/forward or encoding change. |
39 LINK_LOAD_CACHE_ONLY, // Allow stale data (avoid doing a re-post) | 39 LINK_LOAD_CACHE_ONLY, // Allow stale data (avoid doing a re-post) |
40 kLoadTypeMax // Bounding value for this enum. | 40 kLoadTypeMax // Bounding value for this enum. |
41 }; | 41 }; |
42 | 42 |
43 DocumentState(); | 43 DocumentState(); |
44 virtual ~DocumentState(); | 44 virtual ~DocumentState(); |
45 | 45 |
46 static DocumentState* FromDataSource(WebKit::WebDataSource* ds) { | 46 static DocumentState* FromDataSource(blink::WebDataSource* ds) { |
47 return static_cast<DocumentState*>(ds->extraData()); | 47 return static_cast<DocumentState*>(ds->extraData()); |
48 } | 48 } |
49 | 49 |
50 // The time that this navigation was requested. | 50 // The time that this navigation was requested. |
51 const base::Time& request_time() const { | 51 const base::Time& request_time() const { |
52 return request_time_; | 52 return request_time_; |
53 } | 53 } |
54 void set_request_time(const base::Time& value) { | 54 void set_request_time(const base::Time& value) { |
55 DCHECK(start_load_time_.is_null()); | 55 DCHECK(start_load_time_.is_null()); |
56 request_time_ = value; | 56 request_time_ = value; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 LoadType load_type_; | 213 LoadType load_type_; |
214 | 214 |
215 scoped_ptr<NavigationState> navigation_state_; | 215 scoped_ptr<NavigationState> navigation_state_; |
216 | 216 |
217 bool can_load_local_resources_; | 217 bool can_load_local_resources_; |
218 }; | 218 }; |
219 | 219 |
220 #endif // CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_ | 220 #endif // CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_ |
221 | 221 |
222 } // namespace content | 222 } // namespace content |
OLD | NEW |