Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Unified Diff: content/public/renderer/document_state.h

Issue 8404018: chrome.loadTimes() shouldn't be affected by in-document navigation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and merge Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_renderer.gypi ('k') | content/public/renderer/document_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/renderer/document_state.h
diff --git a/content/public/renderer/navigation_state.h b/content/public/renderer/document_state.h
similarity index 73%
copy from content/public/renderer/navigation_state.h
copy to content/public/renderer/document_state.h
index 30ccd01198f4afa195010fb89d098357fe48c1ec..ee6fa585b129e45748dcde276a1e7df44712e021 100644
--- a/content/public/renderer/navigation_state.h
+++ b/content/public/renderer/document_state.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_
-#define CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_
+#ifndef CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_
+#define CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_
#pragma once
#include <string>
@@ -11,7 +11,6 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
-#include "content/public/common/page_transition_types.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h"
@@ -22,9 +21,11 @@ class AltErrorPageResourceFetcher;
namespace content {
+class NavigationState;
+
// The RenderView stores an instance of this class in the "extra data" of each
// WebDataSource (see RenderView::DidCreateDataSource).
-class NavigationState : public WebKit::WebDataSource::ExtraData {
+class DocumentState : public WebKit::WebDataSource::ExtraData {
public:
// The exact values of this enum are used in histograms, so new values must be
// added to the end.
@@ -41,48 +42,13 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
kLoadTypeMax // Bounding value for this enum.
};
- virtual ~NavigationState();
-
- static NavigationState* CreateBrowserInitiated(
- int32 pending_page_id,
- int pending_history_list_offset,
- content::PageTransition transition_type,
- base::Time request_time) {
- return new NavigationState(transition_type, request_time, false,
- pending_page_id,
- pending_history_list_offset);
- }
-
- static NavigationState* CreateContentInitiated() {
- // We assume navigations initiated by content are link clicks.
- return new NavigationState(
- content::PAGE_TRANSITION_LINK, base::Time(), true, -1, -1);
- }
-
- static NavigationState* FromDataSource(WebKit::WebDataSource* ds) {
- return static_cast<NavigationState*>(ds->extraData());
- }
-
- // Contains the page_id for this navigation or -1 if there is none yet.
- int32 pending_page_id() const { return pending_page_id_; }
+ DocumentState();
+ virtual ~DocumentState();
- // If pending_page_id() is not -1, then this contains the corresponding
- // offset of the page in the back/forward history list.
- int pending_history_list_offset() const {
- return pending_history_list_offset_;
+ static DocumentState* FromDataSource(WebKit::WebDataSource* ds) {
+ return static_cast<DocumentState*>(ds->extraData());
}
- // Contains the transition type that the browser specified when it
- // initiated the load.
- content::PageTransition transition_type() const { return transition_type_; }
- void set_transition_type(content::PageTransition type) {
- transition_type_ = type;
- }
-
- // Record the nature of this load, for use when histogramming page load times.
- LoadType load_type() const { return load_type_; }
- void set_load_type(LoadType load_type) { load_type_ = load_type; }
-
// The time that this navigation was requested.
const base::Time& request_time() const {
return request_time_;
@@ -142,7 +108,7 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
first_paint_time_ = value;
}
- // The time that painting first happened after the document finished loading.
+ // The time that painting first happened after the document loaded.
const base::Time& first_paint_after_load_time() const {
return first_paint_after_load_time_;
}
@@ -163,13 +129,29 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
web_timing_histograms_recorded_ = value;
}
- // True if we have already processed the "DidCommitLoad" event for this
- // request. Used by session history.
- bool request_committed() const { return request_committed_; }
- void set_request_committed(bool value) { request_committed_ = value; }
+ int http_status_code() const { return http_status_code_; }
+ void set_http_status_code(int http_status_code) {
+ http_status_code_ = http_status_code;
+ }
+
+ // Indicator if SPDY was used as part of this page load.
+ void set_was_fetched_via_spdy(bool value) { was_fetched_via_spdy_ = value; }
+ bool was_fetched_via_spdy() const { return was_fetched_via_spdy_; }
- // True if this navigation was not initiated via WebFrame::LoadRequest.
- bool is_content_initiated() const { return is_content_initiated_; }
+ void set_was_npn_negotiated(bool value) { was_npn_negotiated_ = value; }
+ bool was_npn_negotiated() const { return was_npn_negotiated_; }
+
+ void set_was_alternate_protocol_available(bool value) {
+ was_alternate_protocol_available_ = value;
+ }
+ bool was_alternate_protocol_available() const {
+ return was_alternate_protocol_available_;
+ }
+
+ void set_was_fetched_via_proxy(bool value) {
+ was_fetched_via_proxy_ = value;
+ }
+ bool was_fetched_via_proxy() const { return was_fetched_via_proxy_; }
const GURL& searchable_form_url() const { return searchable_form_url_; }
void set_searchable_form_url(const GURL& url) { searchable_form_url_ = url; }
@@ -185,11 +167,6 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
}
void set_password_form_data(webkit_glue::PasswordForm* data);
- webkit_glue::AltErrorPageResourceFetcher* alt_error_page_fetcher() const {
- return alt_error_page_fetcher_.get();
- }
- void set_alt_error_page_fetcher(webkit_glue::AltErrorPageResourceFetcher* f);
-
const std::string& security_info() const { return security_info_; }
void set_security_info(const std::string& security_info) {
security_info_ = security_info;
@@ -202,11 +179,20 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
use_error_page_ = use_error_page;
}
- int http_status_code() const { return http_status_code_; }
- void set_http_status_code(int http_status_code) {
- http_status_code_ = http_status_code;
+ void set_was_prefetcher(bool value) { was_prefetcher_ = value; }
+ bool was_prefetcher() const { return was_prefetcher_; }
+
+ void set_was_referred_by_prefetcher(bool value) {
+ was_referred_by_prefetcher_ = value;
+ }
+ bool was_referred_by_prefetcher() const {
+ return was_referred_by_prefetcher_;
}
+ // Record the nature of this load, for use when histogramming page load times.
+ LoadType load_type() const { return load_type_; }
+ void set_load_type(LoadType load_type) { load_type_ = load_type; }
+
// Sets the cache policy. The cache policy is only used if explicitly set and
// by default is not set. You can mark a NavigationState as not having a cache
// state by way of clear_cache_policy_override.
@@ -226,52 +212,15 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
return cache_policy_override_set_;
}
- // Indicator if SPDY was used as part of this page load.
- void set_was_fetched_via_spdy(bool value) { was_fetched_via_spdy_ = value; }
- bool was_fetched_via_spdy() const { return was_fetched_via_spdy_; }
-
- void set_was_npn_negotiated(bool value) { was_npn_negotiated_ = value; }
- bool was_npn_negotiated() const { return was_npn_negotiated_; }
-
- void set_was_alternate_protocol_available(bool value) {
- was_alternate_protocol_available_ = value;
- }
- bool was_alternate_protocol_available() const {
- return was_alternate_protocol_available_;
- }
-
- void set_was_fetched_via_proxy(bool value) {
- was_fetched_via_proxy_ = value;
+ webkit_glue::AltErrorPageResourceFetcher* alt_error_page_fetcher() const {
+ return alt_error_page_fetcher_.get();
}
- bool was_fetched_via_proxy() const { return was_fetched_via_proxy_; }
-
- // Whether the frame text contents was translated to a different language.
- void set_was_translated(bool value) { was_translated_ = value; }
- bool was_translated() const { return was_translated_; }
-
- // True iff the frame's navigation was within the same page.
- void set_was_within_same_page(bool value) { was_within_same_page_ = value; }
- bool was_within_same_page() const { return was_within_same_page_; }
-
- void set_was_prefetcher(bool value) { was_prefetcher_ = value; }
- bool was_prefetcher() const { return was_prefetcher_; }
+ void set_alt_error_page_fetcher(webkit_glue::AltErrorPageResourceFetcher* f);
- void set_was_referred_by_prefetcher(bool value) {
- was_referred_by_prefetcher_ = value;
- }
- bool was_referred_by_prefetcher() const {
- return was_referred_by_prefetcher_;
- }
+ NavigationState* navigation_state() { return navigation_state_.get(); }
+ void set_navigation_state(NavigationState* navigation_state);
private:
- NavigationState(content::PageTransition transition_type,
- const base::Time& request_time,
- bool is_content_initiated,
- int32 pending_page_id,
- int pending_history_list_offset);
-
- content::PageTransition transition_type_;
- LoadType load_type_;
base::Time request_time_;
base::Time start_load_time_;
base::Time commit_load_time_;
@@ -281,37 +230,33 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
base::Time first_paint_after_load_time_;
bool load_histograms_recorded_;
bool web_timing_histograms_recorded_;
- bool request_committed_;
- bool is_content_initiated_;
- int32 pending_page_id_;
- int pending_history_list_offset_;
+ int http_status_code_;
+ bool was_fetched_via_spdy_;
+ bool was_npn_negotiated_;
+ bool was_alternate_protocol_available_;
+ bool was_fetched_via_proxy_;
+
GURL searchable_form_url_;
std::string searchable_form_encoding_;
scoped_ptr<webkit_glue::PasswordForm> password_form_data_;
- scoped_ptr<webkit_glue::AltErrorPageResourceFetcher> alt_error_page_fetcher_;
std::string security_info_;
bool use_error_page_;
- bool cache_policy_override_set_;
- WebKit::WebURLRequest::CachePolicy cache_policy_override_;
-
- int http_status_code_;
-
- bool was_fetched_via_spdy_;
- bool was_npn_negotiated_;
- bool was_alternate_protocol_available_;
- bool was_fetched_via_proxy_;
- bool was_translated_;
- bool was_within_same_page_;
-
// A prefetcher is a page that contains link rel=prefetch elements.
bool was_prefetcher_;
bool was_referred_by_prefetcher_;
- DISALLOW_COPY_AND_ASSIGN(NavigationState);
+ LoadType load_type_;
+
+ bool cache_policy_override_set_;
+ WebKit::WebURLRequest::CachePolicy cache_policy_override_;
+
+ scoped_ptr<webkit_glue::AltErrorPageResourceFetcher> alt_error_page_fetcher_;
+
+ scoped_ptr<NavigationState> navigation_state_;
};
-#endif // CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_
+#endif // CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_
} // namespace content
« no previous file with comments | « content/content_renderer.gypi ('k') | content/public/renderer/document_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698