Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 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 10 matching lines...) Expand all Loading... | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 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 CompositedSelection_h | 31 #ifndef WebRTCKeyType_h |
| 32 #define CompositedSelection_h | 32 #define WebRTCKeyType_h |
| 33 | |
| 34 #include "core/editing/SelectionType.h" | |
| 35 #include "core/layout/compositing/CompositedSelectionBound.h" | |
| 36 #include "platform/geometry/FloatPoint.h" | |
| 37 #include "platform/graphics/GraphicsLayer.h" | |
| 38 #include "wtf/Allocator.h" | |
| 39 | 33 |
| 40 namespace blink { | 34 namespace blink { |
| 41 | 35 |
| 42 // The active selection region, containing compositing data for the selection | 36 // Corresponds to KeyTypeFamily in webrtc. |
| 43 // end points as well as metadata for the selection region. | 37 enum WebRTCKeyFamily { KeyFamilyRsa, KeyFamilyEcdsa, KeyFamilyLast }; |
|
hbos_chromium
2015/09/21 16:12:22
Should even this enum be in its own header?
| |
| 44 // See |WebSelection|. | 38 |
| 45 struct CompositedSelection { | 39 // Corresponds to KeyType in webrtc. |
| 46 STACK_ALLOCATED(); | 40 class WebRTCKeyType { |
| 47 CompositedSelection() | 41 public: |
| 48 : type(NoSelection) | 42 static WebRTCKeyType createRSA(int modulusLength = 1024) |
| 49 , isEditable(false) | |
| 50 , isEmptyTextFormControl(false) | |
| 51 { | 43 { |
| 44 return WebRTCKeyType(KeyFamilyRsa, modulusLength); | |
| 45 } | |
| 46 static WebRTCKeyType createECDSA() | |
| 47 { | |
| 48 return WebRTCKeyType(KeyFamilyEcdsa); | |
| 52 } | 49 } |
| 53 | 50 |
| 54 SelectionType type; | 51 explicit WebRTCKeyType(WebRTCKeyFamily family = KeyFamilyRsa) |
| 55 CompositedSelectionBound start; | 52 : WebRTCKeyType(family, family == KeyFamilyRsa ? 1024 : 0) {} |
| 56 CompositedSelectionBound end; | 53 |
| 57 bool isEditable; | 54 WebRTCKeyFamily family() const { return m_family; } |
| 58 bool isEmptyTextFormControl; | 55 |
| 56 private: | |
| 57 WebRTCKeyType(WebRTCKeyFamily family, int parameter) | |
| 58 : m_family(family), m_parameter(parameter) {} | |
| 59 | |
| 60 WebRTCKeyFamily m_family; | |
| 61 // For RSA: modulusLength. | |
| 62 // For ECDSA: N/A (curve id in the future). | |
| 63 int m_parameter; | |
| 59 }; | 64 }; |
| 60 | 65 |
| 61 } // namespace blink | 66 } // namespace blink |
| 62 | 67 |
| 63 #endif // CompositedSelection_h | 68 #endif // WebRTCKeyType_h |
| OLD | NEW |