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

Side by Side Diff: Source/core/page/PagePopupClient.h

Issue 120513004: Don't expose DocumentWriter to embedding layer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef PagePopupClient_h 31 #ifndef PagePopupClient_h
32 #define PagePopupClient_h 32 #define PagePopupClient_h
33 33
34 #include "core/loader/DocumentWriter.h" 34 #include "platform/SharedBuffer.h"
35 #include "platform/geometry/IntRect.h" 35 #include "platform/geometry/IntRect.h"
36 #include "wtf/text/CString.h" 36 #include "wtf/text/CString.h"
37 #include "wtf/text/WTFString.h" 37 #include "wtf/text/WTFString.h"
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 class DocumentWriter;
42 class Locale; 41 class Locale;
43 42
44 class PagePopupClient { 43 class PagePopupClient {
45 public: 44 public:
46 virtual IntSize contentSize() = 0; 45 virtual IntSize contentSize() = 0;
47 46
48 // Provide an HTML source through the specified DocumentWriter. The HTML 47 // Provide an HTML source to the specified buffer. The HTML
49 // source is rendered in a PagePopup. 48 // source is rendered in a PagePopup.
50 // The content HTML supports: 49 // The content HTML supports:
51 // - No <select> popups 50 // - No <select> popups
52 // - window.setValueAndClosePopup(number, string). 51 // - window.setValueAndClosePopup(number, string).
53 virtual void writeDocument(DocumentWriter&) = 0; 52 virtual void writeDocument(SharedBuffer*) = 0;
54 53
55 // Returns a Locale object associated to the client. 54 // Returns a Locale object associated to the client.
56 virtual Locale& locale() = 0; 55 virtual Locale& locale() = 0;
57 56
58 // This is called by the content HTML of a PagePopup. 57 // This is called by the content HTML of a PagePopup.
59 // An implementation of this function should call ChromeClient::closePagePop up(). 58 // An implementation of this function should call ChromeClient::closePagePop up().
60 virtual void setValueAndClosePopup(int numValue, const String& stringValue) = 0; 59 virtual void setValueAndClosePopup(int numValue, const String& stringValue) = 0;
61 60
62 // This is called by the content HTML of a PagePopup. 61 // This is called by the content HTML of a PagePopup.
63 virtual void setValue(const String&) = 0; 62 virtual void setValue(const String&) = 0;
64 63
65 // This is called by the content HTML of a PagePopup. 64 // This is called by the content HTML of a PagePopup.
66 virtual void closePopup() = 0; 65 virtual void closePopup() = 0;
67 66
68 // This is called whenever a PagePopup was closed. 67 // This is called whenever a PagePopup was closed.
69 virtual void didClosePopup() = 0; 68 virtual void didClosePopup() = 0;
70 69
71 virtual ~PagePopupClient() { } 70 virtual ~PagePopupClient() { }
72 71
73 // Helper functions to be used in PagePopupClient::writeDocument(). 72 // Helper functions to be used in PagePopupClient::writeDocument().
74 static void addString(const String&, DocumentWriter&); 73 static void addString(const String&, SharedBuffer*);
75 static void addJavaScriptString(const String&, DocumentWriter&); 74 static void addJavaScriptString(const String&, SharedBuffer*);
76 static void addProperty(const char* name, const String& value, DocumentWrite r&); 75 static void addProperty(const char* name, const String& value, SharedBuffer* );
77 static void addProperty(const char* name, int value, DocumentWriter&); 76 static void addProperty(const char* name, int value, SharedBuffer*);
78 static void addProperty(const char* name, unsigned value, DocumentWriter&); 77 static void addProperty(const char* name, unsigned value, SharedBuffer*);
79 static void addProperty(const char* name, bool value, DocumentWriter&); 78 static void addProperty(const char* name, bool value, SharedBuffer*);
80 static void addProperty(const char* name, const Vector<String>& values, Docu mentWriter&); 79 static void addProperty(const char* name, const Vector<String>& values, Shar edBuffer*);
81 static void addProperty(const char* name, const IntRect&, DocumentWriter&); 80 static void addProperty(const char* name, const IntRect&, SharedBuffer*);
82 }; 81 };
83 82
84 inline void PagePopupClient::addString(const String& str, DocumentWriter& writer ) 83 inline void PagePopupClient::addString(const String& str, SharedBuffer* data)
85 { 84 {
86 CString str8 = str.utf8(); 85 CString str8 = str.utf8();
87 writer.addData(str8.data(), str8.length()); 86 data->append(str8.data(), str8.length());
88 } 87 }
89 88
90 } 89 }
91 #endif 90 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698