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

Unified Diff: third_party/WebKit/Source/web/agent/sample/sample_agent.cc

Issue 2591803002: NOT FOR LANDING: Thread the needle through all webmodules.
Patch Set: Updated with latest generated code. Created 3 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: third_party/WebKit/Source/web/agent/sample/sample_agent.cc
diff --git a/third_party/WebKit/Source/web/agent/sample/sample_agent.cc b/third_party/WebKit/Source/web/agent/sample/sample_agent.cc
new file mode 100644
index 0000000000000000000000000000000000000000..93203e215400c90040005c042d72bb90fc3f2400
--- /dev/null
+++ b/third_party/WebKit/Source/web/agent/sample/sample_agent.cc
@@ -0,0 +1,37 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "web/agent/sample/sample_agent.h"
+
+#include "web/api/document.h"
+#include "web/api/element.h"
+
+namespace web {
+
+SampleAgent::SampleAgent(Frame* frame) : Agent(frame) {
+ Element* element = frame->GetFunkyElement();
+ if (!element)
+ return;
+ element->SetId("FUNKY!");
+ element->Before("YESS", "AWESOME!");
+ Document* document = frame->GetDocument();
+ if (!document)
+ return;
+ document->Write("THIS", "IS", "VARIADIC");
+
+ // Example of what you can do with the Variant.
+ auto current_script = document->GetCurrentScript();
+ if (!current_script)
+ return;
+
+ if (WTF::holds_alternative<blink::Member<SVGScriptElement>>(
+ current_script.value()))
+ return;
+
+ HTMLScriptElement* script =
+ WTF::get<blink::Member<HTMLScriptElement>>(current_script.value());
+ script->DoDummyThing();
+}
+
+} // namespace web

Powered by Google App Engine
This is Rietveld 408576698