| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 void V8InspectorFrontendHost::showContextMenuMethodCustom(const v8::FunctionCall
backInfo<v8::Value>& info) | 106 void V8InspectorFrontendHost::showContextMenuMethodCustom(const v8::FunctionCall
backInfo<v8::Value>& info) |
| 107 { | 107 { |
| 108 if (info.Length() < 2) | 108 if (info.Length() < 2) |
| 109 return; | 109 return; |
| 110 | 110 |
| 111 v8::Local<v8::Object> eventWrapper = v8::Local<v8::Object>::Cast(info[0]); | 111 v8::Local<v8::Object> eventWrapper = v8::Local<v8::Object>::Cast(info[0]); |
| 112 if (!V8MouseEvent::wrapperTypeInfo.equals(toWrapperTypeInfo(eventWrapper))) | 112 if (!V8MouseEvent::wrapperTypeInfo.equals(toWrapperTypeInfo(eventWrapper))) |
| 113 return; | 113 return; |
| 114 | 114 |
| 115 Event* event = V8Event::toNative(eventWrapper); | 115 Event* event = V8Event::toImpl(eventWrapper); |
| 116 if (!info[1]->IsArray()) | 116 if (!info[1]->IsArray()) |
| 117 return; | 117 return; |
| 118 | 118 |
| 119 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(info[1]); | 119 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(info[1]); |
| 120 ContextMenu menu; | 120 ContextMenu menu; |
| 121 if (!populateContextMenuItems(array, menu, info.GetIsolate())) | 121 if (!populateContextMenuItems(array, menu, info.GetIsolate())) |
| 122 return; | 122 return; |
| 123 | 123 |
| 124 InspectorFrontendHost* frontendHost = V8InspectorFrontendHost::toNative(info
.Holder()); | 124 InspectorFrontendHost* frontendHost = V8InspectorFrontendHost::toImpl(info.H
older()); |
| 125 Vector<ContextMenuItem> items = menu.items(); | 125 Vector<ContextMenuItem> items = menu.items(); |
| 126 frontendHost->showContextMenu(event, items); | 126 frontendHost->showContextMenu(event, items); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void V8InspectorFrontendHost::showContextMenuAtPointMethodCustom(const v8::Funct
ionCallbackInfo<v8::Value>& info) | 129 void V8InspectorFrontendHost::showContextMenuAtPointMethodCustom(const v8::Funct
ionCallbackInfo<v8::Value>& info) |
| 130 { | 130 { |
| 131 if (info.Length() < 3) | 131 if (info.Length() < 3) |
| 132 return; | 132 return; |
| 133 | 133 |
| 134 v8::Local<v8::Value> x = v8::Local<v8::Value>::Cast(info[0]); | 134 v8::Local<v8::Value> x = v8::Local<v8::Value>::Cast(info[0]); |
| 135 if (!x->IsNumber()) | 135 if (!x->IsNumber()) |
| 136 return; | 136 return; |
| 137 | 137 |
| 138 v8::Local<v8::Value> y = v8::Local<v8::Value>::Cast(info[1]); | 138 v8::Local<v8::Value> y = v8::Local<v8::Value>::Cast(info[1]); |
| 139 if (!y->IsNumber()) | 139 if (!y->IsNumber()) |
| 140 return; | 140 return; |
| 141 | 141 |
| 142 v8::Local<v8::Value> array = v8::Local<v8::Value>::Cast(info[2]); | 142 v8::Local<v8::Value> array = v8::Local<v8::Value>::Cast(info[2]); |
| 143 if (!array->IsArray()) | 143 if (!array->IsArray()) |
| 144 return; | 144 return; |
| 145 ContextMenu menu; | 145 ContextMenu menu; |
| 146 if (!populateContextMenuItems(v8::Local<v8::Array>::Cast(array), menu, info.
GetIsolate())) | 146 if (!populateContextMenuItems(v8::Local<v8::Array>::Cast(array), menu, info.
GetIsolate())) |
| 147 return; | 147 return; |
| 148 | 148 |
| 149 v8::Isolate* isolate = info.GetIsolate(); | 149 v8::Isolate* isolate = info.GetIsolate(); |
| 150 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototypeChai
n(isolate->GetEnteredContext()->Global(), isolate); | 150 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototypeChai
n(isolate->GetEnteredContext()->Global(), isolate); |
| 151 if (windowWrapper.IsEmpty()) | 151 if (windowWrapper.IsEmpty()) |
| 152 return; | 152 return; |
| 153 LocalDOMWindow* window = V8Window::toNative(windowWrapper); | 153 LocalDOMWindow* window = V8Window::toImpl(windowWrapper); |
| 154 if (!window->document() || !window->document()->page()) | 154 if (!window->document() || !window->document()->page()) |
| 155 return; | 155 return; |
| 156 | 156 |
| 157 InspectorFrontendHost* frontendHost = V8InspectorFrontendHost::toNative(info
.Holder()); | 157 InspectorFrontendHost* frontendHost = V8InspectorFrontendHost::toImpl(info.H
older()); |
| 158 Vector<ContextMenuItem> items = menu.items(); | 158 Vector<ContextMenuItem> items = menu.items(); |
| 159 frontendHost->showContextMenu(window->document()->page(), static_cast<float>
(x->NumberValue()), static_cast<float>(y->NumberValue()), items); | 159 frontendHost->showContextMenu(window->document()->page(), static_cast<float>
(x->NumberValue()), static_cast<float>(y->NumberValue()), items); |
| 160 } | 160 } |
| 161 | 161 |
| 162 static void histogramEnumeration(const char* name, const v8::FunctionCallbackInf
o<v8::Value>& info, int boundaryValue) | 162 static void histogramEnumeration(const char* name, const v8::FunctionCallbackInf
o<v8::Value>& info, int boundaryValue) |
| 163 { | 163 { |
| 164 if (info.Length() < 1 || !info[0]->IsInt32()) | 164 if (info.Length() < 1 || !info[0]->IsInt32()) |
| 165 return; | 165 return; |
| 166 | 166 |
| 167 int sample = info[0]->ToInt32()->Value(); | 167 int sample = info[0]->ToInt32()->Value(); |
| 168 if (sample < boundaryValue) | 168 if (sample < boundaryValue) |
| 169 blink::Platform::current()->histogramEnumeration(name, sample, boundaryV
alue); | 169 blink::Platform::current()->histogramEnumeration(name, sample, boundaryV
alue); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void V8InspectorFrontendHost::recordActionTakenMethodCustom(const v8::FunctionCa
llbackInfo<v8::Value>& info) | 172 void V8InspectorFrontendHost::recordActionTakenMethodCustom(const v8::FunctionCa
llbackInfo<v8::Value>& info) |
| 173 { | 173 { |
| 174 histogramEnumeration("DevTools.ActionTaken", info, 100); | 174 histogramEnumeration("DevTools.ActionTaken", info, 100); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void V8InspectorFrontendHost::recordPanelShownMethodCustom(const v8::FunctionCal
lbackInfo<v8::Value>& info) | 177 void V8InspectorFrontendHost::recordPanelShownMethodCustom(const v8::FunctionCal
lbackInfo<v8::Value>& info) |
| 178 { | 178 { |
| 179 histogramEnumeration("DevTools.PanelShown", info, 20); | 179 histogramEnumeration("DevTools.PanelShown", info, 20); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace blink | 182 } // namespace blink |
| 183 | 183 |
| OLD | NEW |