OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1940 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
1941 errors::kInvalidInputComponentName, base::IntToString(i)); | 1941 errors::kInvalidInputComponentName, base::IntToString(i)); |
1942 return false; | 1942 return false; |
1943 } | 1943 } |
1944 | 1944 |
1945 // Get input_components[i].type. | 1945 // Get input_components[i].type. |
1946 std::string type_str; | 1946 std::string type_str; |
1947 if (module_value->GetString(keys::kType, &type_str)) { | 1947 if (module_value->GetString(keys::kType, &type_str)) { |
1948 if (type_str == "ime") { | 1948 if (type_str == "ime") { |
1949 type = INPUT_COMPONENT_TYPE_IME; | 1949 type = INPUT_COMPONENT_TYPE_IME; |
1950 } else if (type_str == "virtual_keyboard") { | |
1951 if (!api_permissions.count(ExtensionAPIPermission::kExperimental)) { | |
1952 // Virtual Keyboards require the experimental flag. | |
1953 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | |
1954 errors::kInvalidInputComponentType, base::IntToString(i)); | |
1955 return false; | |
1956 } | |
1957 type = INPUT_COMPONENT_TYPE_VIRTUAL_KEYBOARD; | |
1958 } else { | 1950 } else { |
1959 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1951 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
1960 errors::kInvalidInputComponentType, base::IntToString(i)); | 1952 errors::kInvalidInputComponentType, base::IntToString(i)); |
1961 return false; | 1953 return false; |
1962 } | 1954 } |
1963 } else { | 1955 } else { |
1964 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1956 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
1965 errors::kInvalidInputComponentType, base::IntToString(i)); | 1957 errors::kInvalidInputComponentType, base::IntToString(i)); |
1966 return false; | 1958 return false; |
1967 } | 1959 } |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2299 return false; | 2291 return false; |
2300 } | 2292 } |
2301 | 2293 |
2302 // Validate that the overrides are all strings | 2294 // Validate that the overrides are all strings |
2303 for (DictionaryValue::key_iterator iter = overrides->begin_keys(); | 2295 for (DictionaryValue::key_iterator iter = overrides->begin_keys(); |
2304 iter != overrides->end_keys(); ++iter) { | 2296 iter != overrides->end_keys(); ++iter) { |
2305 std::string page = *iter; | 2297 std::string page = *iter; |
2306 std::string val; | 2298 std::string val; |
2307 // Restrict override pages to a list of supported URLs. | 2299 // Restrict override pages to a list of supported URLs. |
2308 if ((page != chrome::kChromeUINewTabHost && | 2300 if ((page != chrome::kChromeUINewTabHost && |
2309 #if defined(USE_VIRTUAL_KEYBOARD) | |
2310 page != chrome::kChromeUIKeyboardHost && | |
2311 #endif | |
2312 #if defined(OS_CHROMEOS) | 2301 #if defined(OS_CHROMEOS) |
2313 page != chrome::kChromeUIActivationMessageHost && | 2302 page != chrome::kChromeUIActivationMessageHost && |
2314 #endif | 2303 #endif |
2315 page != chrome::kChromeUIBookmarksHost && | 2304 page != chrome::kChromeUIBookmarksHost && |
2316 page != chrome::kChromeUIHistoryHost | 2305 page != chrome::kChromeUIHistoryHost |
2317 #if defined(FILE_MANAGER_EXTENSION) | 2306 #if defined(FILE_MANAGER_EXTENSION) |
2318 && | 2307 && |
2319 !(location() == COMPONENT && | 2308 !(location() == COMPONENT && |
2320 page == chrome::kChromeUIFileManagerHost) | 2309 page == chrome::kChromeUIFileManagerHost) |
2321 #endif | 2310 #endif |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3557 | 3546 |
3558 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3547 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
3559 const Extension* extension, | 3548 const Extension* extension, |
3560 const ExtensionPermissionSet* permissions, | 3549 const ExtensionPermissionSet* permissions, |
3561 Reason reason) | 3550 Reason reason) |
3562 : reason(reason), | 3551 : reason(reason), |
3563 extension(extension), | 3552 extension(extension), |
3564 permissions(permissions) {} | 3553 permissions(permissions) {} |
3565 | 3554 |
3566 } // namespace extensions | 3555 } // namespace extensions |
OLD | NEW |