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

Side by Side Diff: public/platform/WebDragData.h

Issue 925913002: Fixed WebDragData's wrong dependency. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« Source/web/web.gypi ('K') | « Source/web/web.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 17 matching lines...) Expand all
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 WebDragData_h 31 #ifndef WebDragData_h
32 #define WebDragData_h 32 #define WebDragData_h
33 33
34 #include "WebCommon.h" 34 #include "WebCommon.h"
35 #include "WebData.h" 35 #include "WebData.h"
36 #include "WebString.h" 36 #include "WebString.h"
37 #include "WebURL.h" 37 #include "WebURL.h"
38 #include "WebVector.h"
38 39
39 namespace blink { 40 namespace blink {
40 41
41 class DataObject;
42 template <typename T> class WebVector; 42 template <typename T> class WebVector;
43 43
44 // Holds data that may be exchanged through a drag-n-drop operation. It is 44 // Holds data that may be exchanged through a drag-n-drop operation. It is
45 // inexpensive to copy a WebDragData object. 45 // inexpensive to copy a WebDragData object.
46 class WebDragData { 46 class WebDragData {
47 public: 47 public:
48 struct Item { 48 struct Item {
49 enum StorageType { 49 enum StorageType {
50 // String data with an associated MIME type. Depending on the MIME t ype, there may be 50 // String data with an associated MIME type. Depending on the MIME t ype, there may be
51 // optional metadata attributes as well. 51 // optional metadata attributes as well.
(...skipping 25 matching lines...) Expand all
77 WebString title; 77 WebString title;
78 78
79 // Only valid when storageType == StorageTypeFileSystemFile. 79 // Only valid when storageType == StorageTypeFileSystemFile.
80 WebURL fileSystemURL; 80 WebURL fileSystemURL;
81 long long fileSystemFileSize; 81 long long fileSystemFileSize;
82 82
83 // Only valid when stringType == "text/html". 83 // Only valid when stringType == "text/html".
84 WebURL baseURL; 84 WebURL baseURL;
85 }; 85 };
86 86
87 WebDragData() { } 87 WebDragData()
88 WebDragData(const WebDragData& object) { assign(object); } 88 : m_valid(false)
89 , m_modifierKeyState(0)
90 { }
91
92 WebDragData(const WebDragData& object)
93 : m_valid(object.m_valid)
94 , m_itemList(object.m_itemList)
95 , m_modifierKeyState(object.m_modifierKeyState)
96 , m_filesystemId(object.m_filesystemId)
97 { }
98
89 WebDragData& operator=(const WebDragData& object) 99 WebDragData& operator=(const WebDragData& object)
90 { 100 {
91 assign(object); 101 m_valid = object.m_valid;
102 m_itemList = object.m_itemList;
103 m_modifierKeyState = object.m_modifierKeyState;
104 m_filesystemId = object.m_filesystemId;
92 return *this; 105 return *this;
93 } 106 }
94 ~WebDragData() { reset(); }
95 107
96 bool isNull() const { return m_private.isNull(); } 108 ~WebDragData() { }
97 109
98 BLINK_EXPORT void initialize(); 110 WebVector<Item> items() const
99 BLINK_EXPORT void reset(); 111 {
100 BLINK_EXPORT void assign(const WebDragData&); 112 return m_itemList;
113 }
101 114
102 BLINK_EXPORT WebVector<Item> items() const; 115 BLINK_PLATFORM_EXPORT void setItems(const WebVector<Item>& itemList);
103 BLINK_EXPORT void setItems(const WebVector<Item>&);
104 BLINK_EXPORT void addItem(const Item&);
105 116
106 BLINK_EXPORT WebString filesystemId() const; 117 void initialize() { m_valid = true; }
107 BLINK_EXPORT void setFilesystemId(const WebString&); 118 bool isNull() const { return !m_valid; }
119 void reset() { m_itemList = WebVector<Item>(); m_valid = false; }
108 120
109 #if BLINK_IMPLEMENTATION 121 BLINK_PLATFORM_EXPORT void addItem(const Item&);
110 explicit WebDragData(const PassRefPtrWillBeRawPtr<DataObject>&); 122
111 WebDragData& operator=(const PassRefPtrWillBeRawPtr<DataObject>&); 123 WebString filesystemId() const
112 DataObject* getValue() const; 124 {
113 #endif 125 return m_filesystemId;
126 }
127
128 void setFilesystemId(const WebString& filesystemId)
129 {
130 // The ID is an opaque string, given by and validated by chromium port.
131 m_filesystemId = filesystemId;
132 }
114 133
115 private: 134 private:
116 void ensureMutable(); 135 bool m_valid;
117 WebPrivatePtr<DataObject> m_private; 136 WebVector<Item> m_itemList;
137 int m_modifierKeyState; // State of Shift/Ctrl/Alt/Meta keys.
138 WebString m_filesystemId;
118 }; 139 };
119 140
120 } // namespace blink 141 } // namespace blink
121 142
122 #endif 143 #endif
OLDNEW
« Source/web/web.gypi ('K') | « Source/web/web.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698