| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 namespace blink { | 57 namespace blink { |
| 58 | 58 |
| 59 class FrontendMenuProvider final : public ContextMenuProvider { | 59 class FrontendMenuProvider final : public ContextMenuProvider { |
| 60 public: | 60 public: |
| 61 static PassRefPtrWillBeRawPtr<FrontendMenuProvider> create(DevToolsHost* dev
toolsHost, ScriptValue devtoolsApiObject, const Vector<ContextMenuItem>& items) | 61 static PassRefPtrWillBeRawPtr<FrontendMenuProvider> create(DevToolsHost* dev
toolsHost, ScriptValue devtoolsApiObject, const Vector<ContextMenuItem>& items) |
| 62 { | 62 { |
| 63 return adoptRefWillBeNoop(new FrontendMenuProvider(devtoolsHost, devtool
sApiObject, items)); | 63 return adoptRefWillBeNoop(new FrontendMenuProvider(devtoolsHost, devtool
sApiObject, items)); |
| 64 } | 64 } |
| 65 | 65 |
| 66 virtual ~FrontendMenuProvider() | 66 ~FrontendMenuProvider() override |
| 67 { | 67 { |
| 68 // Verify that this menu provider has been detached. | 68 // Verify that this menu provider has been detached. |
| 69 ASSERT(!m_devtoolsHost); | 69 ASSERT(!m_devtoolsHost); |
| 70 } | 70 } |
| 71 | 71 |
| 72 DEFINE_INLINE_VIRTUAL_TRACE() | 72 DEFINE_INLINE_VIRTUAL_TRACE() |
| 73 { | 73 { |
| 74 visitor->trace(m_devtoolsHost); | 74 visitor->trace(m_devtoolsHost); |
| 75 ContextMenuProvider::trace(visitor); | 75 ContextMenuProvider::trace(visitor); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void disconnect() | 78 void disconnect() |
| 79 { | 79 { |
| 80 m_devtoolsApiObject = ScriptValue(); | 80 m_devtoolsApiObject = ScriptValue(); |
| 81 m_devtoolsHost = nullptr; | 81 m_devtoolsHost = nullptr; |
| 82 } | 82 } |
| 83 | 83 |
| 84 virtual void contextMenuCleared() override | 84 void contextMenuCleared() override |
| 85 { | 85 { |
| 86 if (m_devtoolsHost) { | 86 if (m_devtoolsHost) { |
| 87 ScriptFunctionCall function(m_devtoolsApiObject, "contextMenuCleared
"); | 87 ScriptFunctionCall function(m_devtoolsApiObject, "contextMenuCleared
"); |
| 88 function.call(); | 88 function.call(); |
| 89 | 89 |
| 90 m_devtoolsHost->clearMenuProvider(); | 90 m_devtoolsHost->clearMenuProvider(); |
| 91 m_devtoolsHost = nullptr; | 91 m_devtoolsHost = nullptr; |
| 92 } | 92 } |
| 93 m_items.clear(); | 93 m_items.clear(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 virtual void populateContextMenu(ContextMenu* menu) override | 96 void populateContextMenu(ContextMenu* menu) override |
| 97 { | 97 { |
| 98 for (size_t i = 0; i < m_items.size(); ++i) | 98 for (size_t i = 0; i < m_items.size(); ++i) |
| 99 menu->appendItem(m_items[i]); | 99 menu->appendItem(m_items[i]); |
| 100 } | 100 } |
| 101 | 101 |
| 102 virtual void contextMenuItemSelected(const ContextMenuItem* item) override | 102 void contextMenuItemSelected(const ContextMenuItem* item) override |
| 103 { | 103 { |
| 104 if (!m_devtoolsHost) | 104 if (!m_devtoolsHost) |
| 105 return; | 105 return; |
| 106 | 106 |
| 107 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture
); | 107 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture
); |
| 108 int itemNumber = item->action() - ContextMenuItemBaseCustomTag; | 108 int itemNumber = item->action() - ContextMenuItemBaseCustomTag; |
| 109 | 109 |
| 110 ScriptFunctionCall function(m_devtoolsApiObject, "contextMenuItemSelecte
d"); | 110 ScriptFunctionCall function(m_devtoolsApiObject, "contextMenuItemSelecte
d"); |
| 111 function.appendArgument(itemNumber); | 111 function.appendArgument(itemNumber); |
| 112 function.call(); | 112 function.call(); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 { | 257 { |
| 258 return m_client && m_client->isUnderTest(); | 258 return m_client && m_client->isUnderTest(); |
| 259 } | 259 } |
| 260 | 260 |
| 261 bool DevToolsHost::isHostedMode() | 261 bool DevToolsHost::isHostedMode() |
| 262 { | 262 { |
| 263 return false; | 263 return false; |
| 264 } | 264 } |
| 265 | 265 |
| 266 } // namespace blink | 266 } // namespace blink |
| OLD | NEW |