summaryrefslogtreecommitdiffstats
path: root/content/common
diff options
context:
space:
mode:
authormegjablon <megjablon@chromium.org>2015-10-22 16:56:12 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-22 23:56:54 +0000
commitd5ac7d52b323d04178bba9cc746c623438d48751 (patch)
tree7097e23007daea9b2678df9f389acb1e95ac3600 /content/common
parent20f6367b6cd95ead067a0716709bdb2afa776be9 (diff)
downloadchromium_src-d5ac7d52b323d04178bba9cc746c623438d48751.zip
chromium_src-d5ac7d52b323d04178bba9cc746c623438d48751.tar.gz
chromium_src-d5ac7d52b323d04178bba9cc746c623438d48751.tar.bz2
Consistently use LoFi for an entire page
Store the LoFi state in the renderer and use that state to add LoFi request headers when appropriate. Introduce a state variable that has three values: LOFI_DEFAULT, LOFI_ON, and LOFI_OFF. The snackbar triggering does not use this state yet, but still looks at the last mainframe LoFi value. Single image loads also use the bypass cache flag up to willSendRequest. These will be fixed in follow up cls. The LoFi state is not preserved from navigation to navigation, and iframes inherit the status. Renderer initiated navigations always start with state LOFI_DEFAULT whereas browser initiated navigations can force LOFI_ON or LOFI_OFF. BUG=524652 Review URL: https://codereview.chromium.org/1310743003 Cr-Commit-Position: refs/heads/master@{#355679}
Diffstat (limited to 'content/common')
-rw-r--r--content/common/frame_messages.h4
-rw-r--r--content/common/navigation_params.cc9
-rw-r--r--content/common/navigation_params.h19
-rw-r--r--content/common/resource_messages.h6
4 files changed, 34 insertions, 4 deletions
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h
index b67af2a..424a0e2 100644
--- a/content/common/frame_messages.h
+++ b/content/common/frame_messages.h
@@ -60,6 +60,9 @@ IPC_ENUM_TRAITS(blink::WebSandboxFlags) // Bitmask.
IPC_ENUM_TRAITS_MAX_VALUE(blink::WebTreeScopeType,
blink::WebTreeScopeType::Last)
IPC_ENUM_TRAITS_MAX_VALUE(ui::MenuSourceType, ui::MENU_SOURCE_TYPE_LAST)
+IPC_ENUM_TRAITS_MIN_MAX_VALUE(content::LoFiState,
+ content::LOFI_UNSPECIFIED,
+ content::LOFI_ON)
IPC_STRUCT_TRAITS_BEGIN(content::ColorSuggestion)
IPC_STRUCT_TRAITS_MEMBER(color)
@@ -270,6 +273,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::CommonNavigationParams)
IPC_STRUCT_TRAITS_MEMBER(report_type)
IPC_STRUCT_TRAITS_MEMBER(base_url_for_data_url)
IPC_STRUCT_TRAITS_MEMBER(history_url_for_data_url)
+ IPC_STRUCT_TRAITS_MEMBER(lofi_state)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(content::BeginNavigationParams)
diff --git a/content/common/navigation_params.cc b/content/common/navigation_params.cc
index 9c0f445..dfaefb1 100644
--- a/content/common/navigation_params.cc
+++ b/content/common/navigation_params.cc
@@ -29,7 +29,8 @@ CommonNavigationParams::CommonNavigationParams()
navigation_type(FrameMsg_Navigate_Type::NORMAL),
allow_download(true),
should_replace_current_entry(false),
- report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT) {
+ report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT),
+ lofi_state(LOFI_UNSPECIFIED) {
}
CommonNavigationParams::CommonNavigationParams(
@@ -42,7 +43,8 @@ CommonNavigationParams::CommonNavigationParams(
base::TimeTicks ui_timestamp,
FrameMsg_UILoadMetricsReportType::Value report_type,
const GURL& base_url_for_data_url,
- const GURL& history_url_for_data_url)
+ const GURL& history_url_for_data_url,
+ LoFiState lofi_state)
: url(url),
referrer(referrer),
transition(transition),
@@ -52,7 +54,8 @@ CommonNavigationParams::CommonNavigationParams(
ui_timestamp(ui_timestamp),
report_type(report_type),
base_url_for_data_url(base_url_for_data_url),
- history_url_for_data_url(history_url_for_data_url) {
+ history_url_for_data_url(history_url_for_data_url),
+ lofi_state(lofi_state) {
}
CommonNavigationParams::~CommonNavigationParams() {
diff --git a/content/common/navigation_params.h b/content/common/navigation_params.h
index 3ed8377..8093623 100644
--- a/content/common/navigation_params.h
+++ b/content/common/navigation_params.h
@@ -23,6 +23,18 @@ class RefCountedMemory;
namespace content {
+// The LoFi state which determines whether to add the Lo-Fi header.
+enum LoFiState {
+ // Let the browser process decide whether or not to request the Lo-Fi version.
+ LOFI_UNSPECIFIED = 0,
+
+ // Request a normal (non-Lo-Fi) version of the resource.
+ LOFI_OFF,
+
+ // Request a Lo-Fi version of the resource.
+ LOFI_ON,
+};
+
// PlzNavigate
// Helper function to determine if the navigation to |url| should make a request
// to the network stack. A request should not be sent for data URLs, JavaScript
@@ -47,7 +59,8 @@ struct CONTENT_EXPORT CommonNavigationParams {
base::TimeTicks ui_timestamp,
FrameMsg_UILoadMetricsReportType::Value report_type,
const GURL& base_url_for_data_url,
- const GURL& history_url_for_data_url);
+ const GURL& history_url_for_data_url,
+ LoFiState lofi_state);
~CommonNavigationParams();
// The URL to navigate to.
@@ -90,6 +103,10 @@ struct CONTENT_EXPORT CommonNavigationParams {
// History URL for use in Blink's SubstituteData.
// Is only used with data: URLs.
GURL history_url_for_data_url;
+
+ // Whether or not to request a LoFi version of the document or let the browser
+ // decide.
+ LoFiState lofi_state;
};
// Provided by the renderer ----------------------------------------------------
diff --git a/content/common/resource_messages.h b/content/common/resource_messages.h
index 744a923..dc4bac4 100644
--- a/content/common/resource_messages.h
+++ b/content/common/resource_messages.h
@@ -10,6 +10,7 @@
#include "base/memory/shared_memory.h"
#include "base/process/process.h"
#include "content/common/content_param_traits_macros.h"
+#include "content/common/navigation_params.h"
#include "content/common/resource_request_body.h"
#include "content/common/service_worker/service_worker_types.h"
#include "content/public/common/common_param_traits.h"
@@ -135,6 +136,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::ResourceResponseInfo)
IPC_STRUCT_TRAITS_MEMBER(service_worker_start_time)
IPC_STRUCT_TRAITS_MEMBER(service_worker_ready_time)
IPC_STRUCT_TRAITS_MEMBER(proxy_server)
+ IPC_STRUCT_TRAITS_MEMBER(is_using_lofi)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(net::RedirectInfo)
@@ -270,6 +272,10 @@ IPC_STRUCT_BEGIN(ResourceHostMsg_Request)
// Whether to intercept headers to pass back to the renderer.
IPC_STRUCT_MEMBER(bool, report_raw_headers)
+
+ // Whether or not to request a LoFi version of the resource or let the browser
+ // decide.
+ IPC_STRUCT_MEMBER(content::LoFiState, lofi_state)
IPC_STRUCT_END()
// Parameters for a ResourceMsg_RequestComplete