OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 bool InspectorResourceAgent::resourceContentBase64(Frame* frame, const KURL& url
, String* result) | 96 bool InspectorResourceAgent::resourceContentBase64(Frame* frame, const KURL& url
, String* result) |
97 { | 97 { |
98 Vector<char> out; | 98 Vector<char> out; |
99 String textEncodingName; | 99 String textEncodingName; |
100 RefPtr<SharedBuffer> data = InspectorResourceAgent::resourceData(frame, url,
&textEncodingName); | 100 RefPtr<SharedBuffer> data = InspectorResourceAgent::resourceData(frame, url,
&textEncodingName); |
101 if (!data) { | 101 if (!data) { |
102 *result = String(); | 102 *result = String(); |
103 return false; | 103 return false; |
104 } | 104 } |
105 | 105 |
106 base64Encode(data->buffer(), out); | 106 base64Encode(data->data(), data->size(), out); |
107 *result = String(out.data(), out.size()); | 107 *result = String(out.data(), out.size()); |
108 return true; | 108 return true; |
109 } | 109 } |
110 | 110 |
111 PassRefPtr<SharedBuffer> InspectorResourceAgent::resourceData(Frame* frame, cons
t KURL& url, String* textEncodingName) | 111 PassRefPtr<SharedBuffer> InspectorResourceAgent::resourceData(Frame* frame, cons
t KURL& url, String* textEncodingName) |
112 { | 112 { |
113 FrameLoader* frameLoader = frame->loader(); | 113 FrameLoader* frameLoader = frame->loader(); |
114 DocumentLoader* loader = frameLoader->documentLoader(); | 114 DocumentLoader* loader = frameLoader->documentLoader(); |
115 if (equalIgnoringFragmentIdentifier(url, loader->url())) { | 115 if (equalIgnoringFragmentIdentifier(url, loader->url())) { |
116 *textEncodingName = frame->document()->inputEncoding(); | 116 *textEncodingName = frame->document()->inputEncoding(); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 : m_page(page) | 489 : m_page(page) |
490 , m_state(state) | 490 , m_state(state) |
491 , m_frontend(frontend) | 491 , m_frontend(frontend) |
492 { | 492 { |
493 m_state->setBoolean(InspectorState::resourceAgentEnabled, true); | 493 m_state->setBoolean(InspectorState::resourceAgentEnabled, true); |
494 } | 494 } |
495 | 495 |
496 } // namespace WebCore | 496 } // namespace WebCore |
497 | 497 |
498 #endif // ENABLE(INSPECTOR) | 498 #endif // ENABLE(INSPECTOR) |
OLD | NEW |