summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-31 20:13:42 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-31 20:13:42 +0000
commit0609b17f21f4f0ab4a60d2dfb13d4db2811a0c20 (patch)
tree59864d71d818f59eab3fdaf2f299665bc5761acf
parent2b7c6fa283836117c79dbea3b8c57193ca271102 (diff)
downloadchromium_src-0609b17f21f4f0ab4a60d2dfb13d4db2811a0c20.zip
chromium_src-0609b17f21f4f0ab4a60d2dfb13d4db2811a0c20.tar.gz
chromium_src-0609b17f21f4f0ab4a60d2dfb13d4db2811a0c20.tar.bz2
Remove platform_util dependency from content.
BUG=76697 Review URL: http://codereview.chromium.org/7095003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87352 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chrome_content_browser_client.cc13
-rw-r--r--chrome/browser/chrome_content_browser_client.h1
-rw-r--r--content/browser/DEPS2
-rw-r--r--content/browser/content_browser_client.cc3
-rw-r--r--content/browser/content_browser_client.h4
-rw-r--r--content/browser/renderer_host/browser_render_process_host.cc7
-rw-r--r--content/browser/renderer_host/browser_render_process_host.h1
-rw-r--r--content/browser/renderer_host/render_message_filter.cc24
-rw-r--r--content/browser/renderer_host/render_message_filter.h2
9 files changed, 29 insertions, 28 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index d6dcc57..1a2f44d 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/extensions/extension_message_handler.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/google/google_util.h"
+#include "chrome/browser/platform_util.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/printing/printing_message_filter.h"
#include "chrome/browser/profiles/profile.h"
@@ -310,6 +311,18 @@ ChromeContentBrowserClient::CreateQuotaPermissionContext() {
return new ChromeQuotaPermissionContext();
}
+void ChromeContentBrowserClient::RevealFolderInOS(const FilePath& path) {
+ // On Mac, this call needs to be done on the UI thread. On other platforms,
+ // do it on the FILE thread so we don't slow down UI.
+#if defined(OS_MACOSX)
+ platform_util::OpenItem(path);
+#else
+ BrowserThread::PostTask(
+ BrowserThread::FILE, FROM_HERE,
+ NewRunnableFunction(&platform_util::OpenItem, path));
+#endif
+}
+
#if defined(OS_LINUX)
int ChromeContentBrowserClient::GetCrashSignalFD(
const std::string& process_type) {
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index e8b978f..9e54f1b 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -45,6 +45,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
int render_view_id,
net::CookieOptions* options) OVERRIDE;
virtual QuotaPermissionContext* CreateQuotaPermissionContext() OVERRIDE;
+ virtual void RevealFolderInOS(const FilePath& path) OVERRIDE;
#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Can return an optional fd for crash handling, otherwise returns -1.
virtual int GetCrashSignalFD(const std::string& process_type) OVERRIDE;
diff --git a/content/browser/DEPS b/content/browser/DEPS
index 623d1c8..038a5bb 100644
--- a/content/browser/DEPS
+++ b/content/browser/DEPS
@@ -45,8 +45,6 @@ include_rules = [
"+chrome/browser/notifications/desktop_notification_service_factory.h",
"+chrome/browser/notifications/notifications_prefs_cache.h",
- "+chrome/browser/platform_util.h",
-
# http://crbug.com/76788
"+chrome/browser/profiles/profile.h",
diff --git a/content/browser/content_browser_client.cc b/content/browser/content_browser_client.cc
index 34f77da..121991e 100644
--- a/content/browser/content_browser_client.cc
+++ b/content/browser/content_browser_client.cc
@@ -84,6 +84,9 @@ QuotaPermissionContext* ContentBrowserClient::CreateQuotaPermissionContext() {
return NULL;
}
+void ContentBrowserClient::RevealFolderInOS(const FilePath& path) {
+}
+
#if defined(OS_LINUX)
int ContentBrowserClient::GetCrashSignalFD(const std::string& process_type) {
return -1;
diff --git a/content/browser/content_browser_client.h b/content/browser/content_browser_client.h
index d8a94f6..47f26105 100644
--- a/content/browser/content_browser_client.h
+++ b/content/browser/content_browser_client.h
@@ -12,6 +12,7 @@
class BrowserRenderProcessHost;
class CommandLine;
+class FilePath;
class GURL;
class PluginProcessHost;
class Profile;
@@ -105,6 +106,9 @@ class ContentBrowserClient {
// Create and return a new quota permission context.
virtual QuotaPermissionContext* CreateQuotaPermissionContext();
+ // Shows the given path using the OS file manager.
+ virtual void RevealFolderInOS(const FilePath& path);
+
#if defined(OS_LINUX)
// Can return an optional fd for crash handling, otherwise returns -1.
virtual int GetCrashSignalFD(const std::string& process_type);
diff --git a/content/browser/renderer_host/browser_render_process_host.cc b/content/browser/renderer_host/browser_render_process_host.cc
index bb909a7..41600e1 100644
--- a/content/browser/renderer_host/browser_render_process_host.cc
+++ b/content/browser/renderer_host/browser_render_process_host.cc
@@ -800,6 +800,7 @@ bool BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) {
SuddenTerminationChanged)
IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction,
OnUserMetricsRecordAction)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS)
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP_EX()
@@ -966,3 +967,9 @@ void BrowserRenderProcessHost::OnUserMetricsRecordAction(
const std::string& action) {
UserMetrics::RecordComputedAction(action);
}
+
+void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) {
+ // Only honor the request if appropriate persmissions are granted.
+ if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path))
+ content::GetContentClient()->browser()->RevealFolderInOS(path);
+}
diff --git a/content/browser/renderer_host/browser_render_process_host.h b/content/browser/renderer_host/browser_render_process_host.h
index 4cf6a4c..2584ef8 100644
--- a/content/browser/renderer_host/browser_render_process_host.h
+++ b/content/browser/renderer_host/browser_render_process_host.h
@@ -83,6 +83,7 @@ class BrowserRenderProcessHost : public RenderProcessHost,
void OnShutdownRequest();
void SuddenTerminationChanged(bool enabled);
void OnUserMetricsRecordAction(const std::string& action);
+ void OnRevealFolderInOS(const FilePath& path);
// Generates a command line to be used to spawn a renderer and appends the
// results to |*command_line|.
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index 960d191..9b0d75e 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/notifications/desktop_notification_service_factory.h"
#include "chrome/browser/notifications/notifications_prefs_cache.h"
-#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
@@ -368,7 +367,6 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message,
render_widget_helper_->DidReceiveUpdateMsg(message))
IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_CheckPermission,
OnCheckNotificationPermission)
- IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS)
IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateSharedMemoryBuffer,
OnAllocateSharedMemoryBuffer)
#if defined(OS_MACOSX)
@@ -392,28 +390,6 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message,
return handled;
}
-void RenderMessageFilter::OnRevealFolderInOS(const FilePath& path) {
-#if defined(OS_MACOSX)
- const BrowserThread::ID kThreadID = BrowserThread::UI;
-#else
- const BrowserThread::ID kThreadID = BrowserThread::FILE;
-#endif
- if (!BrowserThread::CurrentlyOn(kThreadID)) {
- // Only honor the request if appropriate persmissions are granted.
- if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(
- render_process_id_, path)) {
- BrowserThread::PostTask(
- kThreadID, FROM_HERE,
- NewRunnableMethod(
- this, &RenderMessageFilter::OnRevealFolderInOS, path));
- }
- return;
- }
-
- DCHECK(BrowserThread::CurrentlyOn(kThreadID));
- platform_util::OpenItem(path);
-}
-
void RenderMessageFilter::OnDestruct() const {
BrowserThread::DeleteOnIOThread::Destruct(this);
}
diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h
index 433f711..f9d183d 100644
--- a/content/browser/renderer_host/render_message_filter.h
+++ b/content/browser/renderer_host/render_message_filter.h
@@ -173,8 +173,6 @@ class RenderMessageFilter : public BrowserMessageFilter {
void OnCheckNotificationPermission(const GURL& source_url,
int* permission_level);
- void OnRevealFolderInOS(const FilePath& path);
-
// Used to ask the browser to allocate a block of shared memory for the
// renderer to send back data in, since shared memory can't be created
// in the renderer on POSIX due to the sandbox.