OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 scrollingCoordinator->reset(); | 243 scrollingCoordinator->reset(); |
244 | 244 |
245 page->deprecatedLocalMainFrame()->view()->clear(); | 245 page->deprecatedLocalMainFrame()->view()->clear(); |
246 KeyboardEventManager::setCurrentCapsLockState(OverrideCapsLockState::Default
); | 246 KeyboardEventManager::setCurrentCapsLockState(OverrideCapsLockState::Default
); |
247 } | 247 } |
248 | 248 |
249 Internals::Internals(ScriptState* scriptState) | 249 Internals::Internals(ScriptState* scriptState) |
250 : ContextLifecycleObserver(scriptState->getExecutionContext()) | 250 : ContextLifecycleObserver(scriptState->getExecutionContext()) |
251 , m_runtimeFlags(InternalRuntimeFlags::create()) | 251 , m_runtimeFlags(InternalRuntimeFlags::create()) |
252 { | 252 { |
| 253 contextDocument()->fetcher()->enableIsPreloadedForTest(); |
253 } | 254 } |
254 | 255 |
255 Document* Internals::contextDocument() const | 256 Document* Internals::contextDocument() const |
256 { | 257 { |
257 return toDocument(getExecutionContext()); | 258 return toDocument(getExecutionContext()); |
258 } | 259 } |
259 | 260 |
260 LocalFrame* Internals::frame() const | 261 LocalFrame* Internals::frame() const |
261 { | 262 { |
262 if (!contextDocument()) | 263 if (!contextDocument()) |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 390 |
390 bool Internals::isPreloaded(const String& url) | 391 bool Internals::isPreloaded(const String& url) |
391 { | 392 { |
392 return isPreloadedBy(url, contextDocument()); | 393 return isPreloadedBy(url, contextDocument()); |
393 } | 394 } |
394 | 395 |
395 bool Internals::isPreloadedBy(const String& url, Document* document) | 396 bool Internals::isPreloadedBy(const String& url, Document* document) |
396 { | 397 { |
397 if (!document) | 398 if (!document) |
398 return false; | 399 return false; |
399 return document->fetcher()->isPreloaded(document->completeURL(url)); | 400 return document->fetcher()->isPreloadedForTest(document->completeURL(url)); |
400 } | 401 } |
401 | 402 |
402 bool Internals::isLoadingFromMemoryCache(const String& url) | 403 bool Internals::isLoadingFromMemoryCache(const String& url) |
403 { | 404 { |
404 if (!contextDocument()) | 405 if (!contextDocument()) |
405 return false; | 406 return false; |
406 const String cacheIdentifier = contextDocument()->fetcher()->getCacheIdentif
ier(); | 407 const String cacheIdentifier = contextDocument()->fetcher()->getCacheIdentif
ier(); |
407 Resource* resource = memoryCache()->resourceForURL(contextDocument()->comple
teURL(url), cacheIdentifier); | 408 Resource* resource = memoryCache()->resourceForURL(contextDocument()->comple
teURL(url), cacheIdentifier); |
408 return resource && resource->getStatus() == Resource::Cached; | 409 return resource && resource->getStatus() == Resource::Cached; |
409 } | 410 } |
(...skipping 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2652 | 2653 |
2653 return ClientRect::create(FloatRect(node->layoutObject()->visualRect())); | 2654 return ClientRect::create(FloatRect(node->layoutObject()->visualRect())); |
2654 } | 2655 } |
2655 | 2656 |
2656 void Internals::crash() | 2657 void Internals::crash() |
2657 { | 2658 { |
2658 CHECK(false) << "Intentional crash"; | 2659 CHECK(false) << "Intentional crash"; |
2659 } | 2660 } |
2660 | 2661 |
2661 } // namespace blink | 2662 } // namespace blink |
OLD | NEW |