diff options
author | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 19:00:58 +0000 |
---|---|---|
committer | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 19:00:58 +0000 |
commit | 5b1a0e2e761921587a6a5844fa138c0f2055d739 (patch) | |
tree | f82c70dbfe9762178875050a42a955fbde49d240 /chrome | |
parent | f53e6e4e1ac624b1d9769e91d7e328ac100673ac (diff) | |
download | chromium_src-5b1a0e2e761921587a6a5844fa138c0f2055d739.zip chromium_src-5b1a0e2e761921587a6a5844fa138c0f2055d739.tar.gz chromium_src-5b1a0e2e761921587a6a5844fa138c0f2055d739.tar.bz2 |
Remove unused code from ExtensionsService.
Move extension.* from browser to common, so it can be included by the utility
process.
Review URL: http://codereview.chromium.org/115716
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16880 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
37 files changed, 82 insertions, 217 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 618fb4a..7c0f84d 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -19,7 +19,6 @@ #include "chrome/browser/debugger/debugger_host.h" #include "chrome/browser/debugger/devtools_manager.h" #include "chrome/browser/download/download_manager.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/find_bar.h" #include "chrome/browser/find_bar_controller.h" #include "chrome/browser/location_bar.h" @@ -39,6 +38,7 @@ #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/notification_service.h" #include "chrome/common/page_transition_types.h" #include "chrome/common/pref_names.h" diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index a1c1fdc..5d5404c 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -2012,14 +2012,6 @@ Name="Extensions" > <File - RelativePath=".\extensions\extension.cc" - > - </File> - <File - RelativePath=".\extensions\extension.h" - > - </File> - <File RelativePath=".\extensions\extension_bookmarks_module.cc" > </File> @@ -2044,22 +2036,6 @@ > </File> <File - RelativePath=".\extensions\extension_error_reporter.cc" - > - </File> - <File - RelativePath=".\extensions\extension_error_reporter.h" - > - </File> - <File - RelativePath=".\extensions\extension_error_utils.cc" - > - </File> - <File - RelativePath=".\extensions\extension_error_utils.h" - > - </File> - <File RelativePath=".\extensions\extension_event_names.cc" > </File> diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc index 6c80bbc..f881ae7 100644 --- a/chrome/browser/browser_theme_provider.cc +++ b/chrome/browser/browser_theme_provider.cc @@ -8,10 +8,10 @@ #include "base/string_util.h" #include "base/values.h" #include "chrome/browser/browser_list.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/profile.h" #include "chrome/browser/theme_resources_util.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "grit/app_resources.h" diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index a037fa01..4fa4de3 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -20,7 +20,6 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/download/download_file.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_process_host.h" @@ -31,6 +30,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/platform_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc index 30699f5..b3f81ca 100644 --- a/chrome/browser/extensions/extension_browser_event_router.cc +++ b/chrome/browser/extensions/extension_browser_event_router.cc @@ -8,11 +8,11 @@ #include "base/values.h" #include "chrome/browser/browser.h" #include "chrome/browser/profile.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extension_event_names.h" #include "chrome/browser/extensions/extension_message_service.h" #include "chrome/browser/extensions/extension_tabs_module_constants.h" #include "chrome/browser/tab_contents/navigation_entry.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/notification_service.h" namespace events = extension_event_names; diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 61f7a41..e1e87fe 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -9,7 +9,6 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/debugger/devtools_manager.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extension_message_service.h" #include "chrome/browser/extensions/extension_view.h" #include "chrome/browser/profile.h" @@ -20,6 +19,7 @@ #include "chrome/browser/tab_contents/site_instance.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc index 86371e0..9096e0a 100644 --- a/chrome/browser/extensions/extension_message_service.cc +++ b/chrome/browser/extensions/extension_message_service.cc @@ -9,13 +9,13 @@ #include "base/stl_util-inl.h" #include "base/values.h" #include "chrome/browser/chrome_thread.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extension_tabs_module.h" #include "chrome/browser/extensions/extension_view.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/resource_message_filter.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_util.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" diff --git a/chrome/browser/extensions/extension_page_actions_module.cc b/chrome/browser/extensions/extension_page_actions_module.cc index fb686d8..ab943e0 100644 --- a/chrome/browser/extensions/extension_page_actions_module.cc +++ b/chrome/browser/extensions/extension_page_actions_module.cc @@ -7,12 +7,12 @@ #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/profile.h" -#include "chrome/browser/extensions/extension.h" -#include "chrome/browser/extensions/extension_error_utils.h" #include "chrome/browser/extensions/extension_page_actions_module_constants.h" #include "chrome/browser/extensions/extension_tabs_module.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/tab_contents/navigation_entry.h" +#include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/extension_error_utils.h" namespace keys = extension_page_actions_module_constants; diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc index ac79d16..e8f7de6 100644 --- a/chrome/browser/extensions/extension_process_manager.cc +++ b/chrome/browser/extensions/extension_process_manager.cc @@ -5,12 +5,12 @@ #include "chrome/browser/extensions/extension_process_manager.h" #include "chrome/browser/browsing_instance.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extension_host.h" #include "chrome/browser/extensions/extension_view.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/site_instance.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/notification_service.h" static void CreateBackgroundHosts( diff --git a/chrome/browser/extensions/extension_process_manager_unittest.cc b/chrome/browser/extensions/extension_process_manager_unittest.cc index a72ac26..43d3048 100644 --- a/chrome/browser/extensions/extension_process_manager_unittest.cc +++ b/chrome/browser/extensions/extension_process_manager_unittest.cc @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/extension_error_reporter.h" #include "chrome/browser/extensions/extension_process_manager.h" #include "chrome/browser/tab_contents/site_instance.h" +#include "chrome/common/extensions/extension_error_reporter.h" #include "chrome/test/testing_profile.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc index 5cf75f5..3a31b0e 100644 --- a/chrome/browser/extensions/extension_protocols.cc +++ b/chrome/browser/extensions/extension_protocols.cc @@ -5,8 +5,8 @@ #include "chrome/browser/extensions/extension_protocols.h" #include "base/string_util.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/net/chrome_url_request_context.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" #include "googleurl/src/url_util.h" #include "net/base/net_util.h" diff --git a/chrome/browser/extensions/extension_shelf.cc b/chrome/browser/extensions/extension_shelf.cc index 445f181e..0c56833 100644 --- a/chrome/browser/extensions/extension_shelf.cc +++ b/chrome/browser/extensions/extension_shelf.cc @@ -8,11 +8,11 @@ #include "base/logging.h" #include "base/string_util.h" #include "chrome/browser/browser.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extension_process_manager.h" #include "chrome/browser/extensions/extension_view.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/profile.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/notification_service.h" #include "skia/ext/skia_utils.h" #include "views/controls/label.h" diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index c7bb630..5533ff5 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -7,13 +7,13 @@ #include "base/string_util.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" -#include "chrome/browser/extensions/extension.h" -#include "chrome/browser/extensions/extension_error_utils.h" #include "chrome/browser/extensions/extension_function_dispatcher.h" #include "chrome/browser/extensions/extension_tabs_module_constants.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/renderer_host/render_view_host_delegate.h" #include "chrome/browser/tab_contents/navigation_entry.h" +#include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/extension_error_utils.h" // TODO(port): Port these files. #if defined(OS_WIN) || defined(OS_MACOSX) diff --git a/chrome/browser/extensions/extension_ui_unittest.cc b/chrome/browser/extensions/extension_ui_unittest.cc index 0449e2a..2b1115b 100644 --- a/chrome/browser/extensions/extension_ui_unittest.cc +++ b/chrome/browser/extensions/extension_ui_unittest.cc @@ -4,9 +4,9 @@ #include "base/path_service.h" #include "base/string_util.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extensions_ui.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/json_value_serializer.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/extensions/extension_view_unittest.cc b/chrome/browser/extensions/extension_view_unittest.cc index 0efffa5..b344330 100644 --- a/chrome/browser/extensions/extension_view_unittest.cc +++ b/chrome/browser/extensions/extension_view_unittest.cc @@ -6,7 +6,6 @@ #include "chrome/browser/browser.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/extensions/extension_shelf.h" -#include "chrome/browser/extensions/extension_error_reporter.h" #include "chrome/browser/extensions/extension_host.h" #include "chrome/browser/extensions/extension_process_manager.h" #include "chrome/browser/extensions/extensions_service.h" @@ -14,6 +13,7 @@ #include "chrome/browser/tab_contents/site_instance.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension_error_reporter.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index e62f537..12001e7 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -18,12 +18,12 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extension_browser_event_router.h" -#include "chrome/browser/extensions/extension_error_reporter.h" #include "chrome/browser/extensions/extension_process_manager.h" #include "chrome/browser/profile.h" #include "chrome/browser/utility_process_host.h" +#include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/extension_error_reporter.h" #include "chrome/common/extensions/extension_unpacker.h" #include "chrome/common/json_value_serializer.h" #include "chrome/common/notification_service.h" @@ -559,136 +559,6 @@ void ExtensionsServiceBackend::ReportExtensionsLoaded( frontend_, &ExtensionsService::OnExtensionsLoaded, extensions)); } -// The extension file format is a header, followed by the manifest, followed -// by the zip file. The header is a magic number, a version, the size of the -// header, and the size of the manifest. These ints are 4 byte little endian. -DictionaryValue* ExtensionsServiceBackend::ReadManifest( - const FilePath& extension_path) { - ScopedStdioHandle file(file_util::OpenFile(extension_path, "rb")); - if (!file.get()) { - ReportExtensionInstallError(extension_path, "no such extension file"); - return NULL; - } - - // Read and verify the header. - ExtensionHeader header; - size_t len; - - // TODO(erikkay): Yuck. I'm not a big fan of this kind of code, but it - // appears that we don't have any endian/alignment aware serialization - // code in the code base. So for now, this assumes that we're running - // on a little endian machine with 4 byte alignment. - len = fread(&header, 1, sizeof(ExtensionHeader), file.get()); - if (len < sizeof(ExtensionHeader)) { - ReportExtensionInstallError(extension_path, "invalid extension header"); - return NULL; - } - if (strncmp(kExtensionFileMagic, header.magic, sizeof(header.magic))) { - ReportExtensionInstallError(extension_path, "bad magic number"); - return NULL; - } - if (header.version != kExpectedVersion) { - ReportExtensionInstallError(extension_path, "bad version number"); - return NULL; - } - if (header.header_size > sizeof(ExtensionHeader)) - fseek(file.get(), header.header_size - sizeof(ExtensionHeader), SEEK_CUR); - - char buf[1 << 16]; - std::string manifest_str; - size_t read_size = std::min(sizeof(buf), header.manifest_size); - size_t remainder = header.manifest_size; - while ((len = fread(buf, 1, read_size, file.get())) > 0) { - manifest_str.append(buf, len); - if (len <= remainder) - break; - remainder -= len; - read_size = std::min(sizeof(buf), remainder); - } - - // Verify the JSON - JSONStringValueSerializer json(manifest_str); - std::string error; - scoped_ptr<Value> val(json.Deserialize(&error)); - if (!val.get()) { - ReportExtensionInstallError(extension_path, error); - return NULL; - } - if (!val->IsType(Value::TYPE_DICTIONARY)) { - ReportExtensionInstallError(extension_path, - "manifest isn't a JSON dictionary"); - return NULL; - } - DictionaryValue* manifest = static_cast<DictionaryValue*>(val.get()); - - // Check the version before proceeding. Although we verify the version - // again later, checking it here allows us to skip some potentially expensive - // work. - std::string id; - if (!manifest->GetString(Extension::kIdKey, &id)) { - ReportExtensionInstallError(extension_path, "missing id key"); - return NULL; - } - FilePath dest_dir = install_directory_.AppendASCII(id.c_str()); - if (file_util::PathExists(dest_dir)) { - std::string version; - if (!manifest->GetString(Extension::kVersionKey, &version)) { - ReportExtensionInstallError(extension_path, "missing version key"); - return NULL; - } - std::string current_version; - if (ReadCurrentVersion(dest_dir, ¤t_version)) { - if (!CheckCurrentVersion(version, current_version, dest_dir)) - return NULL; - } - } - - std::string zip_hash; - if (!manifest->GetString(Extension::kZipHashKey, &zip_hash)) { - ReportExtensionInstallError(extension_path, "missing zip_hash key"); - return NULL; - } - if (zip_hash.size() != kZipHashHexBytes) { - ReportExtensionInstallError(extension_path, "invalid zip_hash key"); - return NULL; - } - - // Read the rest of the zip file and compute a hash to compare against - // what the manifest claims. Compute the hash incrementally since the - // zip file could be large. - const unsigned char* ubuf = reinterpret_cast<const unsigned char*>(buf); - SHA256Context ctx; - SHA256_Begin(&ctx); - while ((len = fread(buf, 1, sizeof(buf), file.get())) > 0) - SHA256_Update(&ctx, ubuf, len); - uint8 hash[32]; - SHA256_End(&ctx, hash, NULL, sizeof(hash)); - - std::vector<uint8> zip_hash_bytes; - if (!HexStringToBytes(zip_hash, &zip_hash_bytes)) { - ReportExtensionInstallError(extension_path, "invalid zip_hash key"); - return NULL; - } - if (zip_hash_bytes.size() != kZipHashBytes) { - ReportExtensionInstallError(extension_path, "invalid zip_hash key"); - return NULL; - } - for (size_t i = 0; i < kZipHashBytes; ++i) { - if (zip_hash_bytes[i] != hash[i]) { - ReportExtensionInstallError(extension_path, - "zip_hash key didn't match zip hash"); - return NULL; - } - } - - // TODO(erikkay): The manifest will also contain a signature of the hash - // (or perhaps the whole manifest) for authentication purposes. - - // The caller owns val (now cast to manifest). - val.release(); - return manifest; -} - bool ExtensionsServiceBackend::ReadCurrentVersion(const FilePath& dir, std::string* version_string) { FilePath current_version = diff --git a/chrome/browser/extensions/extensions_service.h b/chrome/browser/extensions/extensions_service.h index 56bebee..105533a 100644 --- a/chrome/browser/extensions/extensions_service.h +++ b/chrome/browser/extensions/extensions_service.h @@ -196,10 +196,6 @@ class ExtensionsServiceBackend // Notify the frontend that the extension had already been installed. void ReportExtensionVersionReinstalled(const std::string& id); - // Read the manifest from the front of the extension file. - // Caller takes ownership of return value. - DictionaryValue* ReadManifest(const FilePath& extension_path); - // Reads the Current Version file from |dir| into |version_string|. bool ReadCurrentVersion(const FilePath& dir, std::string* version_string); diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc index 7b0a88f..57cd42c 100644 --- a/chrome/browser/extensions/extensions_service_unittest.cc +++ b/chrome/browser/extensions/extensions_service_unittest.cc @@ -12,11 +12,11 @@ #include "base/path_service.h" #include "base/string_util.h" #include "base/time.h" -#include "chrome/browser/extensions/extension.h" -#include "chrome/browser/extensions/extension_error_reporter.h" #include "chrome/browser/extensions/extensions_service.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/url_pattern.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/extensions/extension_error_reporter.h" #include "chrome/common/json_value_serializer.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_service.h" diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc index 8dafb8e..c23dcb6 100644 --- a/chrome/browser/extensions/extensions_ui.cc +++ b/chrome/browser/extensions/extensions_ui.cc @@ -10,13 +10,13 @@ #include "base/thread.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/debugger/devtools_manager.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extension_message_service.h" #include "chrome/browser/extensions/extensions_service.h" -#include "chrome/browser/extensions/extension_error_reporter.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_widget_host.h" #include "chrome/browser/renderer_host/render_view_host.h" +#include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/extension_error_reporter.h" #include "chrome/common/extensions/user_script.h" #include "chrome/common/extensions/url_pattern.h" #include "chrome/common/jstemplate_builder.h" diff --git a/chrome/browser/extensions/test_extension_loader.h b/chrome/browser/extensions/test_extension_loader.h index 4fb74d9..60ca84f 100644 --- a/chrome/browser/extensions/test_extension_loader.h +++ b/chrome/browser/extensions/test_extension_loader.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_LOADER_H_ #define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_LOADER_H_ -#include "chrome/browser/extensions/extension.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc index 5051cd6..5d28cb4 100644 --- a/chrome/browser/extensions/user_script_master.cc +++ b/chrome/browser/extensions/user_script_master.cc @@ -14,8 +14,8 @@ #include "base/string_util.h" #include "base/thread.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extensions_service.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/notification_service.h" #include "chrome/common/url_constants.h" #include "net/base/net_util.h" diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc index fced49f..42554ff 100644 --- a/chrome/browser/net/chrome_url_request_context.cc +++ b/chrome/browser/net/chrome_url_request_context.cc @@ -8,12 +8,12 @@ #include "base/string_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/extensions/user_script_master.h" #include "chrome/browser/profile.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc index e2c6215..d5247e2 100644 --- a/chrome/browser/plugin_service.cc +++ b/chrome/browser/plugin_service.cc @@ -12,12 +12,12 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_plugin_host.h" #include "chrome/browser/chrome_thread.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/plugin_process_host.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/common/chrome_plugin_lib.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/notification_type.h" #include "chrome/common/notification_service.h" diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index 4afea85..5fba79e 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -14,7 +14,6 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/download/download_manager.h" -#include "chrome/browser/extensions/extension_error_reporter.h" #include "chrome/browser/extensions/extension_process_manager.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/extensions/user_script_master.h" @@ -35,6 +34,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension_error_reporter.h" #include "chrome/common/net/cookie_monster_sqlite.h" #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index fdf641f..7f9a2fd 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -18,7 +18,6 @@ #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_theme_provider.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extension_view.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/metrics/user_metrics.h" @@ -29,6 +28,7 @@ #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/view_ids.h" #include "chrome/browser/views/event_utils.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/notification_service.h" #include "chrome/common/page_transition_types.h" #include "chrome/common/pref_names.h" diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index d9cc354..8287ac6 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -17,7 +17,6 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/command_updater.h" -#include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extension_browser_event_router.h" #include "chrome/browser/extensions/extension_tabs_module.h" #include "chrome/browser/extensions/extensions_service.h" @@ -28,6 +27,7 @@ #include "chrome/browser/view_ids.h" #include "chrome/browser/views/info_bubble.h" #include "chrome/browser/views/first_run_bubble.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/page_action.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 2f46a76..cdee4fc 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -235,6 +235,12 @@ ], 'sources': [ # All .cc, .h, and .mm files under chrome/common except for tests. + 'common/extensions/extension.cc', + 'common/extensions/extension.h', + 'common/extensions/extension_error_reporter.cc', + 'common/extensions/extension_error_reporter.h', + 'common/extensions/extension_error_utils.cc', + 'common/extensions/extension_error_utils.h', 'common/extensions/extension_unpacker.cc', 'common/extensions/extension_unpacker.h', 'common/extensions/url_pattern.cc', @@ -806,16 +812,10 @@ 'browser/encoding_menu_controller.h', 'browser/encoding_menu_controller_delegate.cc', 'browser/encoding_menu_controller_delegate.h', - 'browser/extensions/extension.cc', - 'browser/extensions/extension.h', 'browser/extensions/extension_bookmarks_module.cc', 'browser/extensions/extension_bookmarks_module.h', 'browser/extensions/extension_bookmarks_module_constants.cc', 'browser/extensions/extension_bookmarks_module_constants.h', - 'browser/extensions/extension_error_reporter.cc', - 'browser/extensions/extension_error_reporter.h', - 'browser/extensions/extension_error_utils.cc', - 'browser/extensions/extension_error_utils.h', 'browser/extensions/extension_event_names.cc', 'browser/extensions/extension_event_names.h', 'browser/extensions/extension_function.cc', @@ -2907,7 +2907,6 @@ 'browser/extensions/extension_messages_unittest.cc', 'browser/extensions/extension_process_manager_unittest.h', 'browser/extensions/extension_ui_unittest.cc', - 'browser/extensions/extension_unittest.cc', 'browser/extensions/extensions_service_unittest.cc', 'browser/extensions/test_extension_loader.cc', 'browser/extensions/user_script_master_unittest.cc', @@ -2989,6 +2988,7 @@ 'browser/window_sizer_unittest.cc', 'common/bzip2_unittest.cc', 'common/chrome_plugin_unittest.cc', + 'common/extensions/extension_unittest.cc', 'common/extensions/url_pattern_unittest.cc', 'common/extensions/user_script_unittest.cc', 'common/file_descriptor_set_unittest.cc', diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj index c1180c2..9064ac6 100644 --- a/chrome/common/common.vcproj +++ b/chrome/common/common.vcproj @@ -253,6 +253,30 @@ Name="extensions" > <File + RelativePath=".\extensions\extension.cc" + > + </File> + <File + RelativePath=".\extensions\extension.h" + > + </File> + <File + RelativePath=".\extensions\extension_error_reporter.cc" + > + </File> + <File + RelativePath=".\extensions\extension_error_reporter.h" + > + </File> + <File + RelativePath=".\extensions\extension_error_utils.cc" + > + </File> + <File + RelativePath=".\extensions\extension_error_utils.h" + > + </File> + <File RelativePath=".\extensions\extension_unpacker.cc" > </File> diff --git a/chrome/browser/extensions/extension.cc b/chrome/common/extensions/extension.cc index fcfdbb0..710a7e5 100644 --- a/chrome/browser/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/extension.h" +#include "chrome/common/extensions/extension.h" #include "app/resource_bundle.h" #include "base/file_path.h" @@ -10,8 +10,8 @@ #include "base/logging.h" #include "base/string_util.h" #include "net/base/net_util.h" -#include "chrome/browser/extensions/extension_error_reporter.h" -#include "chrome/browser/extensions/extension_error_utils.h" +#include "chrome/common/extensions/extension_error_reporter.h" +#include "chrome/common/extensions/extension_error_utils.h" #include "chrome/common/extensions/user_script.h" #include "chrome/common/url_constants.h" diff --git a/chrome/browser/extensions/extension.h b/chrome/common/extensions/extension.h index 0160abd..e099a7e 100644 --- a/chrome/browser/extensions/extension.h +++ b/chrome/common/extensions/extension.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_H_ -#define CHROME_BROWSER_EXTENSIONS_EXTENSION_H_ +#ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_ +#define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ #include <string> #include <vector> @@ -14,7 +14,7 @@ #include "base/string16.h" #include "base/values.h" #include "base/version.h" -#include "chrome/browser/extensions/user_script_master.h" +#include "chrome/common/extensions/user_script.h" #include "chrome/common/extensions/url_pattern.h" #include "chrome/common/page_action.h" #include "googleurl/src/gurl.h" @@ -244,4 +244,4 @@ class Extension { DISALLOW_COPY_AND_ASSIGN(Extension); }; -#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_H_ +#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ diff --git a/chrome/browser/extensions/extension_error_reporter.cc b/chrome/common/extensions/extension_error_reporter.cc index c3a028c..efc0aa0 100644 --- a/chrome/browser/extensions/extension_error_reporter.cc +++ b/chrome/common/extensions/extension_error_reporter.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/extension_error_reporter.h" +#include "chrome/common/extensions/extension_error_reporter.h" #if defined(OS_WIN) #include "app/win_util.h" diff --git a/chrome/browser/extensions/extension_error_reporter.h b/chrome/common/extensions/extension_error_reporter.h index b85927f..347f7d6 100644 --- a/chrome/browser/extensions/extension_error_reporter.h +++ b/chrome/common/extensions/extension_error_reporter.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_ERROR_REPORTER_H_ -#define CHROME_BROWSER_EXTENSIONS_ERROR_REPORTER_H_ +#ifndef CHROME_COMMON_EXTENSIONS_ERROR_REPORTER_H_ +#define CHROME_COMMON_EXTENSIONS_ERROR_REPORTER_H_ #include <string> #include <vector> @@ -47,4 +47,4 @@ class ExtensionErrorReporter { bool enable_noisy_errors_; }; -#endif // CHROME_BROWSER_EXTENSIONS_ERROR_REPORTER_H_ +#endif // CHROME_COMMON_EXTENSIONS_ERROR_REPORTER_H_ diff --git a/chrome/browser/extensions/extension_error_utils.cc b/chrome/common/extensions/extension_error_utils.cc index c43587b..724cdcd 100755 --- a/chrome/browser/extensions/extension_error_utils.cc +++ b/chrome/common/extensions/extension_error_utils.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/extension_error_utils.h" +#include "chrome/common/extensions/extension_error_utils.h" #include "base/string_util.h" diff --git a/chrome/browser/extensions/extension_error_utils.h b/chrome/common/extensions/extension_error_utils.h index 1d7283a..f9f1e7c 100755 --- a/chrome/browser/extensions/extension_error_utils.h +++ b/chrome/common/extensions/extension_error_utils.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_UTILS_H_ -#define CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_UTILS_H_ +#ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_ERROR_UTILS_H_ +#define CHROME_COMMON_EXTENSIONS_EXTENSION_ERROR_UTILS_H_ #include <string> @@ -21,4 +21,4 @@ public: const std::string s2); }; -#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FORMAT_MESSAGE_UTILS_H_ +#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ERROR_UTILS_H_ diff --git a/chrome/browser/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc index 0607186..7f0f288 100644 --- a/chrome/browser/extensions/extension_unittest.cc +++ b/chrome/common/extensions/extension_unittest.cc @@ -5,9 +5,9 @@ #include "base/file_path.h" #include "base/string_util.h" #include "base/path_service.h" -#include "chrome/browser/extensions/extension.h" -#include "chrome/browser/extensions/extension_error_reporter.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/extension_error_reporter.h" #include "chrome/common/json_value_serializer.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/common/extensions/extension_unpacker.cc b/chrome/common/extensions/extension_unpacker.cc index c59b113..c39f9a2 100644 --- a/chrome/common/extensions/extension_unpacker.cc +++ b/chrome/common/extensions/extension_unpacker.cc @@ -13,8 +13,7 @@ #include "base/thread.h" #include "base/values.h" #include "net/base/file_stream.h" -// TODO(mpcomplete): move to common -#include "chrome/browser/extensions/extension.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/json_value_serializer.h" #include "chrome/common/notification_service.h" #include "chrome/common/unzip.h" diff --git a/chrome/test/unit/unittests.vcproj b/chrome/test/unit/unittests.vcproj index d99a072..47f1c63 100644 --- a/chrome/test/unit/unittests.vcproj +++ b/chrome/test/unit/unittests.vcproj @@ -542,10 +542,6 @@ > </File> <File - RelativePath="..\..\browser\extensions\extension_unittest.cc" - > - </File> - <File RelativePath="..\..\browser\extensions\extension_view_unittest.cc" > </File> @@ -1018,6 +1014,10 @@ > </File> <File + RelativePath="..\..\common\extensions\extension_unittest.cc" + > + </File> + <File RelativePath="..\..\common\important_file_writer_unittest.cc" > </File> |