| 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 23 matching lines...) Expand all Loading... |
| 34 #include "V8MouseEvent.h" | 34 #include "V8MouseEvent.h" |
| 35 #include "bindings/v8/V8Binding.h" | 35 #include "bindings/v8/V8Binding.h" |
| 36 #include "core/inspector/InspectorController.h" | 36 #include "core/inspector/InspectorController.h" |
| 37 #include "core/inspector/InspectorFrontendClient.h" | 37 #include "core/inspector/InspectorFrontendClient.h" |
| 38 #include "core/inspector/InspectorFrontendHost.h" | 38 #include "core/inspector/InspectorFrontendHost.h" |
| 39 #include "public/platform/Platform.h" | 39 #include "public/platform/Platform.h" |
| 40 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 void V8InspectorFrontendHost::platformMethodCustom(const v8::FunctionCallbackInf
o<v8::Value>& args) | 44 void V8InspectorFrontendHost::platformMethodCustom(const v8::FunctionCallbackInf
o<v8::Value>& info) |
| 45 { | 45 { |
| 46 #if OS(MACOSX) | 46 #if OS(MACOSX) |
| 47 v8SetReturnValue(args, v8::String::NewSymbol("mac")); | 47 v8SetReturnValue(info, v8::String::NewSymbol("mac")); |
| 48 #elif OS(WIN) | 48 #elif OS(WIN) |
| 49 v8SetReturnValue(args, v8::String::NewSymbol("windows")); | 49 v8SetReturnValue(info, v8::String::NewSymbol("windows")); |
| 50 #else // Unix-like systems | 50 #else // Unix-like systems |
| 51 v8SetReturnValue(args, v8::String::NewSymbol("linux")); | 51 v8SetReturnValue(info, v8::String::NewSymbol("linux")); |
| 52 #endif | 52 #endif |
| 53 } | 53 } |
| 54 | 54 |
| 55 void V8InspectorFrontendHost::portMethodCustom(const v8::FunctionCallbackInfo<v8
::Value>&) | 55 void V8InspectorFrontendHost::portMethodCustom(const v8::FunctionCallbackInfo<v8
::Value>&) |
| 56 { | 56 { |
| 57 } | 57 } |
| 58 | 58 |
| 59 static void populateContextMenuItems(v8::Local<v8::Array>& itemArray, ContextMen
u& menu) | 59 static void populateContextMenuItems(v8::Local<v8::Array>& itemArray, ContextMen
u& menu) |
| 60 { | 60 { |
| 61 for (size_t i = 0; i < itemArray->Length(); ++i) { | 61 for (size_t i = 0; i < itemArray->Length(); ++i) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 88 ContextMenuItem menuItem((typeString == "checkbox" ? CheckableAction
Type : ActionType), typedId, toWebCoreStringWithNullCheck(label)); | 88 ContextMenuItem menuItem((typeString == "checkbox" ? CheckableAction
Type : ActionType), typedId, toWebCoreStringWithNullCheck(label)); |
| 89 if (checked->IsBoolean()) | 89 if (checked->IsBoolean()) |
| 90 menuItem.setChecked(checked->ToBoolean()->Value()); | 90 menuItem.setChecked(checked->ToBoolean()->Value()); |
| 91 if (enabled->IsBoolean()) | 91 if (enabled->IsBoolean()) |
| 92 menuItem.setEnabled(enabled->ToBoolean()->Value()); | 92 menuItem.setEnabled(enabled->ToBoolean()->Value()); |
| 93 menu.appendItem(menuItem); | 93 menu.appendItem(menuItem); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 void V8InspectorFrontendHost::showContextMenuMethodCustom(const v8::FunctionCall
backInfo<v8::Value>& args) | 98 void V8InspectorFrontendHost::showContextMenuMethodCustom(const v8::FunctionCall
backInfo<v8::Value>& info) |
| 99 { | 99 { |
| 100 if (args.Length() < 2) | 100 if (info.Length() < 2) |
| 101 return; | 101 return; |
| 102 | 102 |
| 103 v8::Local<v8::Object> eventWrapper = v8::Local<v8::Object>::Cast(args[0]); | 103 v8::Local<v8::Object> eventWrapper = v8::Local<v8::Object>::Cast(info[0]); |
| 104 if (!V8MouseEvent::wrapperTypeInfo.equals(toWrapperTypeInfo(eventWrapper))) | 104 if (!V8MouseEvent::wrapperTypeInfo.equals(toWrapperTypeInfo(eventWrapper))) |
| 105 return; | 105 return; |
| 106 | 106 |
| 107 Event* event = V8Event::toNative(eventWrapper); | 107 Event* event = V8Event::toNative(eventWrapper); |
| 108 if (!args[1]->IsArray()) | 108 if (!info[1]->IsArray()) |
| 109 return; | 109 return; |
| 110 | 110 |
| 111 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(args[1]); | 111 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(info[1]); |
| 112 ContextMenu menu; | 112 ContextMenu menu; |
| 113 populateContextMenuItems(array, menu); | 113 populateContextMenuItems(array, menu); |
| 114 | 114 |
| 115 InspectorFrontendHost* frontendHost = V8InspectorFrontendHost::toNative(args
.Holder()); | 115 InspectorFrontendHost* frontendHost = V8InspectorFrontendHost::toNative(info
.Holder()); |
| 116 Vector<ContextMenuItem> items = menu.items(); | 116 Vector<ContextMenuItem> items = menu.items(); |
| 117 frontendHost->showContextMenu(event, items); | 117 frontendHost->showContextMenu(event, items); |
| 118 } | 118 } |
| 119 | 119 |
| 120 static void histogramEnumeration(const char* name, const v8::FunctionCallbackInf
o<v8::Value>& args, int boundaryValue) | 120 static void histogramEnumeration(const char* name, const v8::FunctionCallbackInf
o<v8::Value>& info, int boundaryValue) |
| 121 { | 121 { |
| 122 if (args.Length() < 1 || !args[0]->IsInt32()) | 122 if (info.Length() < 1 || !info[0]->IsInt32()) |
| 123 return; | 123 return; |
| 124 | 124 |
| 125 int sample = args[0]->ToInt32()->Value(); | 125 int sample = info[0]->ToInt32()->Value(); |
| 126 if (sample < boundaryValue) | 126 if (sample < boundaryValue) |
| 127 WebKit::Platform::current()->histogramEnumeration(name, sample, boundary
Value); | 127 WebKit::Platform::current()->histogramEnumeration(name, sample, boundary
Value); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void V8InspectorFrontendHost::recordActionTakenMethodCustom(const v8::FunctionCa
llbackInfo<v8::Value>& args) | 130 void V8InspectorFrontendHost::recordActionTakenMethodCustom(const v8::FunctionCa
llbackInfo<v8::Value>& info) |
| 131 { | 131 { |
| 132 histogramEnumeration("DevTools.ActionTaken", args, 100); | 132 histogramEnumeration("DevTools.ActionTaken", info, 100); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void V8InspectorFrontendHost::recordPanelShownMethodCustom(const v8::FunctionCal
lbackInfo<v8::Value>& args) | 135 void V8InspectorFrontendHost::recordPanelShownMethodCustom(const v8::FunctionCal
lbackInfo<v8::Value>& info) |
| 136 { | 136 { |
| 137 histogramEnumeration("DevTools.PanelShown", args, 20); | 137 histogramEnumeration("DevTools.PanelShown", info, 20); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void V8InspectorFrontendHost::recordSettingChangedMethodCustom(const v8::Functio
nCallbackInfo<v8::Value>& args) | 140 void V8InspectorFrontendHost::recordSettingChangedMethodCustom(const v8::Functio
nCallbackInfo<v8::Value>& info) |
| 141 { | 141 { |
| 142 histogramEnumeration("DevTools.SettingChanged", args, 100); | 142 histogramEnumeration("DevTools.SettingChanged", info, 100); |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace WebCore | 145 } // namespace WebCore |
| 146 | 146 |
| OLD | NEW |