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(
const GURL& url,
bool private_api,
const content::SocketPermissionRequest* params) {
#if defined(ENABLE_PLUGINS)
#if defined(ENABLE_EXTENSIONS)
Profile* profile = Profile::FromBrowserContext(browser_context);
const extensions::ExtensionSet* extension_set = NULL;
if (profile) {
......@@ -2533,7 +2533,7 @@ ChromeContentBrowserClient::GetDevToolsManagerDelegate() {
bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
content::BrowserContext* browser_context,
const GURL& url) {
#if defined(ENABLE_PLUGINS)
#if defined(ENABLE_EXTENSIONS)
Profile* profile = Profile::FromBrowserContext(browser_context);
const extensions::ExtensionSet* extension_set = NULL;
if (profile) {
......@@ -2555,7 +2555,7 @@ bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
bool ChromeContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs(
content::BrowserContext* browser_context,
const GURL& url) {
#if defined(ENABLE_PLUGINS)
#if defined(ENABLE_EXTENSIONS)
// Allow access for tests.
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnablePepperTesting)) {
......
......@@ -62,10 +62,12 @@ void OnKeepaliveOnUIThread(
if (instance_data.size() < 1)
return;
#if defined(ENABLE_EXTENSIONS)
extensions::ProcessManager::OnKeepaliveFromPlugin(
instance_data[0].render_process_id,
instance_data[0].render_frame_id,
instance_data[0].document_url.host());
#endif
}
// Calls OnKeepaliveOnUIThread on UI thread.
......@@ -190,10 +192,14 @@ bool NaClBrowserDelegateImpl::MapUrlToLocalFilePath(
bool use_blocking_api,
const base::FilePath& profile_directory,
base::FilePath* file_path) {
#if defined(ENABLE_EXTENSIONS)
scoped_refptr<extensions::InfoMap> extension_info_map =
GetExtensionInfoMap(profile_directory);
return extension_info_map->MapUrlToLocalFilePath(
file_url, use_blocking_api, file_path);
#else
return false;
#endif
}
content::BrowserPpapiHost::OnKeepaliveCallback
......@@ -204,12 +210,17 @@ NaClBrowserDelegateImpl::GetOnKeepaliveCallback() {
bool NaClBrowserDelegateImpl::IsNonSfiModeAllowed(
const base::FilePath& profile_directory,
const GURL& manifest_url) {
#if defined(ENABLE_EXTENSIONS)
const extensions::ExtensionSet* extension_set =
&GetExtensionInfoMap(profile_directory)->extensions();
return chrome::IsExtensionOrSharedModuleWhitelisted(
manifest_url, extension_set, allowed_nonsfi_origins_);
#else
return false;
#endif
}
#if defined(ENABLE_EXTENSIONS)
scoped_refptr<extensions::InfoMap> NaClBrowserDelegateImpl::GetExtensionInfoMap(
const base::FilePath& profile_directory) {
// Get the profile associated with the renderer.
......@@ -220,3 +231,4 @@ scoped_refptr<extensions::InfoMap> NaClBrowserDelegateImpl::GetExtensionInfoMap(
DCHECK(extension_info_map);
return extension_info_map;
}
#endif
......@@ -45,8 +45,11 @@ class NaClBrowserDelegateImpl : public NaClBrowserDelegate {
const GURL& manifest_url) OVERRIDE;
private:
#if defined(ENABLE_EXTENSIONS)
scoped_refptr<extensions::InfoMap> GetExtensionInfoMap(
const base::FilePath& profile_directory);
#endif
ProfileManager* profile_manager_;
std::vector<URLPattern> debug_patterns_;
bool inverse_debug_patterns_;
......
......@@ -98,6 +98,7 @@ Profile* PepperIsolatedFileSystemMessageFilter::GetProfile() {
std::string PepperIsolatedFileSystemMessageFilter::CreateCrxFileSystem(
Profile* profile) {
#if defined(ENABLE_EXTENSIONS)
extensions::ExtensionSystem* extension_system =
extensions::ExtensionSystem::Get(profile);
if (!extension_system)
......@@ -120,6 +121,9 @@ std::string PepperIsolatedFileSystemMessageFilter::CreateCrxFileSystem(
std::string(),
extension->path(),
&kFirstLevelDirectory);
#else
return std::string();
#endif
}
int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem(
......@@ -141,6 +145,7 @@ int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem(
int32_t PepperIsolatedFileSystemMessageFilter::OpenCrxFileSystem(
ppapi::host::HostMessageContext* context) {
#if defined(ENABLE_EXTENSIONS)
Profile* profile = GetProfile();
const extensions::ExtensionSet* extension_set = NULL;
if (profile) {
......@@ -173,6 +178,9 @@ int32_t PepperIsolatedFileSystemMessageFilter::OpenCrxFileSystem(
context->reply_msg = PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(fsid);
return PP_OK;
#else
return PP_ERROR_NOTSUPPORTED;
#endif
}
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