| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 class FrontendMenuProvider final : public ContextMenuProvider { | 63 class FrontendMenuProvider final : public ContextMenuProvider { |
| 64 public: | 64 public: |
| 65 static FrontendMenuProvider* Create(DevToolsHost* devtools_host, | 65 static FrontendMenuProvider* Create(DevToolsHost* devtools_host, |
| 66 const Vector<ContextMenuItem>& items) { | 66 const Vector<ContextMenuItem>& items) { |
| 67 return new FrontendMenuProvider(devtools_host, items); | 67 return new FrontendMenuProvider(devtools_host, items); |
| 68 } | 68 } |
| 69 | 69 |
| 70 ~FrontendMenuProvider() override { | 70 ~FrontendMenuProvider() override { |
| 71 // Verify that this menu provider has been detached. | 71 // Verify that this menu provider has been detached. |
| 72 ASSERT(!devtools_host_); | 72 DCHECK(!devtools_host_); |
| 73 } | 73 } |
| 74 | 74 |
| 75 DEFINE_INLINE_VIRTUAL_TRACE() { | 75 DEFINE_INLINE_VIRTUAL_TRACE() { |
| 76 visitor->Trace(devtools_host_); | 76 visitor->Trace(devtools_host_); |
| 77 ContextMenuProvider::Trace(visitor); | 77 ContextMenuProvider::Trace(visitor); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void Disconnect() { devtools_host_ = nullptr; } | 80 void Disconnect() { devtools_host_ = nullptr; } |
| 81 | 81 |
| 82 void ContextMenuCleared() override { | 82 void ContextMenuCleared() override { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 110 Vector<ContextMenuItem> items_; | 110 Vector<ContextMenuItem> items_; |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 DevToolsHost::DevToolsHost(InspectorFrontendClient* client, | 113 DevToolsHost::DevToolsHost(InspectorFrontendClient* client, |
| 114 LocalFrame* frontend_frame) | 114 LocalFrame* frontend_frame) |
| 115 : client_(client), | 115 : client_(client), |
| 116 frontend_frame_(frontend_frame), | 116 frontend_frame_(frontend_frame), |
| 117 menu_provider_(nullptr) {} | 117 menu_provider_(nullptr) {} |
| 118 | 118 |
| 119 DevToolsHost::~DevToolsHost() { | 119 DevToolsHost::~DevToolsHost() { |
| 120 ASSERT(!client_); | 120 DCHECK(!client_); |
| 121 } | 121 } |
| 122 | 122 |
| 123 DEFINE_TRACE(DevToolsHost) { | 123 DEFINE_TRACE(DevToolsHost) { |
| 124 visitor->Trace(frontend_frame_); | 124 visitor->Trace(frontend_frame_); |
| 125 visitor->Trace(menu_provider_); | 125 visitor->Trace(menu_provider_); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void DevToolsHost::EvaluateScript(const String& expression) { | 128 void DevToolsHost::EvaluateScript(const String& expression) { |
| 129 if (ScriptForbiddenScope::IsScriptForbidden()) | 129 if (ScriptForbiddenScope::IsScriptForbidden()) |
| 130 return; | 130 return; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 202 |
| 203 void DevToolsHost::sendMessageToEmbedder(const String& message) { | 203 void DevToolsHost::sendMessageToEmbedder(const String& message) { |
| 204 if (client_) | 204 if (client_) |
| 205 client_->SendMessageToEmbedder(EscapeUnicodeNonCharacters(message)); | 205 client_->SendMessageToEmbedder(EscapeUnicodeNonCharacters(message)); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void DevToolsHost::ShowContextMenu(LocalFrame* target_frame, | 208 void DevToolsHost::ShowContextMenu(LocalFrame* target_frame, |
| 209 float x, | 209 float x, |
| 210 float y, | 210 float y, |
| 211 const Vector<ContextMenuItem>& items) { | 211 const Vector<ContextMenuItem>& items) { |
| 212 ASSERT(frontend_frame_); | 212 DCHECK(frontend_frame_); |
| 213 FrontendMenuProvider* menu_provider = | 213 FrontendMenuProvider* menu_provider = |
| 214 FrontendMenuProvider::Create(this, items); | 214 FrontendMenuProvider::Create(this, items); |
| 215 menu_provider_ = menu_provider; | 215 menu_provider_ = menu_provider; |
| 216 float zoom = target_frame->PageZoomFactor(); | 216 float zoom = target_frame->PageZoomFactor(); |
| 217 if (client_) | 217 if (client_) |
| 218 client_->ShowContextMenu(target_frame, x * zoom, y * zoom, menu_provider); | 218 client_->ShowContextMenu(target_frame, x * zoom, y * zoom, menu_provider); |
| 219 } | 219 } |
| 220 | 220 |
| 221 String DevToolsHost::getSelectionBackgroundColor() { | 221 String DevToolsHost::getSelectionBackgroundColor() { |
| 222 return LayoutTheme::GetTheme().ActiveSelectionBackgroundColor().Serialized(); | 222 return LayoutTheme::GetTheme().ActiveSelectionBackgroundColor().Serialized(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 String DevToolsHost::getSelectionForegroundColor() { | 225 String DevToolsHost::getSelectionForegroundColor() { |
| 226 return LayoutTheme::GetTheme().ActiveSelectionForegroundColor().Serialized(); | 226 return LayoutTheme::GetTheme().ActiveSelectionForegroundColor().Serialized(); |
| 227 } | 227 } |
| 228 | 228 |
| 229 bool DevToolsHost::isUnderTest() { | 229 bool DevToolsHost::isUnderTest() { |
| 230 return client_ && client_->IsUnderTest(); | 230 return client_ && client_->IsUnderTest(); |
| 231 } | 231 } |
| 232 | 232 |
| 233 bool DevToolsHost::isHostedMode() { | 233 bool DevToolsHost::isHostedMode() { |
| 234 return false; | 234 return false; |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace blink | 237 } // namespace blink |
| OLD | NEW |