Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1633)

Side by Side Diff: chrome/browser/extensions/extensions_service.cc

Issue 118328: chrome.exe --package-extension (Closed)
Patch Set: final Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "base/registry.h" 43 #include "base/registry.h"
44 #include "base/win_util.h" 44 #include "base/win_util.h"
45 #endif 45 #endif
46 46
47 // ExtensionsService. 47 // ExtensionsService.
48 48
49 const char* ExtensionsService::kInstallDirectoryName = "Extensions"; 49 const char* ExtensionsService::kInstallDirectoryName = "Extensions";
50 const char* ExtensionsService::kCurrentVersionFileName = "Current Version"; 50 const char* ExtensionsService::kCurrentVersionFileName = "Current Version";
51 const char* ExtensionsServiceBackend::kTempExtensionName = "TEMP_INSTALL"; 51 const char* ExtensionsServiceBackend::kTempExtensionName = "TEMP_INSTALL";
52 52
53 const char* ExtensionsService::kExtensionFileMagic = "Cr24";
54
53 namespace { 55 namespace {
54 // Chromium Extension magic number
55 const char kExtensionFileMagic[] = "Cr24";
56
57 struct ExtensionHeader {
58 char magic[sizeof(kExtensionFileMagic) - 1];
59 uint32 version;
60 size_t header_size;
61 size_t manifest_size;
62 };
63
64 const size_t kZipHashBytes = 32; // SHA-256
65 const size_t kZipHashHexBytes = kZipHashBytes * 2; // Hex string is 2x size.
66 56
67 // A preference that keeps track of extension settings. This is a dictionary 57 // A preference that keeps track of extension settings. This is a dictionary
68 // object read from the Preferences file, keyed off of extension id's. 58 // object read from the Preferences file, keyed off of extension id's.
69 const wchar_t kExternalExtensionsPref[] = L"extensions.settings"; 59 const wchar_t kExternalExtensionsPref[] = L"extensions.settings";
70 60
71 // A preference keeping track of how the extension was installed. 61 // A preference keeping track of how the extension was installed.
72 const wchar_t kLocation[] = L"location"; 62 const wchar_t kLocation[] = L"location";
73 const wchar_t kState[] = L"state"; 63 const wchar_t kState[] = L"state";
74 64
75 // Registry key where registry defined extension installers live. 65 // Registry key where registry defined extension installers live.
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 1253
1264 bool ExtensionsServiceBackend::ShouldInstall(const std::string& id, 1254 bool ExtensionsServiceBackend::ShouldInstall(const std::string& id,
1265 const std::string& version) { 1255 const std::string& version) {
1266 FilePath dir(install_directory_.AppendASCII(id.c_str())); 1256 FilePath dir(install_directory_.AppendASCII(id.c_str()));
1267 std::string current_version; 1257 std::string current_version;
1268 if (ReadCurrentVersion(dir, &current_version)) { 1258 if (ReadCurrentVersion(dir, &current_version)) {
1269 return CheckCurrentVersion(version, current_version, dir); 1259 return CheckCurrentVersion(version, current_version, dir);
1270 } 1260 }
1271 return true; 1261 return true;
1272 } 1262 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_service.h ('k') | chrome/browser/extensions/extensions_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698