Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 #include "platform/ScriptForbiddenScope.h" | 234 #include "platform/ScriptForbiddenScope.h" |
| 235 #include "platform/network/ContentSecurityPolicyParsers.h" | 235 #include "platform/network/ContentSecurityPolicyParsers.h" |
| 236 #include "platform/network/HTTPParsers.h" | 236 #include "platform/network/HTTPParsers.h" |
| 237 #include "platform/scroll/ScrollbarTheme.h" | 237 #include "platform/scroll/ScrollbarTheme.h" |
| 238 #include "platform/text/PlatformLocale.h" | 238 #include "platform/text/PlatformLocale.h" |
| 239 #include "platform/text/SegmentedString.h" | 239 #include "platform/text/SegmentedString.h" |
| 240 #include "platform/tracing/TraceEvent.h" | 240 #include "platform/tracing/TraceEvent.h" |
| 241 #include "platform/weborigin/OriginAccessEntry.h" | 241 #include "platform/weborigin/OriginAccessEntry.h" |
| 242 #include "platform/weborigin/SchemeRegistry.h" | 242 #include "platform/weborigin/SchemeRegistry.h" |
| 243 #include "platform/weborigin/SecurityOrigin.h" | 243 #include "platform/weborigin/SecurityOrigin.h" |
| 244 #include "public/platform/InterfaceProvider.h" | |
| 244 #include "public/platform/Platform.h" | 245 #include "public/platform/Platform.h" |
| 245 #include "public/platform/WebAddressSpace.h" | 246 #include "public/platform/WebAddressSpace.h" |
| 246 #include "public/platform/WebFrameScheduler.h" | 247 #include "public/platform/WebFrameScheduler.h" |
| 247 #include "public/platform/WebPrerenderingSupport.h" | 248 #include "public/platform/WebPrerenderingSupport.h" |
| 248 #include "public/platform/WebScheduler.h" | 249 #include "public/platform/WebScheduler.h" |
| 250 #include "public/platform/modules/sensitive_input_visibility/sensitive_input_vis ibility_service.mojom-blink.h" | |
| 249 #include "wtf/AutoReset.h" | 251 #include "wtf/AutoReset.h" |
| 250 #include "wtf/CurrentTime.h" | 252 #include "wtf/CurrentTime.h" |
| 251 #include "wtf/DateMath.h" | 253 #include "wtf/DateMath.h" |
| 252 #include "wtf/Functional.h" | 254 #include "wtf/Functional.h" |
| 253 #include "wtf/HashFunctions.h" | 255 #include "wtf/HashFunctions.h" |
| 254 #include "wtf/PtrUtil.h" | 256 #include "wtf/PtrUtil.h" |
| 255 #include "wtf/StdLibExtras.h" | 257 #include "wtf/StdLibExtras.h" |
| 256 #include "wtf/text/CharacterNames.h" | 258 #include "wtf/text/CharacterNames.h" |
| 257 #include "wtf/text/StringBuffer.h" | 259 #include "wtf/text/StringBuffer.h" |
| 258 #include "wtf/text/TextEncodingRegistry.h" | 260 #include "wtf/text/TextEncodingRegistry.h" |
| (...skipping 4063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4322 | 4324 |
| 4323 const OriginAccessEntry& Document::accessEntryFromURL() { | 4325 const OriginAccessEntry& Document::accessEntryFromURL() { |
| 4324 if (!m_accessEntryFromURL) { | 4326 if (!m_accessEntryFromURL) { |
| 4325 m_accessEntryFromURL = wrapUnique( | 4327 m_accessEntryFromURL = wrapUnique( |
| 4326 new OriginAccessEntry(url().protocol(), url().host(), | 4328 new OriginAccessEntry(url().protocol(), url().host(), |
| 4327 OriginAccessEntry::AllowRegisterableDomains)); | 4329 OriginAccessEntry::AllowRegisterableDomains)); |
| 4328 } | 4330 } |
| 4329 return *m_accessEntryFromURL; | 4331 return *m_accessEntryFromURL; |
| 4330 } | 4332 } |
| 4331 | 4333 |
| 4334 void Document::sendSensitiveInputVisibility() { | |
| 4335 m_sensitiveInputVisibilityTask = | |
|
dcheng
2016/11/24 01:54:08
Let's guard this with an isActive() so we only que
estark
2016/11/24 03:24:48
Done. (Sorry I missed that suggestion earlier.)
| |
| 4336 TaskRunnerHelper::get(TaskType::Internal, this) | |
| 4337 ->postCancellableTask( | |
| 4338 BLINK_FROM_HERE, | |
| 4339 WTF::bind(&Document::sendSensitiveInputVisibilityImpl, | |
| 4340 wrapWeakPersistent(this))); | |
| 4341 } | |
| 4342 | |
| 4343 void Document::sendSensitiveInputVisibilityImpl() { | |
|
haraken
2016/11/24 01:52:40
sendSensitiveInputVisibilityImpl => sendSensitiveI
estark
2016/11/24 03:24:48
Done.
| |
| 4344 if (!frame()) | |
|
dcheng
2016/11/24 01:54:08
DCHECK(frame()), since I think it should be non-nu
estark
2016/11/24 03:24:48
I couldn't convince myself of this. Is it not poss
dcheng
2016/11/24 03:48:29
Ah-ha. You got me. You're totally right.
I'm a bi
| |
| 4345 return; | |
| 4346 | |
| 4347 mojom::blink::SensitiveInputVisibilityServicePtr sensitiveInputServicePtr; | |
| 4348 frame()->interfaceProvider()->getInterface( | |
| 4349 mojo::GetProxy(&sensitiveInputServicePtr)); | |
| 4350 if (m_passwordCount > 0) { | |
| 4351 sensitiveInputServicePtr->PasswordFieldVisibleInInsecureContext(); | |
| 4352 return; | |
| 4353 } | |
| 4354 sensitiveInputServicePtr->AllPasswordFieldsInInsecureContextInvisible(); | |
| 4355 } | |
| 4356 | |
| 4332 void Document::registerEventFactory( | 4357 void Document::registerEventFactory( |
| 4333 std::unique_ptr<EventFactoryBase> eventFactory) { | 4358 std::unique_ptr<EventFactoryBase> eventFactory) { |
| 4334 DCHECK(!eventFactories().contains(eventFactory.get())); | 4359 DCHECK(!eventFactories().contains(eventFactory.get())); |
| 4335 eventFactories().add(std::move(eventFactory)); | 4360 eventFactories().add(std::move(eventFactory)); |
| 4336 } | 4361 } |
| 4337 | 4362 |
| 4338 Event* Document::createEvent(ExecutionContext* executionContext, | 4363 Event* Document::createEvent(ExecutionContext* executionContext, |
| 4339 const String& eventType, | 4364 const String& eventType, |
| 4340 ExceptionState& exceptionState) { | 4365 ExceptionState& exceptionState) { |
| 4341 Event* event = nullptr; | 4366 Event* event = nullptr; |
| (...skipping 2057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6399 | 6424 |
| 6400 PropertyRegistry* Document::propertyRegistry() { | 6425 PropertyRegistry* Document::propertyRegistry() { |
| 6401 // TODO(timloh): When the flag is removed, return a reference instead. | 6426 // TODO(timloh): When the flag is removed, return a reference instead. |
| 6402 if (!m_propertyRegistry && RuntimeEnabledFeatures::cssVariables2Enabled()) | 6427 if (!m_propertyRegistry && RuntimeEnabledFeatures::cssVariables2Enabled()) |
| 6403 m_propertyRegistry = PropertyRegistry::create(); | 6428 m_propertyRegistry = PropertyRegistry::create(); |
| 6404 return m_propertyRegistry; | 6429 return m_propertyRegistry; |
| 6405 } | 6430 } |
| 6406 | 6431 |
| 6407 void Document::incrementPasswordCount() { | 6432 void Document::incrementPasswordCount() { |
| 6408 ++m_passwordCount; | 6433 ++m_passwordCount; |
| 6434 if (isSecureContext() || m_passwordCount != 1) { | |
| 6435 // The browser process only cares about passwords on pages where the | |
| 6436 // top-level URL is not secure. Secure contexts must have a top-level | |
| 6437 // URL that is secure, so there is no need to send notifications for | |
| 6438 // password fields in secure contexts. | |
| 6439 // | |
| 6440 // Also, only send a message on the first visible password field; the | |
| 6441 // browser process doesn't care about the presence of additional | |
| 6442 // password fields beyond that. | |
| 6443 return; | |
| 6444 } | |
| 6445 sendSensitiveInputVisibility(); | |
| 6409 } | 6446 } |
| 6410 | 6447 |
| 6411 void Document::decrementPasswordCount() { | 6448 void Document::decrementPasswordCount() { |
| 6412 DCHECK_GT(m_passwordCount, 0u); | 6449 DCHECK_GT(m_passwordCount, 0u); |
| 6413 --m_passwordCount; | 6450 --m_passwordCount; |
| 6414 } | 6451 if (isSecureContext() || m_passwordCount > 0) |
| 6415 | 6452 return; |
| 6416 unsigned Document::passwordCount() const { | 6453 sendSensitiveInputVisibility(); |
| 6417 return m_passwordCount; | |
| 6418 } | 6454 } |
| 6419 | 6455 |
| 6420 DEFINE_TRACE(Document) { | 6456 DEFINE_TRACE(Document) { |
| 6421 visitor->trace(m_importsController); | 6457 visitor->trace(m_importsController); |
| 6422 visitor->trace(m_docType); | 6458 visitor->trace(m_docType); |
| 6423 visitor->trace(m_implementation); | 6459 visitor->trace(m_implementation); |
| 6424 visitor->trace(m_autofocusElement); | 6460 visitor->trace(m_autofocusElement); |
| 6425 visitor->trace(m_focusedElement); | 6461 visitor->trace(m_focusedElement); |
| 6426 visitor->trace(m_sequentialFocusNavigationStartingPoint); | 6462 visitor->trace(m_sequentialFocusNavigationStartingPoint); |
| 6427 visitor->trace(m_hoverNode); | 6463 visitor->trace(m_hoverNode); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6522 } | 6558 } |
| 6523 | 6559 |
| 6524 void showLiveDocumentInstances() { | 6560 void showLiveDocumentInstances() { |
| 6525 WeakDocumentSet& set = liveDocumentSet(); | 6561 WeakDocumentSet& set = liveDocumentSet(); |
| 6526 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6562 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6527 for (Document* document : set) | 6563 for (Document* document : set) |
| 6528 fprintf(stderr, "- Document %p URL: %s\n", document, | 6564 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6529 document->url().getString().utf8().data()); | 6565 document->url().getString().utf8().data()); |
| 6530 } | 6566 } |
| 6531 #endif | 6567 #endif |
| OLD | NEW |