OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 26 matching lines...) Expand all Loading... |
37 #include "weborigin/SecurityOrigin.h" | 37 #include "weborigin/SecurityOrigin.h" |
38 | 38 |
39 namespace WebCore { | 39 namespace WebCore { |
40 | 40 |
41 static inline bool canReferToParentFrameEncoding(const Frame* frame, const Frame
* parentFrame) | 41 static inline bool canReferToParentFrameEncoding(const Frame* frame, const Frame
* parentFrame) |
42 { | 42 { |
43 return parentFrame && parentFrame->document()->securityOrigin()->canAccess(f
rame->document()->securityOrigin()); | 43 return parentFrame && parentFrame->document()->securityOrigin()->canAccess(f
rame->document()->securityOrigin()); |
44 } | 44 } |
45 | 45 |
46 | 46 |
47 TextResourceDecoderBuilder::TextResourceDecoderBuilder() | 47 TextResourceDecoderBuilder::TextResourceDecoderBuilder(const String& mimeType, c
onst String& encoding, bool encodingUserChoosen) |
48 : m_encodingWasChosenByUser(false) | 48 : m_mimeType(mimeType) |
| 49 , m_encoding(encoding) |
| 50 , m_encodingWasChosenByUser(encodingUserChoosen) |
49 { | 51 { |
50 } | 52 } |
51 | 53 |
52 TextResourceDecoderBuilder::~TextResourceDecoderBuilder() | 54 TextResourceDecoderBuilder::~TextResourceDecoderBuilder() |
53 { | 55 { |
54 } | 56 } |
55 | 57 |
56 | 58 |
57 inline PassRefPtr<TextResourceDecoder> TextResourceDecoderBuilder::createDecoder
Instance(Document* document) | 59 inline PassRefPtr<TextResourceDecoder> TextResourceDecoderBuilder::createDecoder
Instance(Document* document) |
58 { | 60 { |
(...skipping 30 matching lines...) Expand all Loading... |
89 } | 91 } |
90 | 92 |
91 PassRefPtr<TextResourceDecoder> TextResourceDecoderBuilder::buildFor(Document* d
ocument) | 93 PassRefPtr<TextResourceDecoder> TextResourceDecoderBuilder::buildFor(Document* d
ocument) |
92 { | 94 { |
93 RefPtr<TextResourceDecoder> decoder = createDecoderInstance(document); | 95 RefPtr<TextResourceDecoder> decoder = createDecoderInstance(document); |
94 setupEncoding(decoder.get(), document); | 96 setupEncoding(decoder.get(), document); |
95 document->setDecoder(decoder); | 97 document->setDecoder(decoder); |
96 return decoder.release(); | 98 return decoder.release(); |
97 } | 99 } |
98 | 100 |
99 void TextResourceDecoderBuilder::setEncoding(const String& encoding, bool userCh
osen) | |
100 { | |
101 m_encoding = encoding; | |
102 m_encodingWasChosenByUser = userChosen; | |
103 } | |
104 | |
105 void TextResourceDecoderBuilder::clear() | 101 void TextResourceDecoderBuilder::clear() |
106 { | 102 { |
107 if (!m_encodingWasChosenByUser) | 103 if (!m_encodingWasChosenByUser) |
108 m_encoding = String(); | 104 m_encoding = String(); |
109 } | 105 } |
110 | 106 |
111 } | 107 } |
OLD | NEW |