OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 } else if (launch_container_string == values::kLaunchContainerWindow) { | 689 } else if (launch_container_string == values::kLaunchContainerWindow) { |
690 launch_container_ = LAUNCH_WINDOW; | 690 launch_container_ = LAUNCH_WINDOW; |
691 } else { | 691 } else { |
692 *error = errors::kInvalidLaunchContainer; | 692 *error = errors::kInvalidLaunchContainer; |
693 return false; | 693 return false; |
694 } | 694 } |
695 | 695 |
696 return true; | 696 return true; |
697 } | 697 } |
698 | 698 |
| 699 bool Extension::LoadLaunchFullscreen(const DictionaryValue* manifest, |
| 700 std::string* error) { |
| 701 Value* temp = NULL; |
| 702 if (!manifest->Get(keys::kLaunchFullscreen, &temp)) |
| 703 return true; |
| 704 |
| 705 if (!temp->GetAsBoolean(&launch_fullscreen_)) { |
| 706 *error = errors::kInvalidLaunchFullscreen; |
| 707 return false; |
| 708 } |
| 709 |
| 710 return true; |
| 711 } |
| 712 |
699 Extension::Extension(const FilePath& path) | 713 Extension::Extension(const FilePath& path) |
700 : converted_from_user_script_(false), | 714 : converted_from_user_script_(false), |
701 is_theme_(false), | 715 is_theme_(false), |
702 web_content_enabled_(false), | 716 web_content_enabled_(false), |
703 launch_container_(LAUNCH_TAB), | 717 launch_container_(LAUNCH_TAB), |
| 718 launch_fullscreen_(false), |
704 background_page_ready_(false), | 719 background_page_ready_(false), |
705 being_upgraded_(false) { | 720 being_upgraded_(false) { |
706 DCHECK(path.IsAbsolute()); | 721 DCHECK(path.IsAbsolute()); |
707 | 722 |
708 apps_enabled_ = CommandLine::ForCurrentProcess()->HasSwitch( | 723 apps_enabled_ = CommandLine::ForCurrentProcess()->HasSwitch( |
709 switches::kEnableExtensionApps); | 724 switches::kEnableExtensionApps); |
710 location_ = INVALID; | 725 location_ = INVALID; |
711 | 726 |
712 #if defined(OS_WIN) | 727 #if defined(OS_WIN) |
713 // Normalize any drive letter to upper-case. We do this for consistency with | 728 // Normalize any drive letter to upper-case. We do this for consistency with |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 *error = errors::kMultipleOverrides; | 1441 *error = errors::kMultipleOverrides; |
1427 return false; | 1442 return false; |
1428 } | 1443 } |
1429 } | 1444 } |
1430 | 1445 |
1431 if (!CheckAppsAreEnabled(manifest_value_.get(), error) || | 1446 if (!CheckAppsAreEnabled(manifest_value_.get(), error) || |
1432 !LoadWebContentEnabled(manifest_value_.get(), error) || | 1447 !LoadWebContentEnabled(manifest_value_.get(), error) || |
1433 !LoadWebOrigin(manifest_value_.get(), error) || | 1448 !LoadWebOrigin(manifest_value_.get(), error) || |
1434 !LoadWebPaths(manifest_value_.get(), error) || | 1449 !LoadWebPaths(manifest_value_.get(), error) || |
1435 !LoadLaunchURL(manifest_value_.get(), error) || | 1450 !LoadLaunchURL(manifest_value_.get(), error) || |
1436 !LoadLaunchContainer(manifest_value_.get(), error)) { | 1451 !LoadLaunchContainer(manifest_value_.get(), error) || |
| 1452 !LoadLaunchFullscreen(manifest_value_.get(), error)) { |
1437 return false; | 1453 return false; |
1438 } | 1454 } |
1439 | 1455 |
1440 // Although |source| is passed in as a const, it's still possible to modify | 1456 // Although |source| is passed in as a const, it's still possible to modify |
1441 // it. This is dangerous since the utility process re-uses |source| after | 1457 // it. This is dangerous since the utility process re-uses |source| after |
1442 // it calls InitFromValue, passing it up to the browser process which calls | 1458 // it calls InitFromValue, passing it up to the browser process which calls |
1443 // InitFromValue again. As a result, we need to make sure that nobody | 1459 // InitFromValue again. As a result, we need to make sure that nobody |
1444 // accidentally modifies it. | 1460 // accidentally modifies it. |
1445 DCHECK(source.Equals(manifest_value_.get())); | 1461 DCHECK(source.Equals(manifest_value_.get())); |
1446 | 1462 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 } else { | 1657 } else { |
1642 return false; | 1658 return false; |
1643 } | 1659 } |
1644 } else { | 1660 } else { |
1645 return true; | 1661 return true; |
1646 } | 1662 } |
1647 } | 1663 } |
1648 } | 1664 } |
1649 return false; | 1665 return false; |
1650 } | 1666 } |
OLD | NEW |