Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/WebKit/Source/modules/device_orientation/DeviceMotionController.cpp

Issue 2567173002: Clean up Document::isSecureContext (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "modules/device_orientation/DeviceMotionController.h" 5 #include "modules/device_orientation/DeviceMotionController.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/Deprecation.h" 8 #include "core/frame/Deprecation.h"
9 #include "core/frame/HostsUsingFeatures.h" 9 #include "core/frame/HostsUsingFeatures.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 25 matching lines...) Expand all
36 return *controller; 36 return *controller;
37 } 37 }
38 38
39 void DeviceMotionController::didAddEventListener( 39 void DeviceMotionController::didAddEventListener(
40 LocalDOMWindow* window, 40 LocalDOMWindow* window,
41 const AtomicString& eventType) { 41 const AtomicString& eventType) {
42 if (eventType != eventTypeName()) 42 if (eventType != eventTypeName())
43 return; 43 return;
44 44
45 if (document().frame()) { 45 if (document().frame()) {
46 String errorMessage; 46 if (document().isSecureContext()) {
47 if (document().isSecureContext(errorMessage)) {
48 UseCounter::count(document().frame(), 47 UseCounter::count(document().frame(),
49 UseCounter::DeviceMotionSecureOrigin); 48 UseCounter::DeviceMotionSecureOrigin);
50 } else { 49 } else {
51 Deprecation::countDeprecation(document().frame(), 50 Deprecation::countDeprecation(document().frame(),
52 UseCounter::DeviceMotionInsecureOrigin); 51 UseCounter::DeviceMotionInsecureOrigin);
53 HostsUsingFeatures::countAnyWorld( 52 HostsUsingFeatures::countAnyWorld(
54 document(), HostsUsingFeatures::Feature::DeviceMotionInsecureHost); 53 document(), HostsUsingFeatures::Feature::DeviceMotionInsecureHost);
55 if (document().frame()->settings()->strictPowerfulFeatureRestrictions()) 54 if (document().frame()->settings()->strictPowerfulFeatureRestrictions())
56 return; 55 return;
57 } 56 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 const AtomicString& DeviceMotionController::eventTypeName() const { 89 const AtomicString& DeviceMotionController::eventTypeName() const {
91 return EventTypeNames::devicemotion; 90 return EventTypeNames::devicemotion;
92 } 91 }
93 92
94 DEFINE_TRACE(DeviceMotionController) { 93 DEFINE_TRACE(DeviceMotionController) {
95 DeviceSingleWindowEventController::trace(visitor); 94 DeviceSingleWindowEventController::trace(visitor);
96 Supplement<Document>::trace(visitor); 95 Supplement<Document>::trace(visitor);
97 } 96 }
98 97
99 } // namespace blink 98 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698