OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 if (DrawingRecorder::useCachedDrawingIfPossible(graphicsContext, pageOve
rlay, DisplayItem::PageOverlay)) | 316 if (DrawingRecorder::useCachedDrawingIfPossible(graphicsContext, pageOve
rlay, DisplayItem::PageOverlay)) |
317 return; | 317 return; |
318 FloatRect rect(0, 0, size.width, size.height); | 318 FloatRect rect(0, 0, size.width, size.height); |
319 DrawingRecorder drawingRecorder(graphicsContext, pageOverlay, DisplayIte
m::PageOverlay, rect); | 319 DrawingRecorder drawingRecorder(graphicsContext, pageOverlay, DisplayIte
m::PageOverlay, rect); |
320 graphicsContext.fillRect(rect, m_color); | 320 graphicsContext.fillRect(rect, m_color); |
321 } | 321 } |
322 | 322 |
323 WebColor m_color; | 323 WebColor m_color; |
324 }; | 324 }; |
325 | 325 |
| 326 #if OS(ANDROID) |
| 327 // Array used to convert canonical encoding method name to index to be |
| 328 // uploaded to UMA for the experiment on text encoding auto detection. |
| 329 // The listed order should be in sync with the enum definition 'EncodingMethod' |
| 330 // in tools/metrics/histograms/histograms.xml. |
| 331 static const char* kEncodingNames[] = { |
| 332 "UNKNOWN", |
| 333 "Big5", |
| 334 "EUC-JP", |
| 335 "EUC-KR", |
| 336 "GBK", |
| 337 "IBM866", |
| 338 "ISO-2022-JP", |
| 339 "ISO-8859-10", |
| 340 "ISO-8859-13", |
| 341 "ISO-8859-14", |
| 342 "ISO-8859-15", |
| 343 "ISO-8859-16", |
| 344 "ISO-8859-2", |
| 345 "ISO-8859-3", |
| 346 "ISO-8859-4", |
| 347 "ISO-8859-5", |
| 348 "ISO-8859-6", |
| 349 "ISO-8859-7", |
| 350 "ISO-8859-8", |
| 351 "ISO-8859-8-I", |
| 352 "KOI8-R", |
| 353 "KOI8-U", |
| 354 "Shift_JIS", |
| 355 "UTF-16LE", |
| 356 "UTF-8", |
| 357 "gb18030", |
| 358 "macintosh", |
| 359 "windows-1250", |
| 360 "windows-1251", |
| 361 "windows-1252", |
| 362 "windows-1253", |
| 363 "windows-1254", |
| 364 "windows-1255", |
| 365 "windows-1256", |
| 366 "windows-1257", |
| 367 "windows-1258", |
| 368 "windows-874" |
| 369 }; |
| 370 |
| 371 // Returns the index of the entry in the array that matches |
| 372 // the given encoding method. |
| 373 static int encodingToUmaId(const WTF::TextEncoding& encoding) |
| 374 { |
| 375 const char* encodingName = encoding.name(); |
| 376 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kEncodingNames); ++i) { |
| 377 if (!strcasecmp(kEncodingNames[i], encodingName)) |
| 378 return i; |
| 379 } |
| 380 return 0; |
| 381 } |
| 382 |
| 383 static bool isInternalURL(const KURL& url) |
| 384 { |
| 385 const String& protocol = url.protocol(); |
| 386 return protocol == "chrome" || protocol == "chrome-native" || protocol == "s
wappedout"; |
| 387 } |
| 388 #endif |
326 } // namespace | 389 } // namespace |
327 | 390 |
328 // WebView ---------------------------------------------------------------- | 391 // WebView ---------------------------------------------------------------- |
329 | 392 |
330 WebView* WebView::create(WebViewClient* client) | 393 WebView* WebView::create(WebViewClient* client) |
331 { | 394 { |
332 // Pass the WebViewImpl's self-reference to the caller. | 395 // Pass the WebViewImpl's self-reference to the caller. |
333 return WebViewImpl::create(client); | 396 return WebViewImpl::create(client); |
334 } | 397 } |
335 | 398 |
(...skipping 3584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3920 // for very little content, should we wait for some heuristic like | 3983 // for very little content, should we wait for some heuristic like |
3921 // isVisuallyNonEmpty() ? | 3984 // isVisuallyNonEmpty() ? |
3922 resumeTreeViewCommitsIfRenderingReady(); | 3985 resumeTreeViewCommitsIfRenderingReady(); |
3923 } | 3986 } |
3924 | 3987 |
3925 void WebViewImpl::didFinishDocumentLoad(WebLocalFrameImpl* webframe) | 3988 void WebViewImpl::didFinishDocumentLoad(WebLocalFrameImpl* webframe) |
3926 { | 3989 { |
3927 if (webframe != mainFrameImpl()) | 3990 if (webframe != mainFrameImpl()) |
3928 return; | 3991 return; |
3929 resumeTreeViewCommitsIfRenderingReady(); | 3992 resumeTreeViewCommitsIfRenderingReady(); |
| 3993 #if OS(ANDROID) |
| 3994 if (!isInternalURL(webframe->frame()->document()->baseURL()) && page()->sett
ings().usesEncodingDetector()) { |
| 3995 const Document& document = *webframe->frame()->document(); |
| 3996 |
| 3997 // "AutodetectEncoding.Attempted" is of boolean type - either 0 or 1. Us
e 2 for the boundary value. |
| 3998 Platform::current()->histogramEnumeration("AutodetectEncoding.Attempted"
, document.attemptedToDetermineEncodingFromContentSniffing(), 2); |
| 3999 if (document.encodingWasDetectedFromContentSniffing()) { |
| 4000 int encodingId = encodingToUmaId(document.encoding()); |
| 4001 Platform::current()->histogramEnumeration("AutodetectEncoding.Detect
ed", encodingId, WTF_ARRAY_LENGTH(kEncodingNames) + 1); |
| 4002 } |
| 4003 } |
| 4004 #endif |
3930 } | 4005 } |
3931 | 4006 |
3932 void WebViewImpl::didRemoveAllPendingStylesheet(WebLocalFrameImpl* webframe) | 4007 void WebViewImpl::didRemoveAllPendingStylesheet(WebLocalFrameImpl* webframe) |
3933 { | 4008 { |
3934 if (webframe != mainFrameImpl()) | 4009 if (webframe != mainFrameImpl()) |
3935 return; | 4010 return; |
3936 | 4011 |
3937 Document& document = *mainFrameImpl()->frame()->document(); | 4012 Document& document = *mainFrameImpl()->frame()->document(); |
3938 | 4013 |
3939 // For HTML if we have no more stylesheets to load and we're past the body | 4014 // For HTML if we have no more stylesheets to load and we're past the body |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4466 if (m_pageColorOverlay) | 4541 if (m_pageColorOverlay) |
4467 m_pageColorOverlay->update(); | 4542 m_pageColorOverlay->update(); |
4468 if (InspectorOverlay* overlay = inspectorOverlay()) { | 4543 if (InspectorOverlay* overlay = inspectorOverlay()) { |
4469 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); | 4544 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); |
4470 if (inspectorPageOverlay) | 4545 if (inspectorPageOverlay) |
4471 inspectorPageOverlay->update(); | 4546 inspectorPageOverlay->update(); |
4472 } | 4547 } |
4473 } | 4548 } |
4474 | 4549 |
4475 } // namespace blink | 4550 } // namespace blink |
OLD | NEW |