Skip to content

Commit

Permalink
Remove extensions APIs in src/extensions from Android build
Browse files Browse the repository at this point in the history
This removes both the socket API and the local storage API from the Android build. Android doesn't use them, but was compiling them in so Chrome would link.

No functional changes.

BUG=348058
TEST=compiles, Android unit_tests pass

Review URL: https://codereview.chromium.org/198293005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257529 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jamescook@chromium.org committed Mar 17, 2014
1 parent 363073c commit be514c3
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 12 deletions.
11 changes: 8 additions & 3 deletions chrome/browser/extensions/chrome_extensions_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/activity_log/activity_log.h"
#include "chrome/browser/extensions/api/chrome_extensions_api_client.h"
#include "chrome/browser/extensions/api/preference/chrome_direct_setting.h"
#include "chrome/browser/extensions/api/preference/preference_api.h"
#include "chrome/browser/extensions/api/runtime/runtime_api.h"
Expand Down Expand Up @@ -40,10 +39,16 @@
#include "chromeos/chromeos_switches.h"
#endif

#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/api/chrome_extensions_api_client.h"
#endif

namespace extensions {

ChromeExtensionsBrowserClient::ChromeExtensionsBrowserClient()
: api_client_(new ChromeExtensionsAPIClient) {
ChromeExtensionsBrowserClient::ChromeExtensionsBrowserClient() {
#if defined(ENABLE_EXTENSIONS)
api_client_.reset(new ChromeExtensionsAPIClient);
#endif
// Only set if it hasn't already been set (e.g. by a test).
if (GetCurrentChannel() == GetDefaultChannel())
SetCurrentChannel(chrome::VersionInfo::GetChannel());
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/extensions/chrome_extensions_browser_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ class ChromeExtensionsBrowserClient : public ExtensionsBrowserClient {
// Observer for Chrome-specific notifications.
ChromeNotificationObserver notification_observer_;

#if defined(ENABLE_EXTENSIONS)
// Client for API implementations.
scoped_ptr<ChromeExtensionsAPIClient> api_client_;
#endif

DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsBrowserClient);
};
Expand Down
7 changes: 6 additions & 1 deletion chrome/browser/extensions/data_deleter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/storage_partition.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "net/url_request/url_request_context_getter.h"

#if defined(ENABLE_EXTENSIONS)
#include "extensions/browser/api/storage/storage_frontend.h"
#endif

using base::WeakPtr;
using content::BrowserContext;
using content::BrowserThread;
Expand Down Expand Up @@ -103,11 +106,13 @@ void DataDeleter::StartDeleting(Profile* profile, const Extension* extension) {
DeleteOrigin(profile, partition, extension->url());
}

#if defined(ENABLE_EXTENSIONS)
// Begin removal of the settings for the current extension.
// StorageFrontend may not exist in unit tests.
StorageFrontend* frontend = StorageFrontend::Get(profile);
if (frontend)
frontend->DeleteStorageSoon(extension->id());
#endif // defined(ENABLE_EXTENSIONS)
}

} // namespace extensions
14 changes: 9 additions & 5 deletions chrome/browser/sync/profile_sync_components_factory_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
#include "chrome/browser/bookmarks/enhanced_bookmarks_features.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
#include "chrome/browser/extensions/api/storage/settings_sync_util.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_sync_service.h"
#include "chrome/browser/history/history_service.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/password_manager/password_store_factory.h"
Expand Down Expand Up @@ -70,6 +67,11 @@
#include "extensions/browser/extension_system.h"
#include "sync/api/syncable_service.h"

#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/api/storage/settings_sync_util.h"
#include "chrome/browser/extensions/extension_sync_service.h"
#endif

#if defined(ENABLE_MANAGED_USERS)
#include "chrome/browser/managed_mode/managed_user_settings_service.h"
#include "chrome/browser/managed_mode/managed_user_settings_service_factory.h"
Expand Down Expand Up @@ -463,15 +465,17 @@ base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl::
web_data_service_.get())->AsWeakPtr();
}
}
case syncer::SEARCH_ENGINES:
return TemplateURLServiceFactory::GetForProfile(profile_)->AsWeakPtr();
#if defined(ENABLE_EXTENSIONS)
case syncer::APPS:
case syncer::EXTENSIONS:
return ExtensionSyncService::Get(profile_)->AsWeakPtr();
case syncer::SEARCH_ENGINES:
return TemplateURLServiceFactory::GetForProfile(profile_)->AsWeakPtr();
case syncer::APP_SETTINGS:
case syncer::EXTENSION_SETTINGS:
return extensions::settings_sync_util::GetSyncableService(profile_, type)
->AsWeakPtr();
#endif
#if defined(ENABLE_APP_LIST)
case syncer::APP_LIST:
return app_list::AppListSyncableServiceFactory::GetForProfile(profile_)->
Expand Down
3 changes: 0 additions & 3 deletions chrome/chrome_browser_extensions.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -939,8 +939,6 @@
['exclude', '^browser/extensions/.*_api\.cc$'],
['include', '^browser/extensions/api/activity_log_private/activity_log_private_api.cc'],
['include', '^browser/extensions/api/activity_log_private/activity_log_private_api.h'],
['include', '^browser/extensions/api/chrome_extensions_api_client.cc'],
['include', '^browser/extensions/api/chrome_extensions_api_client.h'],
['include', '^browser/extensions/api/content_settings/content_settings_api_constants.cc'],
['include', '^browser/extensions/api/content_settings/content_settings_helpers.cc'],
['include', '^browser/extensions/api/content_settings/content_settings_store.cc'],
Expand All @@ -967,7 +965,6 @@
['include', '^browser/extensions/api/proxy/proxy_api.cc'],
['include', '^browser/extensions/api/proxy/proxy_api_constants.cc'],
['include', '^browser/extensions/api/runtime/runtime_api.cc'],
['include', '^browser/extensions/api/storage/.*\.cc'],
['include', '^browser/extensions/api/tabs/tabs_constants.cc'],
['include', '^browser/extensions/api/web_navigation/frame_navigation_state.cc'],
['include', '^browser/extensions/api/web_navigation/web_navigation_api.cc'],
Expand Down
14 changes: 14 additions & 0 deletions extensions/extensions.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@
'sources': [
'browser/admin_policy.cc',
'browser/admin_policy.h',
# NOTE: When moving an API out of Chrome be sure to verify that the
# Android build still compiles. See conditions below.
'browser/api/api_resource.cc',
'browser/api/api_resource.h',
'browser/api/api_resource_manager.h',
Expand Down Expand Up @@ -304,6 +306,18 @@
'browser/view_type_utils.cc',
'browser/view_type_utils.h',
],
'conditions': [
['enable_extensions==0', {
# Exclude all API implementations and the ExtensionsApiClient
# interface. Moving an API from src/chrome to src/extensions implies
# it can be cleanly disabled with enable_extensions==0.
# TODO: Eventually the entire extensions module should not be built
# when enable_extensions==0.
'sources/': [
['exclude', '^browser/api/'],
],
}],
],
# Disable c4267 warnings until we fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
},
Expand Down

0 comments on commit be514c3

Please sign in to comment.