Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / components / autofill / core / common / autofill_data_validation.h
blobfd5e52197c9a5349d696c330094dd3ac3a28f0e9
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_DATA_VALIDATION_H_
6 #define COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_DATA_VALIDATION_H_
8 #include <string>
9 #include <vector>
11 #include "base/strings/string16.h"
13 class GURL;
15 namespace autofill {
17 struct FormData;
18 struct FormFieldData;
19 struct PasswordFormFillData;
21 // Constants to enforce data size caps, so as to avoid sending overly large
22 // messages over IPC or trying to act on potentialy corrupted data within the
23 // browser process:
25 // The maximum string size supported by Autofill.
26 extern const size_t kMaxDataLength;
28 // The maximum list size supported by Autofill.
29 extern const size_t kMaxListSize;
31 // Functions to verify whether the objects passed to them satisfy basic sanity
32 // checks, including being capped to the maximums defined by the constants
33 // above.
34 bool IsValidString(const std::string& str);
35 bool IsValidString16(const base::string16& str);
36 bool IsValidGURL(const GURL& url);
37 bool IsValidFormFieldData(const FormFieldData& field);
38 bool IsValidFormData(const FormData& form);
39 bool IsValidPasswordFormFillData(const PasswordFormFillData& form);
40 bool IsValidString16Vector(const std::vector<base::string16>& v);
41 bool IsValidFormDataVector(const std::vector<FormData>& v);
43 } // namespace autofill
45 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_DATA_VALIDATION_H_