Commit 65582b36 authored by dyen@chromium.org's avatar dyen@chromium.org

Added extension macro checks for android plugin files.

Some extension files are compiled on android when enable_plugins is set
to 1. These files need to have the parts that references extension
files compiled out of the code.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3032
TEST= trybots

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

Cr-Commit-Position: refs/heads/master@{#291219}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291219 0039d316-1c4b-4281-b951-d872f2087c98
parent ab4631c9
...@@ -2317,7 +2317,7 @@ bool ChromeContentBrowserClient::AllowPepperSocketAPI( ...@@ -2317,7 +2317,7 @@ bool ChromeContentBrowserClient::AllowPepperSocketAPI(
const GURL& url, const GURL& url,
bool private_api, bool private_api,
const content::SocketPermissionRequest* params) { const content::SocketPermissionRequest* params) {
#if defined(ENABLE_PLUGINS) #if defined(ENABLE_EXTENSIONS)
Profile* profile = Profile::FromBrowserContext(browser_context); Profile* profile = Profile::FromBrowserContext(browser_context);
const extensions::ExtensionSet* extension_set = NULL; const extensions::ExtensionSet* extension_set = NULL;
if (profile) { if (profile) {
...@@ -2533,7 +2533,7 @@ ChromeContentBrowserClient::GetDevToolsManagerDelegate() { ...@@ -2533,7 +2533,7 @@ ChromeContentBrowserClient::GetDevToolsManagerDelegate() {
bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle( bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
const GURL& url) { const GURL& url) {
#if defined(ENABLE_PLUGINS) #if defined(ENABLE_EXTENSIONS)
Profile* profile = Profile::FromBrowserContext(browser_context); Profile* profile = Profile::FromBrowserContext(browser_context);
const extensions::ExtensionSet* extension_set = NULL; const extensions::ExtensionSet* extension_set = NULL;
if (profile) { if (profile) {
...@@ -2555,7 +2555,7 @@ bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle( ...@@ -2555,7 +2555,7 @@ bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
bool ChromeContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs( bool ChromeContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
const GURL& url) { const GURL& url) {
#if defined(ENABLE_PLUGINS) #if defined(ENABLE_EXTENSIONS)
// Allow access for tests. // Allow access for tests.
if (CommandLine::ForCurrentProcess()->HasSwitch( if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnablePepperTesting)) { switches::kEnablePepperTesting)) {
......
...@@ -62,10 +62,12 @@ void OnKeepaliveOnUIThread( ...@@ -62,10 +62,12 @@ void OnKeepaliveOnUIThread(
if (instance_data.size() < 1) if (instance_data.size() < 1)
return; return;
#if defined(ENABLE_EXTENSIONS)
extensions::ProcessManager::OnKeepaliveFromPlugin( extensions::ProcessManager::OnKeepaliveFromPlugin(
instance_data[0].render_process_id, instance_data[0].render_process_id,
instance_data[0].render_frame_id, instance_data[0].render_frame_id,
instance_data[0].document_url.host()); instance_data[0].document_url.host());
#endif
} }
// Calls OnKeepaliveOnUIThread on UI thread. // Calls OnKeepaliveOnUIThread on UI thread.
...@@ -190,10 +192,14 @@ bool NaClBrowserDelegateImpl::MapUrlToLocalFilePath( ...@@ -190,10 +192,14 @@ bool NaClBrowserDelegateImpl::MapUrlToLocalFilePath(
bool use_blocking_api, bool use_blocking_api,
const base::FilePath& profile_directory, const base::FilePath& profile_directory,
base::FilePath* file_path) { base::FilePath* file_path) {
#if defined(ENABLE_EXTENSIONS)
scoped_refptr<extensions::InfoMap> extension_info_map = scoped_refptr<extensions::InfoMap> extension_info_map =
GetExtensionInfoMap(profile_directory); GetExtensionInfoMap(profile_directory);
return extension_info_map->MapUrlToLocalFilePath( return extension_info_map->MapUrlToLocalFilePath(
file_url, use_blocking_api, file_path); file_url, use_blocking_api, file_path);
#else
return false;
#endif
} }
content::BrowserPpapiHost::OnKeepaliveCallback content::BrowserPpapiHost::OnKeepaliveCallback
...@@ -204,12 +210,17 @@ NaClBrowserDelegateImpl::GetOnKeepaliveCallback() { ...@@ -204,12 +210,17 @@ NaClBrowserDelegateImpl::GetOnKeepaliveCallback() {
bool NaClBrowserDelegateImpl::IsNonSfiModeAllowed( bool NaClBrowserDelegateImpl::IsNonSfiModeAllowed(
const base::FilePath& profile_directory, const base::FilePath& profile_directory,
const GURL& manifest_url) { const GURL& manifest_url) {
#if defined(ENABLE_EXTENSIONS)
const extensions::ExtensionSet* extension_set = const extensions::ExtensionSet* extension_set =
&GetExtensionInfoMap(profile_directory)->extensions(); &GetExtensionInfoMap(profile_directory)->extensions();
return chrome::IsExtensionOrSharedModuleWhitelisted( return chrome::IsExtensionOrSharedModuleWhitelisted(
manifest_url, extension_set, allowed_nonsfi_origins_); manifest_url, extension_set, allowed_nonsfi_origins_);
#else
return false;
#endif
} }
#if defined(ENABLE_EXTENSIONS)
scoped_refptr<extensions::InfoMap> NaClBrowserDelegateImpl::GetExtensionInfoMap( scoped_refptr<extensions::InfoMap> NaClBrowserDelegateImpl::GetExtensionInfoMap(
const base::FilePath& profile_directory) { const base::FilePath& profile_directory) {
// Get the profile associated with the renderer. // Get the profile associated with the renderer.
...@@ -220,3 +231,4 @@ scoped_refptr<extensions::InfoMap> NaClBrowserDelegateImpl::GetExtensionInfoMap( ...@@ -220,3 +231,4 @@ scoped_refptr<extensions::InfoMap> NaClBrowserDelegateImpl::GetExtensionInfoMap(
DCHECK(extension_info_map); DCHECK(extension_info_map);
return extension_info_map; return extension_info_map;
} }
#endif
...@@ -45,8 +45,11 @@ class NaClBrowserDelegateImpl : public NaClBrowserDelegate { ...@@ -45,8 +45,11 @@ class NaClBrowserDelegateImpl : public NaClBrowserDelegate {
const GURL& manifest_url) OVERRIDE; const GURL& manifest_url) OVERRIDE;
private: private:
#if defined(ENABLE_EXTENSIONS)
scoped_refptr<extensions::InfoMap> GetExtensionInfoMap( scoped_refptr<extensions::InfoMap> GetExtensionInfoMap(
const base::FilePath& profile_directory); const base::FilePath& profile_directory);
#endif
ProfileManager* profile_manager_; ProfileManager* profile_manager_;
std::vector<URLPattern> debug_patterns_; std::vector<URLPattern> debug_patterns_;
bool inverse_debug_patterns_; bool inverse_debug_patterns_;
......
...@@ -98,6 +98,7 @@ Profile* PepperIsolatedFileSystemMessageFilter::GetProfile() { ...@@ -98,6 +98,7 @@ Profile* PepperIsolatedFileSystemMessageFilter::GetProfile() {
std::string PepperIsolatedFileSystemMessageFilter::CreateCrxFileSystem( std::string PepperIsolatedFileSystemMessageFilter::CreateCrxFileSystem(
Profile* profile) { Profile* profile) {
#if defined(ENABLE_EXTENSIONS)
extensions::ExtensionSystem* extension_system = extensions::ExtensionSystem* extension_system =
extensions::ExtensionSystem::Get(profile); extensions::ExtensionSystem::Get(profile);
if (!extension_system) if (!extension_system)
...@@ -120,6 +121,9 @@ std::string PepperIsolatedFileSystemMessageFilter::CreateCrxFileSystem( ...@@ -120,6 +121,9 @@ std::string PepperIsolatedFileSystemMessageFilter::CreateCrxFileSystem(
std::string(), std::string(),
extension->path(), extension->path(),
&kFirstLevelDirectory); &kFirstLevelDirectory);
#else
return std::string();
#endif
} }
int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem( int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem(
...@@ -141,6 +145,7 @@ int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem( ...@@ -141,6 +145,7 @@ int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem(
int32_t PepperIsolatedFileSystemMessageFilter::OpenCrxFileSystem( int32_t PepperIsolatedFileSystemMessageFilter::OpenCrxFileSystem(
ppapi::host::HostMessageContext* context) { ppapi::host::HostMessageContext* context) {
#if defined(ENABLE_EXTENSIONS)
Profile* profile = GetProfile(); Profile* profile = GetProfile();
const extensions::ExtensionSet* extension_set = NULL; const extensions::ExtensionSet* extension_set = NULL;
if (profile) { if (profile) {
...@@ -173,6 +178,9 @@ int32_t PepperIsolatedFileSystemMessageFilter::OpenCrxFileSystem( ...@@ -173,6 +178,9 @@ int32_t PepperIsolatedFileSystemMessageFilter::OpenCrxFileSystem(
context->reply_msg = PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(fsid); context->reply_msg = PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(fsid);
return PP_OK; return PP_OK;
#else
return PP_ERROR_NOTSUPPORTED;
#endif
} }
int32_t PepperIsolatedFileSystemMessageFilter::OpenPluginPrivateFileSystem( int32_t PepperIsolatedFileSystemMessageFilter::OpenPluginPrivateFileSystem(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment