OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/RemoteFontFaceSource.h" | 5 #include "core/css/RemoteFontFaceSource.h" |
6 | 6 |
7 #include "core/css/CSSCustomFontData.h" | 7 #include "core/css/CSSCustomFontData.h" |
8 #include "core/css/CSSFontFace.h" | 8 #include "core/css/CSSFontFace.h" |
9 #include "core/css/CSSFontSelector.h" | 9 #include "core/css/CSSFontSelector.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 bool RemoteFontFaceSource::isValid() const { | 107 bool RemoteFontFaceSource::isValid() const { |
108 return !m_font->errorOccurred(); | 108 return !m_font->errorOccurred(); |
109 } | 109 } |
110 | 110 |
111 void RemoteFontFaceSource::notifyFinished(Resource*) { | 111 void RemoteFontFaceSource::notifyFinished(Resource*) { |
112 m_histograms.maySetDataSource(m_font->response().wasCached() | 112 m_histograms.maySetDataSource(m_font->response().wasCached() |
113 ? FontLoadHistograms::FromDiskCache | 113 ? FontLoadHistograms::FromDiskCache |
114 : FontLoadHistograms::FromNetwork); | 114 : FontLoadHistograms::FromNetwork); |
115 m_histograms.recordRemoteFont(m_font.get(), m_isInterventionTriggered); | 115 m_histograms.recordRemoteFont(m_font.get(), m_isInterventionTriggered); |
116 m_histograms.fontLoaded(m_font->isCORSFailed(), | 116 m_histograms.fontLoaded(m_font->isCORSFailed(), |
117 m_font->getStatus() == Resource::LoadError, | 117 m_font->getStatus() == ResourceStatus::LoadError, |
118 m_isInterventionTriggered); | 118 m_isInterventionTriggered); |
119 | 119 |
120 m_font->ensureCustomFontData(); | 120 m_font->ensureCustomFontData(); |
121 // FIXME: Provide more useful message such as OTS rejection reason. | 121 // FIXME: Provide more useful message such as OTS rejection reason. |
122 // See crbug.com/97467 | 122 // See crbug.com/97467 |
123 if (m_font->getStatus() == Resource::DecodeError && | 123 if (m_font->getStatus() == ResourceStatus::DecodeError && |
124 m_fontSelector->document()) { | 124 m_fontSelector->document()) { |
125 m_fontSelector->document()->addConsoleMessage(ConsoleMessage::create( | 125 m_fontSelector->document()->addConsoleMessage(ConsoleMessage::create( |
126 OtherMessageSource, WarningMessageLevel, | 126 OtherMessageSource, WarningMessageLevel, |
127 "Failed to decode downloaded font: " + m_font->url().elidedString())); | 127 "Failed to decode downloaded font: " + m_font->url().elidedString())); |
128 if (m_font->otsParsingMessage().length() > 1) | 128 if (m_font->otsParsingMessage().length() > 1) |
129 m_fontSelector->document()->addConsoleMessage(ConsoleMessage::create( | 129 m_fontSelector->document()->addConsoleMessage(ConsoleMessage::create( |
130 OtherMessageSource, WarningMessageLevel, | 130 OtherMessageSource, WarningMessageLevel, |
131 "OTS parsing error: " + m_font->otsParsingMessage())); | 131 "OTS parsing error: " + m_font->otsParsingMessage())); |
132 } | 132 } |
133 | 133 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 return Miss; | 466 return Miss; |
467 case FromUnknown: | 467 case FromUnknown: |
468 // Fall through. | 468 // Fall through. |
469 default: | 469 default: |
470 NOTREACHED(); | 470 NOTREACHED(); |
471 } | 471 } |
472 return Miss; | 472 return Miss; |
473 } | 473 } |
474 | 474 |
475 } // namespace blink | 475 } // namespace blink |
OLD | NEW |