OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/browser/extensions/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/gfx/png_encoder.h" | 10 #include "base/gfx/png_encoder.h" |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 if (!extension.InitFromValue(manifest, | 892 if (!extension.InitFromValue(manifest, |
893 true, // require ID | 893 true, // require ID |
894 &error)) { | 894 &error)) { |
895 ReportExtensionInstallError(extension_path, "Invalid extension manifest."); | 895 ReportExtensionInstallError(extension_path, "Invalid extension manifest."); |
896 return; | 896 return; |
897 } | 897 } |
898 | 898 |
899 if (!frontend_->extensions_enabled() && !extension.IsTheme()) { | 899 if (!frontend_->extensions_enabled() && !extension.IsTheme()) { |
900 #if defined(OS_WIN) | 900 #if defined(OS_WIN) |
901 if (frontend_->show_extensions_prompts()) { | 901 if (frontend_->show_extensions_prompts()) { |
902 win_util::MessageBox(GetActiveWindow(), | 902 win_util::MessageBox(GetForegroundWindow(), |
903 L"Extensions are not enabled. Add --enable-extensions to the " | 903 L"Extensions are not enabled. Add --enable-extensions to the " |
904 L"command-line to enable extensions.\n\n" | 904 L"command-line to enable extensions.\n\n" |
905 L"This is a temporary message and it will be removed when extensions " | 905 L"This is a temporary message and it will be removed when extensions " |
906 L"UI is finalized.", | 906 L"UI is finalized.", |
907 l10n_util::GetString(IDS_PRODUCT_NAME).c_str(), MB_OK); | 907 l10n_util::GetString(IDS_PRODUCT_NAME).c_str(), MB_OK); |
908 } | 908 } |
909 #endif | 909 #endif |
910 ReportExtensionInstallError(extension_path, | 910 ReportExtensionInstallError(extension_path, |
911 "Extensions are not enabled."); | 911 "Extensions are not enabled."); |
912 return; | 912 return; |
913 } | 913 } |
914 | 914 |
915 #if defined(OS_WIN) | 915 #if defined(OS_WIN) |
916 if (!extension.IsTheme() && !from_external && | 916 if (!extension.IsTheme() && !from_external && |
917 frontend_->show_extensions_prompts() && | 917 frontend_->show_extensions_prompts() && |
918 win_util::MessageBox(GetActiveWindow(), | 918 win_util::MessageBox(GetForegroundWindow(), |
919 L"Are you sure you want to install this extension?\n\n" | 919 L"Are you sure you want to install this extension?\n\n" |
920 L"This is a temporary message and it will be removed when extensions " | 920 L"This is a temporary message and it will be removed when extensions " |
921 L"UI is finalized.", | 921 L"UI is finalized.", |
922 l10n_util::GetString(IDS_PRODUCT_NAME).c_str(), | 922 l10n_util::GetString(IDS_PRODUCT_NAME).c_str(), |
923 MB_OKCANCEL) != IDOK) { | 923 MB_OKCANCEL) != IDOK) { |
924 ReportExtensionInstallError(extension_path, | 924 ReportExtensionInstallError(extension_path, |
925 "User did not allow extension to be installed."); | 925 "User did not allow extension to be installed."); |
926 return; | 926 return; |
927 } | 927 } |
928 #endif | 928 #endif |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 } | 1223 } |
1224 | 1224 |
1225 bool ExtensionsServiceBackend::ShouldInstall(const std::string& id, | 1225 bool ExtensionsServiceBackend::ShouldInstall(const std::string& id, |
1226 const Version* version) { | 1226 const Version* version) { |
1227 FilePath dir(install_directory_.AppendASCII(id.c_str())); | 1227 FilePath dir(install_directory_.AppendASCII(id.c_str())); |
1228 std::string current_version; | 1228 std::string current_version; |
1229 if (ReadCurrentVersion(dir, ¤t_version)) | 1229 if (ReadCurrentVersion(dir, ¤t_version)) |
1230 return CheckCurrentVersion(version->GetString(), current_version, dir); | 1230 return CheckCurrentVersion(version->GetString(), current_version, dir); |
1231 return true; | 1231 return true; |
1232 } | 1232 } |
OLD | NEW |