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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "web/agent/sample/sample_agent.h"
6
7 #include "web/api/document.h"
8 #include "web/api/element.h"
9
10 namespace web {
11
12 SampleAgent::SampleAgent(Frame* frame) : Agent(frame) {
13 Element* element = frame->GetFunkyElement();
14 if (!element)
15 return;
16 element->SetId("FUNKY!");
17 element->Before("YESS", "AWESOME!");
18 Document* document = frame->GetDocument();
19 if (!document)
20 return;
21 document->Write("THIS", "IS", "VARIADIC");
22
23 // Example of what you can do with the Variant.
24 auto current_script = document->GetCurrentScript();
25 if (!current_script)
26 return;
27
28 if (WTF::holds_alternative<blink::Member<SVGScriptElement>>(
29 current_script.value()))
30 return;
31
32 HTMLScriptElement* script =
33 WTF::get<blink::Member<HTMLScriptElement>>(current_script.value());
34 script->DoDummyThing();
35 }
36
37 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698