| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "platform/SharedBuffer.h" | 54 #include "platform/SharedBuffer.h" |
| 55 #include "platform/UserGestureIndicator.h" | 55 #include "platform/UserGestureIndicator.h" |
| 56 #include "platform/network/ResourceError.h" | 56 #include "platform/network/ResourceError.h" |
| 57 #include "platform/network/ResourceRequest.h" | 57 #include "platform/network/ResourceRequest.h" |
| 58 #include "platform/network/ResourceResponse.h" | 58 #include "platform/network/ResourceResponse.h" |
| 59 | 59 |
| 60 namespace blink { | 60 namespace blink { |
| 61 | 61 |
| 62 class FrontendMenuProvider final : public ContextMenuProvider { | 62 class FrontendMenuProvider final : public ContextMenuProvider { |
| 63 public: | 63 public: |
| 64 static PassRefPtrWillBeRawPtr<FrontendMenuProvider> create(DevToolsHost* dev
toolsHost, const Vector<ContextMenuItem>& items) | 64 static RawPtr<FrontendMenuProvider> create(DevToolsHost* devtoolsHost, const
Vector<ContextMenuItem>& items) |
| 65 { | 65 { |
| 66 return adoptRefWillBeNoop(new FrontendMenuProvider(devtoolsHost, items))
; | 66 return (new FrontendMenuProvider(devtoolsHost, items)); |
| 67 } | 67 } |
| 68 | 68 |
| 69 ~FrontendMenuProvider() override | 69 ~FrontendMenuProvider() override |
| 70 { | 70 { |
| 71 // Verify that this menu provider has been detached. | 71 // Verify that this menu provider has been detached. |
| 72 ASSERT(!m_devtoolsHost); | 72 ASSERT(!m_devtoolsHost); |
| 73 } | 73 } |
| 74 | 74 |
| 75 DEFINE_INLINE_VIRTUAL_TRACE() | 75 DEFINE_INLINE_VIRTUAL_TRACE() |
| 76 { | 76 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 107 m_devtoolsHost->evaluateScript("DevToolsAPI.contextMenuItemSelected(" +
String::number(itemNumber) + ")"); | 107 m_devtoolsHost->evaluateScript("DevToolsAPI.contextMenuItemSelected(" +
String::number(itemNumber) + ")"); |
| 108 } | 108 } |
| 109 | 109 |
| 110 private: | 110 private: |
| 111 FrontendMenuProvider(DevToolsHost* devtoolsHost, const Vector<ContextMenuIte
m>& items) | 111 FrontendMenuProvider(DevToolsHost* devtoolsHost, const Vector<ContextMenuIte
m>& items) |
| 112 : m_devtoolsHost(devtoolsHost) | 112 : m_devtoolsHost(devtoolsHost) |
| 113 , m_items(items) | 113 , m_items(items) |
| 114 { | 114 { |
| 115 } | 115 } |
| 116 | 116 |
| 117 RawPtrWillBeMember<DevToolsHost> m_devtoolsHost; | 117 Member<DevToolsHost> m_devtoolsHost; |
| 118 Vector<ContextMenuItem> m_items; | 118 Vector<ContextMenuItem> m_items; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 DevToolsHost::DevToolsHost(InspectorFrontendClient* client, LocalFrame* frontend
Frame) | 121 DevToolsHost::DevToolsHost(InspectorFrontendClient* client, LocalFrame* frontend
Frame) |
| 122 : m_client(client) | 122 : m_client(client) |
| 123 , m_frontendFrame(frontendFrame) | 123 , m_frontendFrame(frontendFrame) |
| 124 , m_menuProvider(nullptr) | 124 , m_menuProvider(nullptr) |
| 125 { | 125 { |
| 126 } | 126 } |
| 127 | 127 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 214 |
| 215 void DevToolsHost::sendMessageToEmbedder(const String& message) | 215 void DevToolsHost::sendMessageToEmbedder(const String& message) |
| 216 { | 216 { |
| 217 if (m_client) | 217 if (m_client) |
| 218 m_client->sendMessageToEmbedder(escapeUnicodeNonCharacters(message)); | 218 m_client->sendMessageToEmbedder(escapeUnicodeNonCharacters(message)); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void DevToolsHost::showContextMenu(LocalFrame* targetFrame, float x, float y, co
nst Vector<ContextMenuItem>& items) | 221 void DevToolsHost::showContextMenu(LocalFrame* targetFrame, float x, float y, co
nst Vector<ContextMenuItem>& items) |
| 222 { | 222 { |
| 223 ASSERT(m_frontendFrame); | 223 ASSERT(m_frontendFrame); |
| 224 RefPtrWillBeRawPtr<FrontendMenuProvider> menuProvider = FrontendMenuProvider
::create(this, items); | 224 RawPtr<FrontendMenuProvider> menuProvider = FrontendMenuProvider::create(thi
s, items); |
| 225 m_menuProvider = menuProvider.get(); | 225 m_menuProvider = menuProvider.get(); |
| 226 float zoom = targetFrame->pageZoomFactor(); | 226 float zoom = targetFrame->pageZoomFactor(); |
| 227 if (m_client) | 227 if (m_client) |
| 228 m_client->showContextMenu(targetFrame, x * zoom, y * zoom, menuProvider)
; | 228 m_client->showContextMenu(targetFrame, x * zoom, y * zoom, menuProvider)
; |
| 229 } | 229 } |
| 230 | 230 |
| 231 String DevToolsHost::getSelectionBackgroundColor() | 231 String DevToolsHost::getSelectionBackgroundColor() |
| 232 { | 232 { |
| 233 return LayoutTheme::theme().activeSelectionBackgroundColor().serialized(); | 233 return LayoutTheme::theme().activeSelectionBackgroundColor().serialized(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 String DevToolsHost::getSelectionForegroundColor() | 236 String DevToolsHost::getSelectionForegroundColor() |
| 237 { | 237 { |
| 238 return LayoutTheme::theme().activeSelectionForegroundColor().serialized(); | 238 return LayoutTheme::theme().activeSelectionForegroundColor().serialized(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 bool DevToolsHost::isUnderTest() | 241 bool DevToolsHost::isUnderTest() |
| 242 { | 242 { |
| 243 return m_client && m_client->isUnderTest(); | 243 return m_client && m_client->isUnderTest(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 bool DevToolsHost::isHostedMode() | 246 bool DevToolsHost::isHostedMode() |
| 247 { | 247 { |
| 248 return false; | 248 return false; |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace blink | 251 } // namespace blink |
| OLD | NEW |