@@ -29,8 +29,6 @@ class FrameResource;
2929class FrameResourceTree ;
3030// Search result for resource.
3131class SearchResult ;
32- // Cookie object
33- class Cookie ;
3432// Unique script identifier.
3533using ScriptIdentifier = String;
3634
@@ -50,14 +48,6 @@ extern const char* Viewport;
5048extern const char * Page;
5149} // namespace CoordinateSystemEnum
5250
53- namespace GetScriptExecutionStatus {
54- namespace ResultEnum {
55- extern const char * Allowed;
56- extern const char * Disabled;
57- extern const char * Forbidden;
58- } // ResultEnum
59- } // GetScriptExecutionStatus
60-
6151// ------------- Type and builder declarations.
6252
6353// Information about the Frame on the page.
@@ -556,193 +546,6 @@ class SearchResult {
556546};
557547
558548
559- // Cookie object
560- class Cookie {
561- PROTOCOL_DISALLOW_COPY (Cookie);
562- public:
563- static std::unique_ptr<Cookie> parse (protocol::Value* value, ErrorSupport* errors);
564-
565- ~Cookie () { }
566-
567- String getName () {
568- return m_name;
569- }
570- void setName (const String& value) {
571- m_name = value;
572- }
573-
574- String getValue () {
575- return m_value;
576- }
577- void setValue (const String& value) {
578- m_value = value;
579- }
580-
581- String getDomain () {
582- return m_domain;
583- }
584- void setDomain (const String& value) {
585- m_domain = value;
586- }
587-
588- String getPath () {
589- return m_path;
590- }
591- void setPath (const String& value) {
592- m_path = value;
593- }
594-
595- double getExpires () {
596- return m_expires;
597- }
598- void setExpires (double value) {
599- m_expires = value;
600- }
601-
602- int getSize () {
603- return m_size;
604- }
605- void setSize (int value) {
606- m_size = value;
607- }
608-
609- bool getHttpOnly () {
610- return m_httpOnly;
611- }
612- void setHttpOnly (bool value) {
613- m_httpOnly = value;
614- }
615-
616- bool getSecure () {
617- return m_secure;
618- }
619- void setSecure (bool value) {
620- m_secure = value;
621- }
622-
623- bool getSession () {
624- return m_session;
625- }
626- void setSession (bool value) {
627- m_session = value;
628- }
629-
630- std::unique_ptr<protocol::DictionaryValue> serialize () const ;
631- std::unique_ptr<Cookie> clone () const ;
632-
633- template <int STATE>
634- class CookieBuilder {
635- public:
636- enum {
637- NoFieldsSet = 0 ,
638- NameSet = 1 << 1 ,
639- ValueSet = 1 << 2 ,
640- DomainSet = 1 << 3 ,
641- PathSet = 1 << 4 ,
642- ExpiresSet = 1 << 5 ,
643- SizeSet = 1 << 6 ,
644- HttpOnlySet = 1 << 7 ,
645- SecureSet = 1 << 8 ,
646- SessionSet = 1 << 9 ,
647- AllFieldsSet = (NameSet | ValueSet | DomainSet | PathSet | ExpiresSet | SizeSet | HttpOnlySet | SecureSet | SessionSet | 0 )
648- };
649-
650-
651- CookieBuilder<STATE | NameSet>& setName (const String& value) {
652- static_assert (!(STATE & NameSet), " property name should not be set yet" );
653- m_result->setName (value);
654- return castState<NameSet>();
655- }
656-
657- CookieBuilder<STATE | ValueSet>& setValue (const String& value) {
658- static_assert (!(STATE & ValueSet), " property value should not be set yet" );
659- m_result->setValue (value);
660- return castState<ValueSet>();
661- }
662-
663- CookieBuilder<STATE | DomainSet>& setDomain (const String& value) {
664- static_assert (!(STATE & DomainSet), " property domain should not be set yet" );
665- m_result->setDomain (value);
666- return castState<DomainSet>();
667- }
668-
669- CookieBuilder<STATE | PathSet>& setPath (const String& value) {
670- static_assert (!(STATE & PathSet), " property path should not be set yet" );
671- m_result->setPath (value);
672- return castState<PathSet>();
673- }
674-
675- CookieBuilder<STATE | ExpiresSet>& setExpires (double value) {
676- static_assert (!(STATE & ExpiresSet), " property expires should not be set yet" );
677- m_result->setExpires (value);
678- return castState<ExpiresSet>();
679- }
680-
681- CookieBuilder<STATE | SizeSet>& setSize (int value) {
682- static_assert (!(STATE & SizeSet), " property size should not be set yet" );
683- m_result->setSize (value);
684- return castState<SizeSet>();
685- }
686-
687- CookieBuilder<STATE | HttpOnlySet>& setHttpOnly (bool value) {
688- static_assert (!(STATE & HttpOnlySet), " property httpOnly should not be set yet" );
689- m_result->setHttpOnly (value);
690- return castState<HttpOnlySet>();
691- }
692-
693- CookieBuilder<STATE | SecureSet>& setSecure (bool value) {
694- static_assert (!(STATE & SecureSet), " property secure should not be set yet" );
695- m_result->setSecure (value);
696- return castState<SecureSet>();
697- }
698-
699- CookieBuilder<STATE | SessionSet>& setSession (bool value) {
700- static_assert (!(STATE & SessionSet), " property session should not be set yet" );
701- m_result->setSession (value);
702- return castState<SessionSet>();
703- }
704-
705- std::unique_ptr<Cookie> build () {
706- static_assert (STATE == AllFieldsSet, " state should be AllFieldsSet" );
707- return std::move (m_result);
708- }
709-
710- private:
711- friend class Cookie ;
712- CookieBuilder () : m_result(new Cookie()) { }
713-
714- template <int STEP> CookieBuilder<STATE | STEP>& castState () {
715- return *reinterpret_cast <CookieBuilder<STATE | STEP>*>(this );
716- }
717-
718- std::unique_ptr<protocol::Page::Cookie> m_result;
719- };
720-
721- static CookieBuilder<0 > create () {
722- return CookieBuilder<0 >();
723- }
724-
725- private:
726- Cookie () {
727- m_expires = 0 ;
728- m_size = 0 ;
729- m_httpOnly = false ;
730- m_secure = false ;
731- m_session = false ;
732- }
733-
734- String m_name;
735- String m_value;
736- String m_domain;
737- String m_path;
738- double m_expires;
739- int m_size;
740- bool m_httpOnly;
741- bool m_secure;
742- bool m_session;
743- };
744-
745-
746549// ------------- Backend interface.
747550
748551class Backend {
@@ -754,25 +557,11 @@ class Backend {
754557 virtual void addScriptToEvaluateOnLoad (ErrorString*, const String& in_scriptSource, String* out_identifier) = 0;
755558 virtual void removeScriptToEvaluateOnLoad (ErrorString*, const String& in_identifier) = 0;
756559 virtual void reload (ErrorString*, const Maybe<bool >& in_ignoreCache, const Maybe<String>& in_scriptToEvaluateOnLoad) = 0;
757- virtual void navigate (ErrorString*, const String& in_url) = 0;
758- virtual void getCookies (ErrorString*, std::unique_ptr<protocol::Array<protocol::Page::Cookie>>* out_cookies) = 0;
759- virtual void deleteCookie (ErrorString*, const String& in_cookieName, const String& in_url) = 0;
760560 virtual void getResourceTree (ErrorString*, std::unique_ptr<protocol::Page::FrameResourceTree>* out_frameTree) = 0;
761561 virtual void getResourceContent (ErrorString*, const String& in_frameId, const String& in_url, String* out_content, bool * out_base64Encoded) = 0;
762562 virtual void searchInResource (ErrorString*, const String& in_frameId, const String& in_url, const String& in_query, const Maybe<bool >& in_caseSensitive, const Maybe<bool >& in_isRegex, const Maybe<String>& in_requestId, std::unique_ptr<protocol::Array<protocol::GenericTypes::SearchMatch>>* out_result) = 0;
763563 virtual void searchInResources (ErrorString*, const String& in_text, const Maybe<bool >& in_caseSensitive, const Maybe<bool >& in_isRegex, std::unique_ptr<protocol::Array<protocol::Page::SearchResult>>* out_result) = 0;
764564 virtual void setDocumentContent (ErrorString*, const String& in_frameId, const String& in_html) = 0;
765- virtual void setShowPaintRects (ErrorString*, bool in_result) = 0;
766- virtual void getScriptExecutionStatus (ErrorString*, String* out_result) = 0;
767- virtual void setScriptExecutionDisabled (ErrorString*, bool in_value) = 0;
768- virtual void setTouchEmulationEnabled (ErrorString*, bool in_enabled) = 0;
769- virtual void setEmulatedMedia (ErrorString*, const String& in_media) = 0;
770- virtual void getCompositingBordersVisible (ErrorString*, bool * out_result) = 0;
771- virtual void setCompositingBordersVisible (ErrorString*, bool in_visible) = 0;
772- virtual void snapshotNode (ErrorString*, int in_nodeId, String* out_dataURL) = 0;
773- virtual void snapshotRect (ErrorString*, int in_x, int in_y, int in_width, int in_height, const String& in_coordinateSystem, String* out_dataURL) = 0;
774- virtual void handleJavaScriptDialog (ErrorString*, bool in_accept, const Maybe<String>& in_promptText) = 0;
775- virtual void archive (ErrorString*, String* out_data) = 0;
776565
777566};
778567
@@ -781,17 +570,10 @@ class Backend {
781570class Frontend {
782571 public:
783572 Frontend (FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { }
784- void domContentEventFired (double timestamp);
785573 void loadEventFired (double timestamp);
786- void frameNavigated (std::unique_ptr<protocol::Page::Frame> frame);
787574 void frameDetached (const String& frameId);
788575 void frameStartedLoading (const String& frameId);
789576 void frameStoppedLoading (const String& frameId);
790- void frameScheduledNavigation (const String& frameId, double delay);
791- void frameClearedScheduledNavigation (const String& frameId);
792- void javascriptDialogOpening (const String& message);
793- void javascriptDialogClosed ();
794- void scriptsEnabled (bool isEnabled);
795577
796578 void flush ();
797579 private:
0 commit comments