Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: Source/core/inspector/InspectorStyleSheet.cpp

Issue 23658039: [ABANDONED] Get content of resources from Blob when the downloadToFile option is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 28 matching lines...) Expand all
39 #include "core/css/CSSRuleList.h" 39 #include "core/css/CSSRuleList.h"
40 #include "core/css/CSSStyleRule.h" 40 #include "core/css/CSSStyleRule.h"
41 #include "core/css/CSSStyleSheet.h" 41 #include "core/css/CSSStyleSheet.h"
42 #include "core/css/CSSSupportsRule.h" 42 #include "core/css/CSSSupportsRule.h"
43 #include "core/css/StylePropertySet.h" 43 #include "core/css/StylePropertySet.h"
44 #include "core/css/StyleRule.h" 44 #include "core/css/StyleRule.h"
45 #include "core/css/StyleSheetContents.h" 45 #include "core/css/StyleSheetContents.h"
46 #include "core/dom/Document.h" 46 #include "core/dom/Document.h"
47 #include "core/dom/Element.h" 47 #include "core/dom/Element.h"
48 #include "core/dom/Node.h" 48 #include "core/dom/Node.h"
49 #include "core/fileapi/Blob.h"
49 #include "core/html/parser/HTMLParserIdioms.h" 50 #include "core/html/parser/HTMLParserIdioms.h"
50 #include "core/inspector/ContentSearchUtils.h" 51 #include "core/inspector/ContentSearchUtils.h"
51 #include "core/inspector/InspectorCSSAgent.h" 52 #include "core/inspector/InspectorCSSAgent.h"
52 #include "core/inspector/InspectorPageAgent.h" 53 #include "core/inspector/InspectorPageAgent.h"
53 #include "core/page/Page.h" 54 #include "core/page/Page.h"
54 #include "core/page/PageConsole.h" 55 #include "core/page/PageConsole.h"
55 #include "core/platform/JSONValues.h" 56 #include "core/platform/JSONValues.h"
56 #include "core/platform/text/RegularExpression.h" 57 #include "core/platform/text/RegularExpression.h"
57 #include "wtf/OwnPtr.h" 58 #include "wtf/OwnPtr.h"
58 #include "wtf/PassOwnPtr.h" 59 #include "wtf/PassOwnPtr.h"
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 bool InspectorStyleSheet::resourceStyleSheetText(String* result) const 1675 bool InspectorStyleSheet::resourceStyleSheetText(String* result) const
1675 { 1676 {
1676 if (m_origin == TypeBuilder::CSS::StyleSheetOrigin::User || m_origin == Type Builder::CSS::StyleSheetOrigin::User_agent) 1677 if (m_origin == TypeBuilder::CSS::StyleSheetOrigin::User || m_origin == Type Builder::CSS::StyleSheetOrigin::User_agent)
1677 return false; 1678 return false;
1678 1679
1679 if (!m_pageStyleSheet || !ownerDocument() || !ownerDocument()->frame()) 1680 if (!m_pageStyleSheet || !ownerDocument() || !ownerDocument()->frame())
1680 return false; 1681 return false;
1681 1682
1682 String error; 1683 String error;
1683 bool base64Encoded; 1684 bool base64Encoded;
1684 InspectorPageAgent::resourceContent(&error, ownerDocument()->frame(), KURL(P arsedURLString, m_pageStyleSheet->href()), result, &base64Encoded); 1685 RefPtr<Blob> blob;
1685 return error.isEmpty() && !base64Encoded; 1686 String textEncodingName;
1687 InspectorPageAgent::resourceContentOrBlob(&error, ownerDocument()->frame(), KURL(ParsedURLString, m_pageStyleSheet->href()), result, &base64Encoded, &blob, &textEncodingName);
1688 return error.isEmpty() && !base64Encoded && !blob;
1686 } 1689 }
1687 1690
1688 bool InspectorStyleSheet::inlineStyleSheetText(String* result) const 1691 bool InspectorStyleSheet::inlineStyleSheetText(String* result) const
1689 { 1692 {
1690 if (!m_pageStyleSheet) 1693 if (!m_pageStyleSheet)
1691 return false; 1694 return false;
1692 1695
1693 Node* ownerNode = m_pageStyleSheet->ownerNode(); 1696 Node* ownerNode = m_pageStyleSheet->ownerNode();
1694 if (!ownerNode || ownerNode->nodeType() != Node::ELEMENT_NODE) 1697 if (!ownerNode || ownerNode->nodeType() != Node::ELEMENT_NODE)
1695 return false; 1698 return false;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 1818
1816 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c reate(); 1819 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c reate();
1817 RuleSourceDataList ruleSourceDataResult; 1820 RuleSourceDataList ruleSourceDataResult;
1818 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do cument().elementSheet()->contents(), &ruleSourceDataResult); 1821 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do cument().elementSheet()->contents(), &ruleSourceDataResult);
1819 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge t(), m_styleText, &handler, m_element->document().elementSheet()->contents()); 1822 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge t(), m_styleText, &handler, m_element->document().elementSheet()->contents());
1820 return ruleSourceDataResult.first().release(); 1823 return ruleSourceDataResult.first().release();
1821 } 1824 }
1822 1825
1823 } // namespace WebCore 1826 } // namespace WebCore
1824 1827
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698