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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 &launch_min_width_, | 1243 &launch_min_width_, |
1244 can_specify_size_range, | 1244 can_specify_size_range, |
1245 error)) | 1245 error)) |
1246 return false; | 1246 return false; |
1247 if (!ReadLaunchDimension(manifest_, | 1247 if (!ReadLaunchDimension(manifest_, |
1248 keys::kLaunchMinHeight, | 1248 keys::kLaunchMinHeight, |
1249 &launch_min_height_, | 1249 &launch_min_height_, |
1250 can_specify_size_range, | 1250 can_specify_size_range, |
1251 error)) | 1251 error)) |
1252 return false; | 1252 return false; |
| 1253 if (!ReadLaunchDimension(manifest_, |
| 1254 keys::kLaunchMaxWidth, |
| 1255 &launch_max_width_, |
| 1256 can_specify_size_range, |
| 1257 error)) |
| 1258 return false; |
| 1259 if (!ReadLaunchDimension(manifest_, |
| 1260 keys::kLaunchMaxHeight, |
| 1261 &launch_max_height_, |
| 1262 can_specify_size_range, |
| 1263 error)) |
| 1264 return false; |
1253 | 1265 |
1254 if (launch_container() == extension_misc::LAUNCH_SHELL) { | 1266 if (launch_container() == extension_misc::LAUNCH_SHELL) { |
1255 if (!manifest_->Get(keys::kLaunchWidth, &temp)) { | 1267 if (!manifest_->Get(keys::kLaunchWidth, &temp)) { |
1256 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1268 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
1257 errors::kInvalidLaunchValue, | 1269 errors::kInvalidLaunchValue, |
1258 keys::kLaunchWidth); | 1270 keys::kLaunchWidth); |
1259 return false; | 1271 return false; |
1260 } | 1272 } |
1261 if (!manifest_->Get(keys::kLaunchHeight, &temp)) { | 1273 if (!manifest_->Get(keys::kLaunchHeight, &temp)) { |
1262 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1274 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
1263 errors::kInvalidLaunchValue, | 1275 errors::kInvalidLaunchValue, |
1264 keys::kLaunchHeight); | 1276 keys::kLaunchHeight); |
1265 return false; | 1277 return false; |
1266 } | 1278 } |
| 1279 if (launch_max_width_ > 0 && launch_max_width_ < launch_min_width_) { |
| 1280 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1281 errors::kInvalidLaunchValue, |
| 1282 keys::kLaunchMaxWidth); |
| 1283 return false; |
| 1284 } |
| 1285 if (launch_max_height_ > 0 && launch_max_height_ < launch_min_height_) { |
| 1286 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1287 errors::kInvalidLaunchValue, |
| 1288 keys::kLaunchMaxHeight); |
| 1289 return false; |
| 1290 } |
1267 } | 1291 } |
1268 | 1292 |
1269 return true; | 1293 return true; |
1270 } | 1294 } |
1271 | 1295 |
1272 bool Extension::LoadAppIsolation(string16* error) { | 1296 bool Extension::LoadAppIsolation(string16* error) { |
1273 Value* temp = NULL; | 1297 Value* temp = NULL; |
1274 if (!manifest_->Get(keys::kIsolation, &temp)) | 1298 if (!manifest_->Get(keys::kIsolation, &temp)) |
1275 return true; | 1299 return true; |
1276 | 1300 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 offline_enabled_(false), | 1528 offline_enabled_(false), |
1505 converted_from_user_script_(false), | 1529 converted_from_user_script_(false), |
1506 background_page_persists_(true), | 1530 background_page_persists_(true), |
1507 manifest_(manifest.release()), | 1531 manifest_(manifest.release()), |
1508 is_storage_isolated_(false), | 1532 is_storage_isolated_(false), |
1509 launch_container_(extension_misc::LAUNCH_TAB), | 1533 launch_container_(extension_misc::LAUNCH_TAB), |
1510 launch_width_(0), | 1534 launch_width_(0), |
1511 launch_height_(0), | 1535 launch_height_(0), |
1512 launch_min_width_(0), | 1536 launch_min_width_(0), |
1513 launch_min_height_(0), | 1537 launch_min_height_(0), |
| 1538 launch_max_width_(0), |
| 1539 launch_max_height_(0), |
1514 wants_file_access_(false), | 1540 wants_file_access_(false), |
1515 creation_flags_(0) { | 1541 creation_flags_(0) { |
1516 DCHECK(path.empty() || path.IsAbsolute()); | 1542 DCHECK(path.empty() || path.IsAbsolute()); |
1517 path_ = MaybeNormalizePath(path); | 1543 path_ = MaybeNormalizePath(path); |
1518 } | 1544 } |
1519 | 1545 |
1520 Extension::~Extension() { | 1546 Extension::~Extension() { |
1521 if (manifest_) | 1547 if (manifest_) |
1522 delete manifest_; | 1548 delete manifest_; |
1523 } | 1549 } |
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3299 already_disabled(false), | 3325 already_disabled(false), |
3300 extension(extension) {} | 3326 extension(extension) {} |
3301 | 3327 |
3302 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3328 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
3303 const Extension* extension, | 3329 const Extension* extension, |
3304 const ExtensionPermissionSet* permissions, | 3330 const ExtensionPermissionSet* permissions, |
3305 Reason reason) | 3331 Reason reason) |
3306 : reason(reason), | 3332 : reason(reason), |
3307 extension(extension), | 3333 extension(extension), |
3308 permissions(permissions) {} | 3334 permissions(permissions) {} |
OLD | NEW |