| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 ScriptValue devtoolsApiObject = frontendScriptState->getFromGlobalObject("De
vToolsAPI"); | 208 ScriptValue devtoolsApiObject = frontendScriptState->getFromGlobalObject("De
vToolsAPI"); |
| 209 ASSERT(devtoolsApiObject.isObject()); | 209 ASSERT(devtoolsApiObject.isObject()); |
| 210 | 210 |
| 211 RefPtrWillBeRawPtr<FrontendMenuProvider> menuProvider = FrontendMenuProvider
::create(this, devtoolsApiObject, items); | 211 RefPtrWillBeRawPtr<FrontendMenuProvider> menuProvider = FrontendMenuProvider
::create(this, devtoolsApiObject, items); |
| 212 m_menuProvider = menuProvider.get(); | 212 m_menuProvider = menuProvider.get(); |
| 213 float zoom = targetFrame->pageZoomFactor(); | 213 float zoom = targetFrame->pageZoomFactor(); |
| 214 if (m_client) | 214 if (m_client) |
| 215 m_client->showContextMenu(targetFrame, x * zoom, y * zoom, menuProvider)
; | 215 m_client->showContextMenu(targetFrame, x * zoom, y * zoom, menuProvider)
; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void DevToolsHost::showContextMenu(Event* event, const Vector<ContextMenuItem>&
items) | |
| 219 { | |
| 220 if (!event) | |
| 221 return; | |
| 222 | |
| 223 ASSERT(m_frontendFrame); | |
| 224 ScriptState* frontendScriptState = ScriptState::forMainWorld(m_frontendFrame
); | |
| 225 ScriptValue devtoolsApiObject = frontendScriptState->getFromGlobalObject("De
vToolsAPI"); | |
| 226 ASSERT(devtoolsApiObject.isObject()); | |
| 227 | |
| 228 Page* targetPage = m_frontendFrame->page(); | |
| 229 if (event->target() && event->target()->executionContext() && event->target(
)->executionContext()->executingWindow()) { | |
| 230 LocalDOMWindow* window = event->target()->executionContext()->executingW
indow(); | |
| 231 if (window->document() && window->document()->page()) | |
| 232 targetPage = window->document()->page(); | |
| 233 } | |
| 234 | |
| 235 RefPtrWillBeRawPtr<FrontendMenuProvider> menuProvider = FrontendMenuProvider
::create(this, devtoolsApiObject, items); | |
| 236 targetPage->contextMenuController().showContextMenu(event, menuProvider); | |
| 237 m_menuProvider = menuProvider.get(); | |
| 238 } | |
| 239 | |
| 240 String DevToolsHost::getSelectionBackgroundColor() | 218 String DevToolsHost::getSelectionBackgroundColor() |
| 241 { | 219 { |
| 242 return LayoutTheme::theme().activeSelectionBackgroundColor().serialized(); | 220 return LayoutTheme::theme().activeSelectionBackgroundColor().serialized(); |
| 243 } | 221 } |
| 244 | 222 |
| 245 String DevToolsHost::getSelectionForegroundColor() | 223 String DevToolsHost::getSelectionForegroundColor() |
| 246 { | 224 { |
| 247 return LayoutTheme::theme().activeSelectionForegroundColor().serialized(); | 225 return LayoutTheme::theme().activeSelectionForegroundColor().serialized(); |
| 248 } | 226 } |
| 249 | 227 |
| 250 bool DevToolsHost::isUnderTest() | 228 bool DevToolsHost::isUnderTest() |
| 251 { | 229 { |
| 252 return m_client && m_client->isUnderTest(); | 230 return m_client && m_client->isUnderTest(); |
| 253 } | 231 } |
| 254 | 232 |
| 255 bool DevToolsHost::isHostedMode() | 233 bool DevToolsHost::isHostedMode() |
| 256 { | 234 { |
| 257 return false; | 235 return false; |
| 258 } | 236 } |
| 259 | 237 |
| 260 } // namespace blink | 238 } // namespace blink |
| OLD | NEW |