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