| 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 27 matching lines...) Expand all Loading... |
| 38 #include "core/inspector/InspectorFrontendClient.h" | 38 #include "core/inspector/InspectorFrontendClient.h" |
| 39 #include "core/loader/FrameLoader.h" | 39 #include "core/loader/FrameLoader.h" |
| 40 #include "core/page/ContextMenuController.h" | 40 #include "core/page/ContextMenuController.h" |
| 41 #include "core/page/ContextMenuProvider.h" | 41 #include "core/page/ContextMenuProvider.h" |
| 42 #include "core/page/Frame.h" | 42 #include "core/page/Frame.h" |
| 43 #include "core/page/Page.h" | 43 #include "core/page/Page.h" |
| 44 #include "core/platform/ContextMenu.h" | 44 #include "core/platform/ContextMenu.h" |
| 45 #include "core/platform/ContextMenuItem.h" | 45 #include "core/platform/ContextMenuItem.h" |
| 46 #include "core/platform/JSONValues.h" | 46 #include "core/platform/JSONValues.h" |
| 47 #include "core/platform/Pasteboard.h" | 47 #include "core/platform/Pasteboard.h" |
| 48 #include "core/platform/SharedBuffer.h" |
| 48 #include "core/platform/network/ResourceError.h" | 49 #include "core/platform/network/ResourceError.h" |
| 49 #include "core/platform/network/ResourceRequest.h" | 50 #include "core/platform/network/ResourceRequest.h" |
| 50 #include "core/platform/network/ResourceResponse.h" | 51 #include "core/platform/network/ResourceResponse.h" |
| 51 #include "core/rendering/RenderTheme.h" | 52 #include "core/rendering/RenderTheme.h" |
| 52 #include "modules/filesystem/DOMFileSystem.h" | 53 #include "modules/filesystem/DOMFileSystem.h" |
| 53 | 54 |
| 54 namespace WebCore { | 55 namespace WebCore { |
| 55 | 56 |
| 56 class FrontendMenuProvider : public ContextMenuProvider { | 57 class FrontendMenuProvider : public ContextMenuProvider { |
| 57 public: | 58 public: |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 ASSERT_NOT_REACHED(); | 212 ASSERT_NOT_REACHED(); |
| 212 return; | 213 return; |
| 213 } | 214 } |
| 214 RefPtr<FrontendMenuProvider> menuProvider = FrontendMenuProvider::create(thi
s, frontendApiObject, items); | 215 RefPtr<FrontendMenuProvider> menuProvider = FrontendMenuProvider::create(thi
s, frontendApiObject, items); |
| 215 m_frontendPage->contextMenuController().showContextMenu(event, menuProvider)
; | 216 m_frontendPage->contextMenuController().showContextMenu(event, menuProvider)
; |
| 216 m_menuProvider = menuProvider.get(); | 217 m_menuProvider = menuProvider.get(); |
| 217 } | 218 } |
| 218 | 219 |
| 219 String InspectorFrontendHost::loadResourceSynchronously(const String& url) | 220 String InspectorFrontendHost::loadResourceSynchronously(const String& url) |
| 220 { | 221 { |
| 221 ResourceRequest request(url); | 222 FetchRequest request(url, FetchInitiatorInfo()); |
| 222 request.setHTTPMethod("GET"); | 223 ResourcePtr<Resource> resource = m_frontendPage->mainFrame()->document()->fe
tcher()->fetchSynchronously(request); |
| 223 | 224 if (!resource) |
| 224 Vector<char> data; | 225 return emptyString(); |
| 225 ResourceError error; | 226 WTF::TextEncoding textEncoding(resource->response().textEncodingName()); |
| 226 ResourceResponse response; | |
| 227 m_frontendPage->mainFrame()->document()->fetcher()->fetchSynchronously(reque
st, DoNotAllowStoredCredentials, error, response, data); | |
| 228 WTF::TextEncoding textEncoding(response.textEncodingName()); | |
| 229 bool useDetector = false; | 227 bool useDetector = false; |
| 230 if (!textEncoding.isValid()) { | 228 if (!textEncoding.isValid()) { |
| 231 textEncoding = UTF8Encoding(); | 229 textEncoding = UTF8Encoding(); |
| 232 useDetector = true; | 230 useDetector = true; |
| 233 } | 231 } |
| 234 RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("text/plai
n", textEncoding, useDetector); | 232 RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("text/plai
n", textEncoding, useDetector); |
| 235 return decoder->decode(data.data(), data.size()) + decoder->flush(); | 233 SharedBuffer* data = resource->resourceBuffer(); |
| 234 return decoder->decode(data->data(), data->size()) + decoder->flush(); |
| 236 } | 235 } |
| 237 | 236 |
| 238 String InspectorFrontendHost::getSelectionBackgroundColor() | 237 String InspectorFrontendHost::getSelectionBackgroundColor() |
| 239 { | 238 { |
| 240 Color color = RenderTheme::theme().activeSelectionBackgroundColor(); | 239 Color color = RenderTheme::theme().activeSelectionBackgroundColor(); |
| 241 return color.isValid() ? color.serialized() : ""; | 240 return color.isValid() ? color.serialized() : ""; |
| 242 } | 241 } |
| 243 | 242 |
| 244 String InspectorFrontendHost::getSelectionForegroundColor() | 243 String InspectorFrontendHost::getSelectionForegroundColor() |
| 245 { | 244 { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 272 { | 271 { |
| 273 return false; | 272 return false; |
| 274 } | 273 } |
| 275 | 274 |
| 276 String InspectorFrontendHost::hiddenPanels() | 275 String InspectorFrontendHost::hiddenPanels() |
| 277 { | 276 { |
| 278 return ""; | 277 return ""; |
| 279 } | 278 } |
| 280 | 279 |
| 281 } // namespace WebCore | 280 } // namespace WebCore |
| OLD | NEW |