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

Unified Diff: chrome/renderer/loadtimes_extension_bindings.cc

Issue 2655143002: Drop replacesCurrentHistoryItem, NavigationType (Closed)
Patch Set: More compile fixes Created 3 years, 11 months 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
Index: chrome/renderer/loadtimes_extension_bindings.cc
diff --git a/chrome/renderer/loadtimes_extension_bindings.cc b/chrome/renderer/loadtimes_extension_bindings.cc
index 39a248ab73d6c702f56a700bd98a1ef70d637034..553e3c625aae6a5319ad23ad78ffab480fa5114d 100644
--- a/chrome/renderer/loadtimes_extension_bindings.cc
+++ b/chrome/renderer/loadtimes_extension_bindings.cc
@@ -16,15 +16,11 @@
using blink::WebDataSource;
using blink::WebLocalFrame;
-using blink::WebNavigationType;
using blink::WebPerformance;
using content::DocumentState;
// Values for CSI "tran" property
-const int kTransitionLink = 0;
-const int kTransitionForwardBack = 6;
const int kTransitionOther = 15;
-const int kTransitionReload = 16;
namespace extensions_v8 {
@@ -40,7 +36,8 @@ class LoadTimesExtensionWrapper : public v8::Extension {
// (this is before the onload() method is fired)
// finishLoadTime: The time all loading is done, after the onload()
// method and all resources
- // navigationType: A string describing what user action initiated the load
+ // navigationType: A string describing what user action initiated the load,
+ // now hard-coded to "Other"
//
// Note that chrome.loadTimes() is deprecated in favor of performance.timing.
// Many of the timings reported via chrome.loadTimes() match timings available
@@ -72,40 +69,6 @@ class LoadTimesExtensionWrapper : public v8::Extension {
return v8::Local<v8::FunctionTemplate>();
}
- static const char* GetNavigationType(WebNavigationType nav_type) {
- switch (nav_type) {
- case blink::WebNavigationTypeLinkClicked:
- return "LinkClicked";
- case blink::WebNavigationTypeFormSubmitted:
- return "FormSubmitted";
- case blink::WebNavigationTypeBackForward:
- return "BackForward";
- case blink::WebNavigationTypeReload:
- return "Reload";
- case blink::WebNavigationTypeFormResubmitted:
- return "Resubmitted";
- case blink::WebNavigationTypeOther:
- return "Other";
- }
- return "";
- }
-
- static int GetCSITransitionType(WebNavigationType nav_type) {
- switch (nav_type) {
- case blink::WebNavigationTypeLinkClicked:
- case blink::WebNavigationTypeFormSubmitted:
- case blink::WebNavigationTypeFormResubmitted:
- return kTransitionLink;
- case blink::WebNavigationTypeBackForward:
- return kTransitionForwardBack;
- case blink::WebNavigationTypeReload:
- return kTransitionReload;
- case blink::WebNavigationTypeOther:
- return kTransitionOther;
- }
- return kTransitionOther;
- }
-
static void LoadtimesGetter(
v8::Local<v8::Name> name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
@@ -165,8 +128,6 @@ class LoadTimesExtensionWrapper : public v8::Extension {
// long before the load event fires. We report a time of zero for the
// time being.
double first_paint_after_load_time = 0.0;
- std::string navigation_type =
- GetNavigationType(data_source->navigationType());
bool was_fetched_via_spdy = document_state->was_fetched_via_spdy();
bool was_alpn_negotiated = document_state->was_alpn_negotiated();
std::string alpn_negotiated_protocol =
@@ -260,17 +221,16 @@ class LoadTimesExtensionWrapper : public v8::Extension {
.FromMaybe(false)) {
return;
}
- if (!load_times->SetAccessor(
- ctx,
- v8::String::NewFromUtf8(
- isolate, "navigationType", v8::NewStringType::kNormal)
- .ToLocalChecked(),
- LoadtimesGetter,
- nullptr,
- v8::String::NewFromUtf8(isolate, navigation_type.c_str(),
- v8::NewStringType::kNormal)
- .ToLocalChecked())
- .FromMaybe(false)) {
+ if (!load_times
+ ->SetAccessor(ctx,
+ v8::String::NewFromUtf8(isolate, "navigationType",
+ v8::NewStringType::kNormal)
+ .ToLocalChecked(),
+ LoadtimesGetter, nullptr,
+ v8::String::NewFromUtf8(isolate, "Other",
+ v8::NewStringType::kNormal)
+ .ToLocalChecked())
+ .FromMaybe(false)) {
return;
}
if (!load_times->SetAccessor(
@@ -354,7 +314,6 @@ class LoadTimesExtensionWrapper : public v8::Extension {
base::Time dom_content_loaded_end =
base::Time::FromDoubleT(web_performance.domContentLoadedEventEnd());
base::TimeDelta page = now - start;
- int navigation_type = GetCSITransitionType(data_source->navigationType());
// Important: |frame| and |data_source| should not be referred to below this
// line, as JS setters below can invalidate these pointers.
v8::Isolate* isolate = args.GetIsolate();
@@ -388,7 +347,7 @@ class LoadTimesExtensionWrapper : public v8::Extension {
if (!csi->Set(ctx, v8::String::NewFromUtf8(isolate, "tran",
v8::NewStringType::kNormal)
.ToLocalChecked(),
- v8::Number::New(isolate, navigation_type))
+ v8::Number::New(isolate, kTransitionOther))
.FromMaybe(false)) {
return;
}
« no previous file with comments | « android_webview/renderer/aw_content_renderer_client.cc ('k') | components/test_runner/web_frame_test_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698