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

Side by Side Diff: Source/bindings/core/v8/custom/V8DevToolsHostCustom.cpp

Issue 802233004: Implement icon attribute for menuitem (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: LayoutTest rebase Created 5 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 unified diff | Download patch
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 v8::Local<v8::Value> label = item->Get(v8AtomicString(isolate, "label")) ; 66 v8::Local<v8::Value> label = item->Get(v8AtomicString(isolate, "label")) ;
67 v8::Local<v8::Value> enabled = item->Get(v8AtomicString(isolate, "enable d")); 67 v8::Local<v8::Value> enabled = item->Get(v8AtomicString(isolate, "enable d"));
68 v8::Local<v8::Value> checked = item->Get(v8AtomicString(isolate, "checke d")); 68 v8::Local<v8::Value> checked = item->Get(v8AtomicString(isolate, "checke d"));
69 v8::Local<v8::Value> subItems = item->Get(v8AtomicString(isolate, "subIt ems")); 69 v8::Local<v8::Value> subItems = item->Get(v8AtomicString(isolate, "subIt ems"));
70 if (!type->IsString()) 70 if (!type->IsString())
71 continue; 71 continue;
72 String typeString = toCoreStringWithNullCheck(type.As<v8::String>()); 72 String typeString = toCoreStringWithNullCheck(type.As<v8::String>());
73 if (typeString == "separator") { 73 if (typeString == "separator") {
74 ContextMenuItem item(ContextMenuItem(SeparatorType, 74 ContextMenuItem item(ContextMenuItem(SeparatorType,
75 ContextMenuItemCustomTagNoAction, 75 ContextMenuItemCustomTagNoAction,
76 String(),
76 String())); 77 String()));
77 menu.appendItem(item); 78 menu.appendItem(item);
78 } else if (typeString == "subMenu" && subItems->IsArray()) { 79 } else if (typeString == "subMenu" && subItems->IsArray()) {
79 ContextMenu subMenu; 80 ContextMenu subMenu;
80 v8::Local<v8::Array> subItemsArray = v8::Local<v8::Array>::Cast(subI tems); 81 v8::Local<v8::Array> subItemsArray = v8::Local<v8::Array>::Cast(subI tems);
81 if (!populateContextMenuItems(subItemsArray, subMenu, isolate)) 82 if (!populateContextMenuItems(subItemsArray, subMenu, isolate))
82 return false; 83 return false;
83 TOSTRING_DEFAULT(V8StringResource<TreatNullAsNullString>, labelStrin g, label, false); 84 TOSTRING_DEFAULT(V8StringResource<TreatNullAsNullString>, labelStrin g, label, false);
84 ContextMenuItem item(SubmenuType, 85 ContextMenuItem item(SubmenuType,
85 ContextMenuItemCustomTagNoAction, 86 ContextMenuItemCustomTagNoAction,
86 labelString, 87 labelString,
88 String(),
87 &subMenu); 89 &subMenu);
88 menu.appendItem(item); 90 menu.appendItem(item);
89 } else { 91 } else {
90 ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMe nuItemBaseCustomTag + id->ToInt32(isolate)->Value()); 92 ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMe nuItemBaseCustomTag + id->ToInt32(isolate)->Value());
91 TOSTRING_DEFAULT(V8StringResource<TreatNullAsNullString>, labelStrin g, label, false); 93 TOSTRING_DEFAULT(V8StringResource<TreatNullAsNullString>, labelStrin g, label, false);
92 ContextMenuItem menuItem((typeString == "checkbox" ? CheckableAction Type : ActionType), typedId, labelString); 94 ContextMenuItem menuItem((typeString == "checkbox" ? CheckableAction Type : ActionType), typedId, labelString, String());
93 if (checked->IsBoolean()) 95 if (checked->IsBoolean())
94 menuItem.setChecked(checked->ToBoolean(isolate)->Value()); 96 menuItem.setChecked(checked->ToBoolean(isolate)->Value());
95 if (enabled->IsBoolean()) 97 if (enabled->IsBoolean())
96 menuItem.setEnabled(enabled->ToBoolean(isolate)->Value()); 98 menuItem.setEnabled(enabled->ToBoolean(isolate)->Value());
97 menu.appendItem(menuItem); 99 menu.appendItem(menuItem);
98 } 100 }
99 } 101 }
100 return true; 102 return true;
101 } 103 }
102 104
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 if (!document || !document->page()) 162 if (!document || !document->page())
161 return; 163 return;
162 164
163 DevToolsHost* devtoolsHost = V8DevToolsHost::toImpl(info.Holder()); 165 DevToolsHost* devtoolsHost = V8DevToolsHost::toImpl(info.Holder());
164 Vector<ContextMenuItem> items = menu.items(); 166 Vector<ContextMenuItem> items = menu.items();
165 devtoolsHost->showContextMenu(document->page(), static_cast<float>(x->Number Value()), static_cast<float>(y->NumberValue()), items); 167 devtoolsHost->showContextMenu(document->page(), static_cast<float>(x->Number Value()), static_cast<float>(y->NumberValue()), items);
166 } 168 }
167 169
168 } // namespace blink 170 } // namespace blink
169 171
OLDNEW
« no previous file with comments | « LayoutTests/webexposed/element-instance-property-listing-expected.txt ('k') | Source/core/html/HTMLAttributeNames.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698