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

Side by Side Diff: chrome/renderer/loadtimes_extension_bindings.cc

Issue 231793004: Update a few more references to WebFrame to use WebLocalFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/external_extension.cc ('k') | chrome/renderer/principals_extension_bindings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/renderer/loadtimes_extension_bindings.h" 5 #include "chrome/renderer/loadtimes_extension_bindings.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/public/renderer/document_state.h" 10 #include "content/public/renderer/document_state.h"
11 #include "net/http/http_response_info.h" 11 #include "net/http/http_response_info.h"
12 #include "third_party/WebKit/public/web/WebFrame.h" 12 #include "third_party/WebKit/public/web/WebLocalFrame.h"
13 #include "v8/include/v8.h" 13 #include "v8/include/v8.h"
14 14
15 using blink::WebDataSource; 15 using blink::WebDataSource;
16 using blink::WebFrame; 16 using blink::WebLocalFrame;
17 using blink::WebNavigationType; 17 using blink::WebNavigationType;
18 using content::DocumentState; 18 using content::DocumentState;
19 19
20 // Values for CSI "tran" property 20 // Values for CSI "tran" property
21 const int kTransitionLink = 0; 21 const int kTransitionLink = 0;
22 const int kTransitionForwardBack = 6; 22 const int kTransitionForwardBack = 6;
23 const int kTransitionOther = 15; 23 const int kTransitionOther = 15;
24 const int kTransitionReload = 16; 24 const int kTransitionReload = 16;
25 25
26 namespace extensions_v8 { 26 namespace extensions_v8 {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return kTransitionForwardBack; 91 return kTransitionForwardBack;
92 case blink::WebNavigationTypeReload: 92 case blink::WebNavigationTypeReload:
93 return kTransitionReload; 93 return kTransitionReload;
94 case blink::WebNavigationTypeOther: 94 case blink::WebNavigationTypeOther:
95 return kTransitionOther; 95 return kTransitionOther;
96 } 96 }
97 return kTransitionOther; 97 return kTransitionOther;
98 } 98 }
99 99
100 static void GetLoadTimes(const v8::FunctionCallbackInfo<v8::Value>& args) { 100 static void GetLoadTimes(const v8::FunctionCallbackInfo<v8::Value>& args) {
101 WebFrame* frame = WebFrame::frameForCurrentContext(); 101 WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext();
102 if (frame) { 102 if (frame) {
103 WebDataSource* data_source = frame->dataSource(); 103 WebDataSource* data_source = frame->dataSource();
104 if (data_source) { 104 if (data_source) {
105 DocumentState* document_state = 105 DocumentState* document_state =
106 DocumentState::FromDataSource(data_source); 106 DocumentState::FromDataSource(data_source);
107 v8::Isolate* isolate = args.GetIsolate(); 107 v8::Isolate* isolate = args.GetIsolate();
108 v8::Local<v8::Object> load_times = v8::Object::New(isolate); 108 v8::Local<v8::Object> load_times = v8::Object::New(isolate);
109 load_times->Set( 109 load_times->Set(
110 v8::String::NewFromUtf8(isolate, "requestTime"), 110 v8::String::NewFromUtf8(isolate, "requestTime"),
111 v8::Number::New(isolate, 111 v8::Number::New(isolate,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 net::HttpResponseInfo::ConnectionInfoToString( 160 net::HttpResponseInfo::ConnectionInfoToString(
161 document_state->connection_info()).c_str())); 161 document_state->connection_info()).c_str()));
162 args.GetReturnValue().Set(load_times); 162 args.GetReturnValue().Set(load_times);
163 return; 163 return;
164 } 164 }
165 } 165 }
166 args.GetReturnValue().SetNull(); 166 args.GetReturnValue().SetNull();
167 } 167 }
168 168
169 static void GetCSI(const v8::FunctionCallbackInfo<v8::Value>& args) { 169 static void GetCSI(const v8::FunctionCallbackInfo<v8::Value>& args) {
170 WebFrame* frame = WebFrame::frameForCurrentContext(); 170 WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext();
171 if (frame) { 171 if (frame) {
172 WebDataSource* data_source = frame->dataSource(); 172 WebDataSource* data_source = frame->dataSource();
173 if (data_source) { 173 if (data_source) {
174 DocumentState* document_state = 174 DocumentState* document_state =
175 DocumentState::FromDataSource(data_source); 175 DocumentState::FromDataSource(data_source);
176 v8::Isolate* isolate = args.GetIsolate(); 176 v8::Isolate* isolate = args.GetIsolate();
177 v8::Local<v8::Object> csi = v8::Object::New(isolate); 177 v8::Local<v8::Object> csi = v8::Object::New(isolate);
178 base::Time now = base::Time::Now(); 178 base::Time now = base::Time::Now();
179 base::Time start = document_state->request_time().is_null() ? 179 base::Time start = document_state->request_time().is_null() ?
180 document_state->start_load_time() : 180 document_state->start_load_time() :
(...skipping 18 matching lines...) Expand all
199 args.GetReturnValue().SetNull(); 199 args.GetReturnValue().SetNull();
200 return; 200 return;
201 } 201 }
202 }; 202 };
203 203
204 v8::Extension* LoadTimesExtension::Get() { 204 v8::Extension* LoadTimesExtension::Get() {
205 return new LoadTimesExtensionWrapper(); 205 return new LoadTimesExtensionWrapper();
206 } 206 }
207 207
208 } // namespace extensions_v8 208 } // namespace extensions_v8
OLDNEW
« no previous file with comments | « chrome/renderer/external_extension.cc ('k') | chrome/renderer/principals_extension_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698