| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "base/time.h" | 7 #include "base/time.h" |
| 8 #include "v8/include/v8.h" | 8 #include "v8/include/v8.h" |
| 9 #include "webkit/glue/webframe.h" | 9 #include "webkit/glue/webframe.h" |
| 10 #include "webkit/glue/webdatasource.h" | 10 #include "webkit/glue/webdatasource.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 case WebNavigationTypeFormSubmitted: return "FormSubmitted"; | 48 case WebNavigationTypeFormSubmitted: return "FormSubmitted"; |
| 49 case WebNavigationTypeBackForward: return "BackForward"; | 49 case WebNavigationTypeBackForward: return "BackForward"; |
| 50 case WebNavigationTypeReload: return "Reload"; | 50 case WebNavigationTypeReload: return "Reload"; |
| 51 case WebNavigationTypeFormResubmitted: return "Resubmitted"; | 51 case WebNavigationTypeFormResubmitted: return "Resubmitted"; |
| 52 case WebNavigationTypeOther: return "Other"; | 52 case WebNavigationTypeOther: return "Other"; |
| 53 } | 53 } |
| 54 return ""; | 54 return ""; |
| 55 } | 55 } |
| 56 | 56 |
| 57 static v8::Handle<v8::Value> GetLoadTimes(const v8::Arguments& args) { | 57 static v8::Handle<v8::Value> GetLoadTimes(const v8::Arguments& args) { |
| 58 WebFrame* win_frame = WebFrame::RetrieveActiveFrame(); | 58 WebFrame* win_frame = WebFrame::RetrieveFrameForEnteredContext(); |
| 59 if (win_frame) { | 59 if (win_frame) { |
| 60 WebDataSource* data_source = win_frame->GetDataSource(); | 60 WebDataSource* data_source = win_frame->GetDataSource(); |
| 61 if (data_source) { | 61 if (data_source) { |
| 62 v8::Local<v8::Object> load_times = v8::Object::New(); | 62 v8::Local<v8::Object> load_times = v8::Object::New(); |
| 63 load_times->Set( | 63 load_times->Set( |
| 64 v8::String::New("requestTime"), | 64 v8::String::New("requestTime"), |
| 65 v8::Number::New(data_source->GetRequestTime().ToDoubleT())); | 65 v8::Number::New(data_source->GetRequestTime().ToDoubleT())); |
| 66 load_times->Set( | 66 load_times->Set( |
| 67 v8::String::New("startLoadTime"), | 67 v8::String::New("startLoadTime"), |
| 68 v8::Number::New(data_source->GetStartLoadTime().ToDoubleT())); | 68 v8::Number::New(data_source->GetStartLoadTime().ToDoubleT())); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 85 } | 85 } |
| 86 return v8::Null(); | 86 return v8::Null(); |
| 87 } | 87 } |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 v8::Extension* LoadTimesExtension::Get() { | 90 v8::Extension* LoadTimesExtension::Get() { |
| 91 return new LoadTimesExtensionWrapper(); | 91 return new LoadTimesExtensionWrapper(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace extensions_v8 | 94 } // namespace extensions_v8 |
| OLD | NEW |