| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 /* |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 // found in the LICENSE file. | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are |
| 6 * met: |
| 7 * |
| 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. |
| 17 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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. |
| 29 */ |
| 4 | 30 |
| 5 #ifndef WEBKIT_GLUE_SEARCHABLE_FORM_DATA_H__ | 31 #ifndef WebSearchableFormData_h |
| 6 #define WEBKIT_GLUE_SEARCHABLE_FORM_DATA_H__ | 32 #define WebSearchableFormData_h |
| 7 | 33 |
| 8 #include <string> | 34 #include "WebString.h" |
| 9 | 35 #include "WebURL.h" |
| 10 #include "googleurl/src/gurl.h" | |
| 11 | 36 |
| 12 namespace WebKit { | 37 namespace WebKit { |
| 13 class WebForm; | 38 class WebForm; |
| 14 } | |
| 15 | 39 |
| 16 namespace webkit_glue { | 40 // SearchableFormData encapsulates a URL and encoding of an INPUT field that |
| 41 // corresponds to a searchable form request. |
| 42 class WebSearchableFormData { |
| 43 public: |
| 44 // If the provided form is suitable for automated searching, |m_url| and |
| 45 // |m_encoding| are set appropriately. Otherwise |m_url| will be left |
| 46 // invalid. |
| 47 WebSearchableFormData(const WebForm&); |
| 17 | 48 |
| 18 // SearchableFormData encapsulates a URL and class name of an INPUT field | 49 // URL for the searchable form request. |
| 19 // that correspond to a searchable form request. | 50 const WebURL& url() const |
| 20 class SearchableFormData { | 51 { |
| 21 public: | 52 return m_url; |
| 22 // If form contains elements that constitutes a valid searchable form | 53 } |
| 23 // request, a SearchableFormData is created and returned. | |
| 24 static SearchableFormData* Create(const WebKit::WebForm& form); | |
| 25 | 54 |
| 26 // URL for the searchable form request. | 55 // Encoding used to encode the form parameters; never empty. |
| 27 const GURL& url() const { return url_; } | 56 const WebString& encoding() const |
| 57 { |
| 58 return m_encoding; |
| 59 } |
| 28 | 60 |
| 29 // Encoding used to encode the form parameters; never empty. | 61 private: |
| 30 const std::string& encoding() const { return encoding_; } | 62 WebURL m_url; |
| 31 | 63 WebString m_encoding; |
| 32 private: | |
| 33 SearchableFormData(const GURL& url, const std::string& encoding) | |
| 34 : url_(url), | |
| 35 encoding_(encoding) { | |
| 36 } | |
| 37 | |
| 38 const GURL url_; | |
| 39 const std::string encoding_; | |
| 40 | |
| 41 DISALLOW_COPY_AND_ASSIGN(SearchableFormData); | |
| 42 }; | 64 }; |
| 43 | 65 |
| 44 } // namespace webkit_glue | 66 } // namespace WebKit |
| 45 | 67 |
| 46 #endif // WEBKIT_GLUE_SEARCHABLE_FORM_H__ | 68 #endif |
| OLD | NEW |