OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * |
| 3 * Copyright 2015, Google Inc. |
| 4 * All rights reserved. |
3 * | 5 * |
4 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
6 * met: | 8 * met: |
7 * | 9 * |
8 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 11 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 12 * * Redistributions in binary form must reproduce the above |
11 * copyright notice, this list of conditions and the following disclaimer | 13 * copyright notice, this list of conditions and the following disclaimer |
12 * in the documentation and/or other materials provided with the | 14 * in the documentation and/or other materials provided with the |
13 * distribution. | 15 * distribution. |
14 * * Neither the name of Google Inc. nor the names of its | 16 * * Neither the name of Google Inc. nor the names of its |
15 * contributors may be used to endorse or promote products derived from | 17 * contributors may be used to endorse or promote products derived from |
16 * this software without specific prior written permission. | 18 * this software without specific prior written permission. |
17 * | 19 * |
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 29 * (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. | 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 * |
29 */ | 32 */ |
30 | 33 |
31 #ifndef WebFindOptions_h | 34 #ifndef NET_GRPC_NODE_CHANNEL_H_ |
32 #define WebFindOptions_h | 35 #define NET_GRPC_NODE_CHANNEL_H_ |
33 | 36 |
34 #include "../platform/WebString.h" | 37 #include <node.h> |
| 38 #include <nan.h> |
| 39 #include "grpc/grpc.h" |
35 | 40 |
36 namespace blink { | 41 namespace grpc { |
| 42 namespace node { |
37 | 43 |
38 // Options used when performing a find-in-page query. | 44 bool ParseChannelArgs(v8::Local<v8::Value> args_val, |
39 struct WebFindOptions { | 45 grpc_channel_args **channel_args_ptr); |
40 // Whether to search forward or backward within the page. | |
41 bool forward; | |
42 | 46 |
43 // Whether search should be case-sensitive. | 47 void DeallocateChannelArgs(grpc_channel_args *channel_args); |
44 bool matchCase; | |
45 | 48 |
46 // Whether this operation is the first request or a follow-up. | 49 /* Wrapper class for grpc_channel structs */ |
47 bool findNext; | 50 class Channel : public Nan::ObjectWrap { |
| 51 public: |
| 52 static void Init(v8::Local<v8::Object> exports); |
| 53 static bool HasInstance(v8::Local<v8::Value> val); |
| 54 /* This is used to typecheck javascript objects before converting them to |
| 55 this type */ |
| 56 static v8::Persistent<v8::Value> prototype; |
48 | 57 |
49 // Whether this operation should look for matches only at the start of words
. | 58 /* Returns the grpc_channel struct that this object wraps */ |
50 bool wordStart; | 59 grpc_channel *GetWrappedChannel(); |
51 | 60 |
52 // When combined with wordStart, accepts a match in the middle of a word if
the match begins with | 61 private: |
53 // an uppercase letter followed by a lowercase or non-letter. Accepts severa
l other intra-word matches. | 62 explicit Channel(grpc_channel *channel); |
54 bool medialCapitalAsWordStart; | 63 ~Channel(); |
55 | 64 |
56 WebFindOptions() | 65 // Prevent copying |
57 : forward(true) | 66 Channel(const Channel &); |
58 , matchCase(false) | 67 Channel &operator=(const Channel &); |
59 , findNext(false) | 68 |
60 , wordStart(false) | 69 static NAN_METHOD(New); |
61 , medialCapitalAsWordStart(false) { } | 70 static NAN_METHOD(Close); |
| 71 static NAN_METHOD(GetTarget); |
| 72 static NAN_METHOD(GetConnectivityState); |
| 73 static NAN_METHOD(WatchConnectivityState); |
| 74 static Nan::Callback *constructor; |
| 75 static Nan::Persistent<v8::FunctionTemplate> fun_tpl; |
| 76 |
| 77 grpc_channel *wrapped_channel; |
62 }; | 78 }; |
63 | 79 |
64 } // namespace blink | 80 } // namespace node |
| 81 } // namespace grpc |
65 | 82 |
66 #endif | 83 #endif // NET_GRPC_NODE_CHANNEL_H_ |
OLD | NEW |