Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Unified Diff: content/browser/plugin_data_remover_impl.cc

Issue 11414180: Add a gyp flag to allow removing dependency on ppapi. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Jay's comments and rebase Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/plugin_data_remover_impl.cc
diff --git a/content/browser/plugin_data_remover_impl.cc b/content/browser/plugin_data_remover_impl.cc
index 08b9aff12db2b2618f9146f8e7eb036176923743..bb36af9a73bf7c239a1766b1a32ba31bb14ee3c3 100644
--- a/content/browser/plugin_data_remover_impl.cc
+++ b/content/browser/plugin_data_remover_impl.cc
@@ -20,7 +20,9 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/pepper_plugin_info.h"
+#if defined(ENABLE_PPAPI)
brettw 2012/11/30 23:18:12 Put ifdefed includes below the others.
nilesh 2012/12/01 00:41:35 Done.
#include "ppapi/proxy/ppapi_messages.h"
+#endif
#include "webkit/plugins/npapi/plugin_utils.h"
#include "webkit/plugins/plugin_constants.h"
@@ -178,8 +180,10 @@ class PluginDataRemoverImpl::Context
IPC_BEGIN_MESSAGE_MAP(Context, message)
IPC_MESSAGE_HANDLER(PluginHostMsg_ClearSiteDataResult,
OnClearSiteDataResult)
+#if defined(ENABLE_PPAPI)
IPC_MESSAGE_HANDLER(PpapiHostMsg_ClearSiteDataResult,
OnPpapiClearSiteDataResult)
+#endif
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
@@ -200,6 +204,29 @@ class PluginDataRemoverImpl::Context
friend class base::DeleteHelper<Context>;
virtual ~Context() {}
+ IPC::Message* CreatePpapiClearSiteDataMsg(uint64 max_age) {
brettw 2012/11/30 23:18:12 I'd find this much easier to follow if there were
nilesh 2012/12/01 00:41:35 Done.
+#if defined(ENABLE_PPAPI)
+ FilePath profile_path =
+ PepperFileMessageFilter::GetDataDirName(browser_context_path_);
+ // TODO(vtl): This "duplicates" logic in webkit/plugins/ppapi/file_path.cc
+ // (which prepends the plugin name to the relative part of the path
+ // instead, with the absolute, profile-dependent part being enforced by
+ // the browser).
+#if defined(OS_WIN)
+ FilePath plugin_data_path =
+ profile_path.Append(FilePath(UTF8ToUTF16(plugin_name_)));
+#else
+ FilePath plugin_data_path = profile_path.Append(FilePath(plugin_name_));
+#endif // defined(OS_WIN)
+ return new PpapiMsg_ClearSiteData(0u, plugin_data_path, std::string(),
+ kClearAllData, max_age);
+#else
+ NOTREACHED() << "CreatePpapiClearSiteDataMsg called with "
+ << "ENABLE_PPAPI undefined.";
+ return NULL;
+#endif // defined(ENABLE_PPAPI)
+ }
+
// Connects the client side of a newly opened plug-in channel.
void ConnectToChannel(const IPC::ChannelHandle& handle, bool is_ppapi) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -222,20 +249,7 @@ class PluginDataRemoverImpl::Context
IPC::Message* msg;
if (is_ppapi) {
- FilePath profile_path =
- PepperFileMessageFilter::GetDataDirName(browser_context_path_);
- // TODO(vtl): This "duplicates" logic in webkit/plugins/ppapi/file_path.cc
- // (which prepends the plugin name to the relative part of the path
- // instead, with the absolute, profile-dependent part being enforced by
- // the browser).
-#if defined(OS_WIN)
- FilePath plugin_data_path =
- profile_path.Append(FilePath(UTF8ToUTF16(plugin_name_)));
-#else
- FilePath plugin_data_path = profile_path.Append(FilePath(plugin_name_));
-#endif
- msg = new PpapiMsg_ClearSiteData(0u, plugin_data_path, std::string(),
- kClearAllData, max_age);
+ msg = CreatePpapiClearSiteDataMsg(max_age);
} else {
msg = new PluginMsg_ClearSiteData(std::string(), kClearAllData, max_age);
}

Powered by Google App Engine
This is Rietveld 408576698