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

Unified Diff: Source/modules/devicelight/DeviceLightEvent.cpp

Issue 143823004: Implement DeviceLight (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: DeviceLight API working fine (make the flag back to status=experimental) Created 6 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/devicelight/DeviceLightEvent.cpp
diff --git a/Source/modules/speech/SpeechGrammar.cpp b/Source/modules/devicelight/DeviceLightEvent.cpp
similarity index 64%
copy from Source/modules/speech/SpeechGrammar.cpp
copy to Source/modules/devicelight/DeviceLightEvent.cpp
index 9a8ad3a5166f855d83a794d6b7e1f4c6ddb4e3f3..7a4dd9c4b4740f44ebb96029419e3114272bf4eb 100644
--- a/Source/modules/speech/SpeechGrammar.cpp
+++ b/Source/modules/devicelight/DeviceLightEvent.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2014 Intel Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,39 +25,46 @@
#include "config.h"
-#include "modules/speech/SpeechGrammar.h"
-
-#include "core/dom/Document.h"
+#include "modules/devicelight/DeviceLightEvent.h"
namespace WebCore {
-PassRefPtrWillBeRawPtr<SpeechGrammar> SpeechGrammar::create()
+DeviceLightEvent::~DeviceLightEvent()
{
- return adoptRefWillBeNoop(new SpeechGrammar);
}
-PassRefPtrWillBeRawPtr<SpeechGrammar> SpeechGrammar::create(const KURL& src, double weight)
+DeviceLightEvent::DeviceLightEvent()
+ : m_value(std::numeric_limits<double>::infinity())
{
- return adoptRefWillBeNoop(new SpeechGrammar(src, weight));
+ ScriptWrappable::init(this);
}
-void SpeechGrammar::setSrc(ExecutionContext* executionContext, const String& src)
+DeviceLightEvent::DeviceLightEvent(const AtomicString& eventType, const double value)
+ : Event(eventType, true, false) // Default event is bubbles, not cancellable.
+ , m_value(value)
{
- Document* document = toDocument(executionContext);
- m_src = document->completeURL(src);
+ ScriptWrappable::init(this);
}
-SpeechGrammar::SpeechGrammar()
- : m_weight(1.0)
+DeviceLightEvent::DeviceLightEvent(const AtomicString& eventType, const DeviceLightEventInit& initializer)
+ : Event(eventType, initializer)
+ , m_value(initializer.value)
{
ScriptWrappable::init(this);
}
-SpeechGrammar::SpeechGrammar(const KURL& src, double weight)
- : m_src(src)
- , m_weight(weight)
+const AtomicString& DeviceLightEvent::interfaceName() const
{
- ScriptWrappable::init(this);
+ return EventNames::DeviceLightEvent;
+}
+
+void DeviceLightEvent::trace(Visitor* visitor)
+{
+ Event::trace(visitor);
}
} // namespace WebCore
+
+
+
+

Powered by Google App Engine
This is Rietveld 408576698