Commit 0a52713d authored by Dmitry Gozman's avatar Dmitry Gozman Committed by Commit Bot

Merge content::NavigationState and NavigationStateImpl

We don't use the public version anymore, so we now host
NavigationState in InternalDocumentStateData instead of
DocumentState.

This also fixes a bug where we forgot to clone
InternalDocumentStateData when cloning DocumentState.

TBR=boliu@chromium.org,jochen@chromium.org

Bug: none
Change-Id: Ieeed9a73ed3791c7adcf831eb832c87b20a55bc5
Reviewed-on: https://chromium-review.googlesource.com/1236341
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Reviewed-by: default avatarArthur Hemery <ahemery@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593253}
parent 1b941e21
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "content/public/common/simple_connection_filter.h" #include "content/public/common/simple_connection_filter.h"
#include "content/public/common/url_constants.h" #include "content/public/common/url_constants.h"
#include "content/public/renderer/document_state.h" #include "content/public/renderer/document_state.h"
#include "content/public/renderer/navigation_state.h"
#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h" #include "content/public/renderer/render_view.h"
......
...@@ -55,7 +55,6 @@ using blink::WebString; ...@@ -55,7 +55,6 @@ using blink::WebString;
using blink::WebURL; using blink::WebURL;
using blink::WebView; using blink::WebView;
using content::DocumentState; using content::DocumentState;
using content::NavigationState;
namespace { namespace {
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "chrome/renderer/safe_browsing/scorer.h" #include "chrome/renderer/safe_browsing/scorer.h"
#include "components/safe_browsing/proto/csd.pb.h" #include "components/safe_browsing/proto/csd.pb.h"
#include "content/public/renderer/document_state.h" #include "content/public/renderer/document_state.h"
#include "content/public/renderer/navigation_state.h"
#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_thread.h"
#include "services/service_manager/public/cpp/interface_provider.h" #include "services/service_manager/public/cpp/interface_provider.h"
...@@ -27,7 +26,6 @@ ...@@ -27,7 +26,6 @@
#include "third_party/blink/public/web/web_view.h" #include "third_party/blink/public/web/web_view.h"
using content::DocumentState; using content::DocumentState;
using content::NavigationState;
using content::RenderThread; using content::RenderThread;
namespace safe_browsing { namespace safe_browsing {
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "components/autofill/content/renderer/form_autofill_util.h" #include "components/autofill/content/renderer/form_autofill_util.h"
#include "content/public/renderer/document_state.h" #include "content/public/renderer/document_state.h"
#include "content/public/renderer/navigation_state.h"
#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame.h"
#include "third_party/blink/public/web/modules/autofill/web_form_element_observer.h" #include "third_party/blink/public/web/modules/autofill/web_form_element_observer.h"
#include "third_party/blink/public/web/modules/autofill/web_form_element_observer_callback.h" #include "third_party/blink/public/web/modules/autofill/web_form_element_observer_callback.h"
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include "components/security_state/core/security_state.h" #include "components/security_state/core/security_state.h"
#include "content/public/common/origin_util.h" #include "content/public/common/origin_util.h"
#include "content/public/renderer/document_state.h" #include "content/public/renderer/document_state.h"
#include "content/public/renderer/navigation_state.h"
#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h" #include "content/public/renderer/render_view.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
......
...@@ -52,8 +52,6 @@ target(link_target_type, "renderer_sources") { ...@@ -52,8 +52,6 @@ target(link_target_type, "renderer_sources") {
"media_stream_video_renderer.h", "media_stream_video_renderer.h",
"media_stream_video_sink.cc", "media_stream_video_sink.cc",
"media_stream_video_sink.h", "media_stream_video_sink.h",
"navigation_state.cc",
"navigation_state.h",
"pepper_plugin_instance.h", "pepper_plugin_instance.h",
"plugin_instance_throttler.h", "plugin_instance_throttler.h",
"render_accessibility.h", "render_accessibility.h",
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include "content/public/renderer/document_state.h" #include "content/public/renderer/document_state.h"
#include "content/public/renderer/navigation_state.h"
namespace content { namespace content {
DocumentState::DocumentState() DocumentState::DocumentState()
...@@ -33,8 +31,4 @@ std::unique_ptr<DocumentState> DocumentState::Clone() { ...@@ -33,8 +31,4 @@ std::unique_ptr<DocumentState> DocumentState::Clone() {
return new_document_state; return new_document_state;
} }
void DocumentState::set_navigation_state(NavigationState* navigation_state) {
navigation_state_.reset(navigation_state);
}
} // namespace content } // namespace content
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
namespace content { namespace content {
class NavigationState;
// The RenderView stores an instance of this class in the "extra data" of each // The RenderView stores an instance of this class in the "extra data" of each
// WebDocumentLoader (see RenderView::DidCreateDataSource). // WebDocumentLoader (see RenderView::DidCreateDataSource).
class CONTENT_EXPORT DocumentState : public blink::WebDocumentLoader::ExtraData, class CONTENT_EXPORT DocumentState : public blink::WebDocumentLoader::ExtraData,
...@@ -34,7 +32,7 @@ class CONTENT_EXPORT DocumentState : public blink::WebDocumentLoader::ExtraData, ...@@ -34,7 +32,7 @@ class CONTENT_EXPORT DocumentState : public blink::WebDocumentLoader::ExtraData,
} }
// Returns a copy of the DocumentState. This is a shallow copy, // Returns a copy of the DocumentState. This is a shallow copy,
// |navigation_state_| of the new DocumentState is set to nullptr. // user data is not copied.
std::unique_ptr<DocumentState> Clone(); std::unique_ptr<DocumentState> Clone();
// Indicator if SPDY was used as part of this page load. // Indicator if SPDY was used as part of this page load.
...@@ -83,11 +81,6 @@ class CONTENT_EXPORT DocumentState : public blink::WebDocumentLoader::ExtraData, ...@@ -83,11 +81,6 @@ class CONTENT_EXPORT DocumentState : public blink::WebDocumentLoader::ExtraData,
data_url_ = data_url; data_url_ = data_url;
} }
NavigationState* navigation_state() { return navigation_state_.get(); }
// TODO(ahemery): set_navigation_state should take a std::unique_ptr for
// |navigation_state|.
void set_navigation_state(NavigationState* navigation_state);
bool can_load_local_resources() const { return can_load_local_resources_; } bool can_load_local_resources() const { return can_load_local_resources_; }
void set_can_load_local_resources(bool can_load) { void set_can_load_local_resources(bool can_load) {
can_load_local_resources_ = can_load; can_load_local_resources_ = can_load;
...@@ -103,8 +96,6 @@ class CONTENT_EXPORT DocumentState : public blink::WebDocumentLoader::ExtraData, ...@@ -103,8 +96,6 @@ class CONTENT_EXPORT DocumentState : public blink::WebDocumentLoader::ExtraData,
bool was_load_data_with_base_url_request_; bool was_load_data_with_base_url_request_;
GURL data_url_; GURL data_url_;
std::unique_ptr<NavigationState> navigation_state_;
bool can_load_local_resources_; bool can_load_local_resources_;
}; };
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/renderer/navigation_state.h"
namespace content {
NavigationState::~NavigationState() {}
} // namespace content
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// 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_
#include <string>
#include "content/common/content_export.h"
namespace content {
// TODO(dgozman): Remove this class, once public DocumentState
// does not reference it.
class CONTENT_EXPORT NavigationState {
public:
virtual ~NavigationState();
};
} // namespace content
#endif // CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H
...@@ -477,8 +477,8 @@ target(link_target_type, "renderer") { ...@@ -477,8 +477,8 @@ target(link_target_type, "renderer") {
"mouse_lock_dispatcher.h", "mouse_lock_dispatcher.h",
"navigation_client.cc", "navigation_client.cc",
"navigation_client.h", "navigation_client.h",
"navigation_state_impl.cc", "navigation_state.cc",
"navigation_state_impl.h", "navigation_state.h",
"net_info_helper.cc", "net_info_helper.cc",
"net_info_helper.h", "net_info_helper.h",
"notifications/notification_data_conversions.cc", "notifications/notification_data_conversions.cc",
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "content/public/renderer/document_state.h" #include "content/public/renderer/document_state.h"
#include "content/renderer/navigation_state.h"
#include "third_party/blink/public/web/web_document_loader.h" #include "third_party/blink/public/web/web_document_loader.h"
namespace content { namespace content {
...@@ -48,4 +49,18 @@ InternalDocumentStateData* InternalDocumentStateData::FromDocumentState( ...@@ -48,4 +49,18 @@ InternalDocumentStateData* InternalDocumentStateData::FromDocumentState(
InternalDocumentStateData::~InternalDocumentStateData() { InternalDocumentStateData::~InternalDocumentStateData() {
} }
void InternalDocumentStateData::CopyFrom(InternalDocumentStateData* other) {
http_status_code_ = other->http_status_code_;
is_overriding_user_agent_ = other->is_overriding_user_agent_;
must_reset_scroll_and_scale_state_ =
other->must_reset_scroll_and_scale_state_;
cache_policy_override_set_ = other->cache_policy_override_set_;
cache_policy_override_ = other->cache_policy_override_;
}
void InternalDocumentStateData::set_navigation_state(
std::unique_ptr<NavigationState> navigation_state) {
navigation_state_ = std::move(navigation_state);
}
} // namespace content } // namespace content
...@@ -20,6 +20,7 @@ class WebDocumentLoader; ...@@ -20,6 +20,7 @@ class WebDocumentLoader;
namespace content { namespace content {
class DocumentState; class DocumentState;
class NavigationState;
// Stores internal state per WebDocumentLoader. // Stores internal state per WebDocumentLoader.
class InternalDocumentStateData : public base::SupportsUserData::Data { class InternalDocumentStateData : public base::SupportsUserData::Data {
...@@ -31,6 +32,8 @@ class InternalDocumentStateData : public base::SupportsUserData::Data { ...@@ -31,6 +32,8 @@ class InternalDocumentStateData : public base::SupportsUserData::Data {
blink::WebDocumentLoader* document_loader); blink::WebDocumentLoader* document_loader);
static InternalDocumentStateData* FromDocumentState(DocumentState* ds); static InternalDocumentStateData* FromDocumentState(DocumentState* ds);
void CopyFrom(InternalDocumentStateData* other);
int http_status_code() const { return http_status_code_; } int http_status_code() const { return http_status_code_; }
void set_http_status_code(int http_status_code) { void set_http_status_code(int http_status_code) {
http_status_code_ = http_status_code; http_status_code_ = http_status_code;
...@@ -69,12 +72,16 @@ class InternalDocumentStateData : public base::SupportsUserData::Data { ...@@ -69,12 +72,16 @@ class InternalDocumentStateData : public base::SupportsUserData::Data {
return cache_policy_override_set_; return cache_policy_override_set_;
} }
NavigationState* navigation_state() { return navigation_state_.get(); }
void set_navigation_state(std::unique_ptr<NavigationState> navigation_state);
private: private:
int http_status_code_; int http_status_code_;
bool is_overriding_user_agent_; bool is_overriding_user_agent_;
bool must_reset_scroll_and_scale_state_; bool must_reset_scroll_and_scale_state_;
bool cache_policy_override_set_; bool cache_policy_override_set_;
blink::mojom::FetchCacheMode cache_policy_override_; blink::mojom::FetchCacheMode cache_policy_override_;
std::unique_ptr<NavigationState> navigation_state_;
DISALLOW_COPY_AND_ASSIGN(InternalDocumentStateData); DISALLOW_COPY_AND_ASSIGN(InternalDocumentStateData);
}; };
......
...@@ -2,45 +2,57 @@ ...@@ -2,45 +2,57 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/renderer/navigation_state_impl.h" #include "content/renderer/navigation_state.h"
#include "content/renderer/internal_document_state_data.h"
namespace content { namespace content {
NavigationStateImpl::~NavigationStateImpl() { NavigationState::~NavigationState() {
RunCommitNavigationCallback(blink::mojom::CommitResult::Aborted); RunCommitNavigationCallback(blink::mojom::CommitResult::Aborted);
} }
NavigationStateImpl* NavigationStateImpl::CreateBrowserInitiated( // static
std::unique_ptr<NavigationState> NavigationState::CreateBrowserInitiated(
const CommonNavigationParams& common_params, const CommonNavigationParams& common_params,
const RequestNavigationParams& request_params, const RequestNavigationParams& request_params,
base::TimeTicks time_commit_requested, base::TimeTicks time_commit_requested,
mojom::FrameNavigationControl::CommitNavigationCallback callback) { mojom::FrameNavigationControl::CommitNavigationCallback callback) {
return new NavigationStateImpl(common_params, request_params, return base::WrapUnique(new NavigationState(common_params, request_params,
time_commit_requested, false, time_commit_requested, false,
std::move(callback)); std::move(callback)));
} }
NavigationStateImpl* NavigationStateImpl::CreateContentInitiated() { // static
return new NavigationStateImpl( std::unique_ptr<NavigationState> NavigationState::CreateContentInitiated() {
return base::WrapUnique(new NavigationState(
CommonNavigationParams(), RequestNavigationParams(), base::TimeTicks(), CommonNavigationParams(), RequestNavigationParams(), base::TimeTicks(),
true, content::mojom::FrameNavigationControl::CommitNavigationCallback()); true,
content::mojom::FrameNavigationControl::CommitNavigationCallback()));
}
// static
NavigationState* NavigationState::FromDocumentLoader(
blink::WebDocumentLoader* document_loader) {
return InternalDocumentStateData::FromDocumentLoader(document_loader)
->navigation_state();
} }
bool NavigationStateImpl::WasWithinSameDocument() { bool NavigationState::WasWithinSameDocument() {
return was_within_same_document_; return was_within_same_document_;
} }
bool NavigationStateImpl::IsContentInitiated() { bool NavigationState::IsContentInitiated() {
return is_content_initiated_; return is_content_initiated_;
} }
void NavigationStateImpl::RunCommitNavigationCallback( void NavigationState::RunCommitNavigationCallback(
blink::mojom::CommitResult result) { blink::mojom::CommitResult result) {
if (commit_callback_) if (commit_callback_)
std::move(commit_callback_).Run(result); std::move(commit_callback_).Run(result);
} }
NavigationStateImpl::NavigationStateImpl( NavigationState::NavigationState(
const CommonNavigationParams& common_params, const CommonNavigationParams& common_params,
const RequestNavigationParams& request_params, const RequestNavigationParams& request_params,
base::TimeTicks time_commit_requested, base::TimeTicks time_commit_requested,
......
...@@ -2,31 +2,37 @@ ...@@ -2,31 +2,37 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_RENDERER_NAVIGATION_STATE_IMPL_H_ #ifndef CONTENT_RENDERER_NAVIGATION_STATE_H_
#define CONTENT_RENDERER_NAVIGATION_STATE_IMPL_H_ #define CONTENT_RENDERER_NAVIGATION_STATE_H_
#include <string> #include <string>
#include "base/macros.h" #include "base/macros.h"
#include "content/common/frame.mojom.h" #include "content/common/frame.mojom.h"
#include "content/common/navigation_params.h" #include "content/common/navigation_params.h"
#include "content/public/renderer/navigation_state.h"
#include "content/renderer/navigation_client.h" #include "content/renderer/navigation_client.h"
#include "third_party/blink/public/web/commit_result.mojom.h" #include "third_party/blink/public/web/commit_result.mojom.h"
namespace blink {
class WebDocumentLoader;
}
namespace content { namespace content {
class CONTENT_EXPORT NavigationStateImpl : public NavigationState { class CONTENT_EXPORT NavigationState {
public: public:
~NavigationStateImpl() override; ~NavigationState();
static NavigationStateImpl* CreateBrowserInitiated( static std::unique_ptr<NavigationState> CreateBrowserInitiated(
const CommonNavigationParams& common_params, const CommonNavigationParams& common_params,
const RequestNavigationParams& request_params, const RequestNavigationParams& request_params,
base::TimeTicks time_commit_requested, base::TimeTicks time_commit_requested,
mojom::FrameNavigationControl::CommitNavigationCallback callback); mojom::FrameNavigationControl::CommitNavigationCallback callback);
static NavigationStateImpl* CreateContentInitiated(); static std::unique_ptr<NavigationState> CreateContentInitiated();
static NavigationState* FromDocumentLoader(
blink::WebDocumentLoader* document_loader);
// True iff the frame's navigation was within the same document. // True iff the frame's navigation was within the same document.
bool WasWithinSameDocument(); bool WasWithinSameDocument();
...@@ -65,7 +71,7 @@ class CONTENT_EXPORT NavigationStateImpl : public NavigationState { ...@@ -65,7 +71,7 @@ class CONTENT_EXPORT NavigationStateImpl : public NavigationState {
void RunCommitNavigationCallback(blink::mojom::CommitResult result); void RunCommitNavigationCallback(blink::mojom::CommitResult result);
private: private:
NavigationStateImpl( NavigationState(
const CommonNavigationParams& common_params, const CommonNavigationParams& common_params,
const RequestNavigationParams& request_params, const RequestNavigationParams& request_params,
base::TimeTicks time_commit_requested, base::TimeTicks time_commit_requested,
...@@ -106,9 +112,9 @@ class CONTENT_EXPORT NavigationStateImpl : public NavigationState { ...@@ -106,9 +112,9 @@ class CONTENT_EXPORT NavigationStateImpl : public NavigationState {
// successful or not. // successful or not.
mojom::FrameNavigationControl::CommitNavigationCallback commit_callback_; mojom::FrameNavigationControl::CommitNavigationCallback commit_callback_;
DISALLOW_COPY_AND_ASSIGN(NavigationStateImpl); DISALLOW_COPY_AND_ASSIGN(NavigationState);
}; };
} // namespace content } // namespace content
#endif // CONTENT_RENDERER_NAVIGATION_STATE_IMPL_H_ #endif // CONTENT_RENDERER_NAVIGATION_STATE_H_
This diff is collapsed.
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "content/public/test/test_utils.h" #include "content/public/test/test_utils.h"
#include "content/renderer/loader/web_url_loader_impl.h" #include "content/renderer/loader/web_url_loader_impl.h"
#include "content/renderer/mojo/blink_interface_registry_impl.h" #include "content/renderer/mojo/blink_interface_registry_impl.h"
#include "content/renderer/navigation_state_impl.h" #include "content/renderer/navigation_state.h"
#include "content/renderer/render_frame_impl.h" #include "content/renderer/render_frame_impl.h"
#include "content/renderer/render_frame_proxy.h" #include "content/renderer/render_frame_proxy.h"
#include "content/renderer/render_view_impl.h" #include "content/renderer/render_view_impl.h"
...@@ -282,10 +282,9 @@ TEST_F(RenderFrameImplTest, LoFiNotUpdatedOnSubframeCommits) { ...@@ -282,10 +282,9 @@ TEST_F(RenderFrameImplTest, LoFiNotUpdatedOnSubframeCommits) {
EXPECT_EQ(SERVER_LOFI_ON, GetMainRenderFrame()->GetPreviewsState()); EXPECT_EQ(SERVER_LOFI_ON, GetMainRenderFrame()->GetPreviewsState());
// The subframe's LoFi state should not be reset on commit. // The subframe's LoFi state should not be reset on commit.
DocumentState* document_state = DocumentState::FromDocumentLoader( NavigationState* navigation_state = NavigationState::FromDocumentLoader(
frame()->GetWebFrame()->GetDocumentLoader()); frame()->GetWebFrame()->GetDocumentLoader());
static_cast<NavigationStateImpl*>(document_state->navigation_state()) navigation_state->set_was_within_same_document(false);
->set_was_within_same_document(false);
frame()->DidCommitProvisionalLoad( frame()->DidCommitProvisionalLoad(
item, blink::kWebStandardCommit, item, blink::kWebStandardCommit,
...@@ -293,10 +292,9 @@ TEST_F(RenderFrameImplTest, LoFiNotUpdatedOnSubframeCommits) { ...@@ -293,10 +292,9 @@ TEST_F(RenderFrameImplTest, LoFiNotUpdatedOnSubframeCommits) {
EXPECT_EQ(SERVER_LOFI_ON, frame()->GetPreviewsState()); EXPECT_EQ(SERVER_LOFI_ON, frame()->GetPreviewsState());
// The main frame's LoFi state should be reset to off on commit. // The main frame's LoFi state should be reset to off on commit.
document_state = DocumentState::FromDocumentLoader( navigation_state = NavigationState::FromDocumentLoader(
GetMainRenderFrame()->GetWebFrame()->GetDocumentLoader()); GetMainRenderFrame()->GetWebFrame()->GetDocumentLoader());
static_cast<NavigationStateImpl*>(document_state->navigation_state()) navigation_state->set_was_within_same_document(false);
->set_was_within_same_document(false);
// Calling didCommitProvisionalLoad is not representative of a full navigation // Calling didCommitProvisionalLoad is not representative of a full navigation
// but serves the purpose of testing the LoFi state logic. // but serves the purpose of testing the LoFi state logic.
...@@ -344,10 +342,9 @@ TEST_F(RenderFrameImplTest, EffectiveConnectionType) { ...@@ -344,10 +342,9 @@ TEST_F(RenderFrameImplTest, EffectiveConnectionType) {
EXPECT_EQ(tests[i].type, frame()->GetEffectiveConnectionType()); EXPECT_EQ(tests[i].type, frame()->GetEffectiveConnectionType());
// The subframe's effective connection type should not be reset on commit. // The subframe's effective connection type should not be reset on commit.
DocumentState* document_state = DocumentState::FromDocumentLoader( NavigationState* navigation_state = NavigationState::FromDocumentLoader(
frame()->GetWebFrame()->GetDocumentLoader()); frame()->GetWebFrame()->GetDocumentLoader());
static_cast<NavigationStateImpl*>(document_state->navigation_state()) navigation_state->set_was_within_same_document(false);
->set_was_within_same_document(false);
frame()->DidCommitProvisionalLoad( frame()->DidCommitProvisionalLoad(
item, blink::kWebStandardCommit, item, blink::kWebStandardCommit,
...@@ -355,10 +352,9 @@ TEST_F(RenderFrameImplTest, EffectiveConnectionType) { ...@@ -355,10 +352,9 @@ TEST_F(RenderFrameImplTest, EffectiveConnectionType) {
EXPECT_EQ(tests[i].type, frame()->GetEffectiveConnectionType()); EXPECT_EQ(tests[i].type, frame()->GetEffectiveConnectionType());
// The main frame's effective connection type should be reset on commit. // The main frame's effective connection type should be reset on commit.
document_state = DocumentState::FromDocumentLoader( navigation_state = NavigationState::FromDocumentLoader(
GetMainRenderFrame()->GetWebFrame()->GetDocumentLoader()); GetMainRenderFrame()->GetWebFrame()->GetDocumentLoader());
static_cast<NavigationStateImpl*>(document_state->navigation_state()) navigation_state->set_was_within_same_document(false);
->set_was_within_same_document(false);
GetMainRenderFrame()->DidCommitProvisionalLoad( GetMainRenderFrame()->DidCommitProvisionalLoad(
item, blink::kWebStandardCommit, item, blink::kWebStandardCommit,
......
...@@ -39,8 +39,6 @@ ...@@ -39,8 +39,6 @@
#include "content/public/common/url_utils.h" #include "content/public/common/url_utils.h"
#include "content/public/common/use_zoom_for_dsf_policy.h" #include "content/public/common/use_zoom_for_dsf_policy.h"
#include "content/public/renderer/content_renderer_client.h" #include "content/public/renderer/content_renderer_client.h"
#include "content/public/renderer/document_state.h"
#include "content/public/renderer/navigation_state.h"
#include "content/public/test/browser_test_utils.h" #include "content/public/test/browser_test_utils.h"
#include "content/public/test/frame_load_waiter.h" #include "content/public/test/frame_load_waiter.h"
#include "content/public/test/render_view_test.h" #include "content/public/test/render_view_test.h"
...@@ -50,7 +48,7 @@ ...@@ -50,7 +48,7 @@
#include "content/renderer/history_entry.h" #include "content/renderer/history_entry.h"
#include "content/renderer/history_serialization.h" #include "content/renderer/history_serialization.h"
#include "content/renderer/loader/request_extra_data.h" #include "content/renderer/loader/request_extra_data.h"
#include "content/renderer/navigation_state_impl.h" #include "content/renderer/navigation_state.h"
#include "content/renderer/render_frame_proxy.h" #include "content/renderer/render_frame_proxy.h"
#include "content/renderer/render_process.h" #include "content/renderer/render_process.h"
#include "content/renderer/render_view_impl.h" #include "content/renderer/render_view_impl.h"
...@@ -657,9 +655,6 @@ TEST_F(RenderViewImplTest, DecideNavigationPolicy) { ...@@ -657,9 +655,6 @@ TEST_F(RenderViewImplTest, DecideNavigationPolicy) {
WebUITestWebUIControllerFactory factory; WebUITestWebUIControllerFactory factory;
WebUIControllerFactory::RegisterFactory(&factory); WebUIControllerFactory::RegisterFactory(&factory);
DocumentState state;
state.set_navigation_state(NavigationStateImpl::CreateContentInitiated());
// Navigations to normal HTTP URLs can be handled locally. // Navigations to normal HTTP URLs can be handled locally.
blink::WebURLRequest request(GURL("http://foo.com")); blink::WebURLRequest request(GURL("http://foo.com"));
request.SetFetchRequestMode(network::mojom::FetchRequestMode::kNavigate); request.SetFetchRequestMode(network::mojom::FetchRequestMode::kNavigate);
...@@ -699,9 +694,6 @@ TEST_F(RenderViewImplTest, DecideNavigationPolicy) { ...@@ -699,9 +694,6 @@ TEST_F(RenderViewImplTest, DecideNavigationPolicy) {
} }
TEST_F(RenderViewImplTest, DecideNavigationPolicyHandlesAllTopLevel) { TEST_F(RenderViewImplTest, DecideNavigationPolicyHandlesAllTopLevel) {
DocumentState state;
state.set_navigation_state(NavigationStateImpl::CreateContentInitiated());
RendererPreferences prefs = view()->renderer_preferences(); RendererPreferences prefs = view()->renderer_preferences();
prefs.browser_handles_all_top_level_requests = true; prefs.browser_handles_all_top_level_requests = true;
view()->OnSetRendererPrefs(prefs); view()->OnSetRendererPrefs(prefs);
...@@ -732,9 +724,6 @@ TEST_F(RenderViewImplTest, DecideNavigationPolicyForWebUI) { ...@@ -732,9 +724,6 @@ TEST_F(RenderViewImplTest, DecideNavigationPolicyForWebUI) {
// Enable bindings to simulate a WebUI view. // Enable bindings to simulate a WebUI view.
view()->GetMainRenderFrame()->AllowBindings(BINDINGS_POLICY_WEB_UI); view()->GetMainRenderFrame()->AllowBindings(BINDINGS_POLICY_WEB_UI);
DocumentState state;
state.set_navigation_state(NavigationStateImpl::CreateContentInitiated());
// Navigations to normal HTTP URLs will be sent to browser process. // Navigations to normal HTTP URLs will be sent to browser process.
blink::WebURLRequest request(GURL("http://foo.com")); blink::WebURLRequest request(GURL("http://foo.com"));
blink::WebLocalFrameClient::NavigationPolicyInfo policy_info(request); blink::WebLocalFrameClient::NavigationPolicyInfo policy_info(request);
...@@ -2143,10 +2132,8 @@ TEST_F(RenderViewImplTest, RendererNavigationStartTransmittedToBrowser) { ...@@ -2143,10 +2132,8 @@ TEST_F(RenderViewImplTest, RendererNavigationStartTransmittedToBrowser) {
frame()->GetWebFrame()->LoadHTMLString( frame()->GetWebFrame()->LoadHTMLString(
"hello world", blink::WebURL(GURL("data:text/html,"))); "hello world", blink::WebURL(GURL("data:text/html,")));
DocumentState* document_state = DocumentState::FromDocumentLoader( NavigationState* navigation_state = NavigationState::FromDocumentLoader(
frame()->GetWebFrame()->GetProvisionalDocumentLoader()); frame()->GetWebFrame()->GetProvisionalDocumentLoader());
NavigationStateImpl* navigation_state =
static_cast<NavigationStateImpl*>(document_state->navigation_state());
EXPECT_FALSE(navigation_state->common_params().navigation_start.is_null()); EXPECT_FALSE(navigation_state->common_params().navigation_start.is_null());
EXPECT_LE(lower_bound_navigation_start, EXPECT_LE(lower_bound_navigation_start,
navigation_state->common_params().navigation_start); navigation_state->common_params().navigation_start);
...@@ -2160,10 +2147,8 @@ TEST_F(RenderViewImplTest, BrowserNavigationStart) { ...@@ -2160,10 +2147,8 @@ TEST_F(RenderViewImplTest, BrowserNavigationStart) {
auto common_params = MakeCommonNavigationParams(-TimeDelta::FromSeconds(1)); auto common_params = MakeCommonNavigationParams(-TimeDelta::FromSeconds(1));
frame()->Navigate(common_params, RequestNavigationParams()); frame()->Navigate(common_params, RequestNavigationParams());
DocumentState* document_state = DocumentState::FromDocumentLoader( NavigationState* navigation_state = NavigationState::FromDocumentLoader(
frame()->GetWebFrame()->GetProvisionalDocumentLoader()); frame()->GetWebFrame()->GetProvisionalDocumentLoader());
NavigationStateImpl* navigation_state =
static_cast<NavigationStateImpl*>(document_state->navigation_state());
EXPECT_EQ(common_params.navigation_start, EXPECT_EQ(common_params.navigation_start,
navigation_state->common_params().navigation_start); navigation_state->common_params().navigation_start);
} }
...@@ -2199,10 +2184,8 @@ TEST_F(RenderViewImplTest, NavigationStartWhenInitialDocumentWasAccessed) { ...@@ -2199,10 +2184,8 @@ TEST_F(RenderViewImplTest, NavigationStartWhenInitialDocumentWasAccessed) {
auto common_params = MakeCommonNavigationParams(-TimeDelta::FromSeconds(1)); auto common_params = MakeCommonNavigationParams(-TimeDelta::FromSeconds(1));
frame()->Navigate(common_params, RequestNavigationParams()); frame()->Navigate(common_params, RequestNavigationParams());
DocumentState* document_state = DocumentState::FromDocumentLoader( NavigationState* navigation_state = NavigationState::FromDocumentLoader(
frame()->GetWebFrame()->GetProvisionalDocumentLoader()); frame()->GetWebFrame()->GetProvisionalDocumentLoader());
NavigationStateImpl* navigation_state =
static_cast<NavigationStateImpl*>(document_state->navigation_state());
EXPECT_EQ(common_params.navigation_start, EXPECT_EQ(common_params.navigation_start,
navigation_state->common_params().navigation_start); navigation_state->common_params().navigation_start);
} }
...@@ -2225,10 +2208,8 @@ TEST_F(RenderViewImplTest, NavigationStartForReload) { ...@@ -2225,10 +2208,8 @@ TEST_F(RenderViewImplTest, NavigationStartForReload) {
frame()->Navigate(common_params, RequestNavigationParams()); frame()->Navigate(common_params, RequestNavigationParams());
// The browser navigation_start is always used. // The browser navigation_start is always used.
DocumentState* document_state = DocumentState::FromDocumentLoader( NavigationState* navigation_state = NavigationState::FromDocumentLoader(
frame()->GetWebFrame()->GetProvisionalDocumentLoader()); frame()->GetWebFrame()->GetProvisionalDocumentLoader());
NavigationStateImpl* navigation_state =
static_cast<NavigationStateImpl*>(document_state->navigation_state());
EXPECT_EQ(common_params.navigation_start, EXPECT_EQ(common_params.navigation_start,
navigation_state->common_params().navigation_start); navigation_state->common_params().navigation_start);
} }
...@@ -2251,10 +2232,8 @@ TEST_F(RenderViewImplTest, NavigationStartForSameProcessHistoryNavigation) { ...@@ -2251,10 +2232,8 @@ TEST_F(RenderViewImplTest, NavigationStartForSameProcessHistoryNavigation) {
FrameMsg_Navigate_Type::HISTORY_DIFFERENT_DOCUMENT; FrameMsg_Navigate_Type::HISTORY_DIFFERENT_DOCUMENT;
GoToOffsetWithParams(-1, back_state, common_params_back, GoToOffsetWithParams(-1, back_state, common_params_back,
RequestNavigationParams()); RequestNavigationParams());
DocumentState* document_state = DocumentState::FromDocumentLoader( NavigationState* navigation_state = NavigationState::FromDocumentLoader(
frame()->GetWebFrame()->GetDocumentLoader()); frame()->GetWebFrame()->GetDocumentLoader());
NavigationStateImpl* navigation_state =
static_cast<NavigationStateImpl*>(document_state->navigation_state());
// The browser navigation_start is always used. // The browser navigation_start is always used.
EXPECT_EQ(common_params_back.navigation_start, EXPECT_EQ(common_params_back.navigation_start,
...@@ -2269,10 +2248,8 @@ TEST_F(RenderViewImplTest, NavigationStartForSameProcessHistoryNavigation) { ...@@ -2269,10 +2248,8 @@ TEST_F(RenderViewImplTest, NavigationStartForSameProcessHistoryNavigation) {
FrameMsg_Navigate_Type::HISTORY_DIFFERENT_DOCUMENT; FrameMsg_Navigate_Type::HISTORY_DIFFERENT_DOCUMENT;
GoToOffsetWithParams(1, forward_state, common_params_forward, GoToOffsetWithParams(1, forward_state, common_params_forward,
RequestNavigationParams()); RequestNavigationParams());
document_state = DocumentState::FromDocumentLoader( navigation_state = NavigationState::FromDocumentLoader(
frame()->GetWebFrame()->GetDocumentLoader()); frame()->GetWebFrame()->GetDocumentLoader());
navigation_state =
static_cast<NavigationStateImpl*>(document_state->navigation_state());
EXPECT_EQ(common_params_forward.navigation_start, EXPECT_EQ(common_params_forward.navigation_start,
navigation_state->common_params().navigation_start); navigation_state->common_params().navigation_start);
} }
...@@ -2292,10 +2269,8 @@ TEST_F(RenderViewImplTest, NavigationStartForCrossProcessHistoryNavigation) { ...@@ -2292,10 +2269,8 @@ TEST_F(RenderViewImplTest, NavigationStartForCrossProcessHistoryNavigation) {
request_params.current_history_list_length = 1; request_params.current_history_list_length = 1;
frame()->Navigate(common_params, request_params); frame()->Navigate(common_params, request_params);
DocumentState* document_state = DocumentState::FromDocumentLoader( NavigationState* navigation_state = NavigationState::FromDocumentLoader(
frame()->GetWebFrame()->GetProvisionalDocumentLoader()); frame()->GetWebFrame()->GetProvisionalDocumentLoader());
NavigationStateImpl* navigation_state =
static_cast<NavigationStateImpl*>(document_state->navigation_state());
EXPECT_EQ(common_params.navigation_start, EXPECT_EQ(common_params.navigation_start,
navigation_state->common_params().navigation_start); navigation_state->common_params().navigation_start);
} }
......
...@@ -64,7 +64,6 @@ ...@@ -64,7 +64,6 @@
#include "content/public/common/web_preferences.h" #include "content/public/common/web_preferences.h"
#include "content/public/renderer/content_renderer_client.h" #include "content/public/renderer/content_renderer_client.h"
#include "content/public/renderer/document_state.h" #include "content/public/renderer/document_state.h"
#include "content/public/renderer/navigation_state.h"
#include "content/public/renderer/render_view_observer.h" #include "content/public/renderer/render_view_observer.h"
#include "content/public/renderer/render_view_visitor.h" #include "content/public/renderer/render_view_visitor.h"
#include "content/public/renderer/window_features_converter.h" #include "content/public/renderer/window_features_converter.h"
...@@ -83,7 +82,6 @@ ...@@ -83,7 +82,6 @@
#include "content/renderer/media/video_capture_impl_manager.h" #include "content/renderer/media/video_capture_impl_manager.h"
#include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
#include "content/renderer/media/webrtc/rtc_peer_connection_handler.h" #include "content/renderer/media/webrtc/rtc_peer_connection_handler.h"
#include "content/renderer/navigation_state_impl.h"
#include "content/renderer/render_frame_impl.h" #include "content/renderer/render_frame_impl.h"
#include "content/renderer/render_frame_proxy.h" #include "content/renderer/render_frame_proxy.h"
#include "content/renderer/render_process.h" #include "content/renderer/render_process.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment