| 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 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 GURL Extension::GetBaseURLFromExtensionId(const std::string& extension_id) { | 927 GURL Extension::GetBaseURLFromExtensionId(const std::string& extension_id) { |
| 928 return GURL(std::string(chrome::kExtensionScheme) + | 928 return GURL(std::string(chrome::kExtensionScheme) + |
| 929 chrome::kStandardSchemeSeparator + extension_id + "/"); | 929 chrome::kStandardSchemeSeparator + extension_id + "/"); |
| 930 } | 930 } |
| 931 | 931 |
| 932 // static | 932 // static |
| 933 bool Extension::AppsAreEnabled() { | 933 bool Extension::AppsAreEnabled() { |
| 934 #if defined(OS_CHROMEOS) | 934 #if defined(OS_CHROMEOS) |
| 935 return true; | 935 return true; |
| 936 #else | 936 #else |
| 937 static bool apps_enabled_mode = | 937 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps); |
| 938 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps); | |
| 939 return apps_enabled_mode; | |
| 940 #endif | 938 #endif |
| 941 } | 939 } |
| 942 | 940 |
| 943 bool Extension::InitFromValue(const DictionaryValue& source, bool require_key, | 941 bool Extension::InitFromValue(const DictionaryValue& source, bool require_key, |
| 944 std::string* error) { | 942 std::string* error) { |
| 945 if (source.HasKey(keys::kPublicKey)) { | 943 if (source.HasKey(keys::kPublicKey)) { |
| 946 std::string public_key_bytes; | 944 std::string public_key_bytes; |
| 947 if (!source.GetString(keys::kPublicKey, &public_key_) || | 945 if (!source.GetString(keys::kPublicKey, &public_key_) || |
| 948 !ParsePEMKeyBytes(public_key_, &public_key_bytes) || | 946 !ParsePEMKeyBytes(public_key_, &public_key_bytes) || |
| 949 !GenerateId(public_key_bytes, &id_)) { | 947 !GenerateId(public_key_bytes, &id_)) { |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 } else { | 1712 } else { |
| 1715 return false; | 1713 return false; |
| 1716 } | 1714 } |
| 1717 } else { | 1715 } else { |
| 1718 return true; | 1716 return true; |
| 1719 } | 1717 } |
| 1720 } | 1718 } |
| 1721 } | 1719 } |
| 1722 return false; | 1720 return false; |
| 1723 } | 1721 } |
| OLD | NEW |