summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authoravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-06 16:48:45 +0000
committeravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-06 16:48:45 +0000
commit690a99c80e4fe4e6eda9010b88e4438f57912336 (patch)
tree423390d4af89abd910ffd69f5e446720b1aa5b1f /chrome/browser
parent8c643f00166c14b146f8e5e0d2beedddacb58aab (diff)
downloadchromium_src-690a99c80e4fe4e6eda9010b88e4438f57912336.zip
chromium_src-690a99c80e4fe4e6eda9010b88e4438f57912336.tar.gz
chromium_src-690a99c80e4fe4e6eda9010b88e4438f57912336.tar.bz2
Move plugins to FilePaths, some cleanup
Review URL: http://codereview.chromium.org/16456 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7588 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser_about_handler.cc2
-rw-r--r--chrome/browser/memory_details.cc2
-rw-r--r--chrome/browser/memory_details.h3
-rw-r--r--chrome/browser/metrics_log.cc2
-rw-r--r--chrome/browser/metrics_service.cc16
-rw-r--r--chrome/browser/metrics_service.h3
-rw-r--r--chrome/browser/plugin_process_host.cc41
-rw-r--r--chrome/browser/plugin_process_host.h10
-rw-r--r--chrome/browser/plugin_process_info.h18
-rw-r--r--chrome/browser/plugin_service.cc20
-rw-r--r--chrome/browser/plugin_service.h16
-rw-r--r--chrome/browser/render_view_host_delegate.h2
-rw-r--r--chrome/browser/resource_message_filter.cc10
-rw-r--r--chrome/browser/resource_message_filter.h7
-rw-r--r--chrome/browser/sandbox_policy.cc6
-rw-r--r--chrome/browser/sandbox_policy.h6
-rw-r--r--chrome/browser/task_manager_resource_providers.cc4
-rw-r--r--chrome/browser/web_contents.cc6
-rw-r--r--chrome/browser/web_contents.h2
19 files changed, 92 insertions, 84 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index 6b0e025..0687e4f 100644
--- a/chrome/browser/browser_about_handler.cc
+++ b/chrome/browser/browser_about_handler.cc
@@ -566,7 +566,7 @@ void AboutMemoryHandler::AppendProcess(ListValue* renderers,
renderer->SetString(L"renderer_id", label);
FileVersionInfo* version_info =
FileVersionInfo::CreateFileVersionInfo(
- (*plugins())[index].dll_path);
+ (*plugins())[index].plugin_path);
if (version_info)
name = version_info->product_name();
ListValue* titles = new ListValue();
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc
index fe58ec0..0ad784d 100644
--- a/chrome/browser/memory_details.cc
+++ b/chrome/browser/memory_details.cc
@@ -81,7 +81,7 @@ void MemoryDetails::CollectPluginInformation() {
PluginProcessInformation info;
info.pid = base::GetProcId(plugin->process());
if (info.pid != 0) {
- info.dll_path = plugin->dll_path();
+ info.plugin_path = plugin->plugin_path();
plugins_.push_back(info);
}
}
diff --git a/chrome/browser/memory_details.h b/chrome/browser/memory_details.h
index 8f0f03b..0a542cc 100644
--- a/chrome/browser/memory_details.h
+++ b/chrome/browser/memory_details.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
+#include "base/file_path.h"
#include "base/process_util.h"
#include "base/ref_counted.h"
@@ -44,7 +45,7 @@ typedef std::vector<ProcessMemoryInformation> ProcessMemoryInformationList;
// Information that we need about a plugin process.
struct PluginProcessInformation {
int pid;
- std::wstring dll_path;
+ FilePath plugin_path;
};
typedef std::vector<PluginProcessInformation> PluginProcessInformationList;
diff --git a/chrome/browser/metrics_log.cc b/chrome/browser/metrics_log.cc
index 24e94e5..60851bf 100644
--- a/chrome/browser/metrics_log.cc
+++ b/chrome/browser/metrics_log.cc
@@ -445,7 +445,7 @@ void MetricsLog::WritePluginList(
// Plugin name and filename are hashed for the privacy of those
// testing unreleased new extensions.
WriteAttribute("name", CreateBase64Hash(WideToUTF8((*iter).name)));
- std::wstring filename = file_util::GetFilenameFromPath((*iter).file);
+ std::wstring filename = (*iter).file.BaseName().ToWStringHack();
WriteAttribute("filename", CreateBase64Hash(WideToUTF8(filename)));
WriteAttribute("version", WideToUTF8((*iter).version));
diff --git a/chrome/browser/metrics_service.cc b/chrome/browser/metrics_service.cc
index ec374de..acc9933 100644
--- a/chrome/browser/metrics_service.cc
+++ b/chrome/browser/metrics_service.cc
@@ -158,6 +158,7 @@
#include "chrome/browser/metrics_service.h"
+#include "base/file_path.h"
#include "base/histogram.h"
#include "base/path_service.h"
#include "base/string_util.h"
@@ -1507,7 +1508,7 @@ void MetricsService::LogRendererHang() {
void MetricsService::LogPluginChange(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- std::wstring plugin = Details<PluginProcessInfo>(details)->dll_path();
+ FilePath plugin = Details<PluginProcessInfo>(details)->plugin_path();
if (plugin_stats_buffer_.find(plugin) == plugin_stats_buffer_.end()) {
plugin_stats_buffer_[plugin] = PluginStats();
@@ -1591,13 +1592,14 @@ void MetricsService::RecordPluginChanges(PrefService* pref) {
}
DictionaryValue* plugin_dict = static_cast<DictionaryValue*>(*value_iter);
- std::wstring plugin_path;
- plugin_dict->GetString(prefs::kStabilityPluginPath, &plugin_path);
- if (plugin_path.empty()) {
+ FilePath::StringType plugin_path_str;
+ plugin_dict->GetString(prefs::kStabilityPluginPath, &plugin_path_str);
+ if (plugin_path_str.empty()) {
NOTREACHED();
continue;
}
+ FilePath plugin_path(plugin_path_str);
if (plugin_stats_buffer_.find(plugin_path) == plugin_stats_buffer_.end())
continue;
@@ -1626,14 +1628,14 @@ void MetricsService::RecordPluginChanges(PrefService* pref) {
// Now go through and add dictionaries for plugins that didn't already have
// reports in Local State.
- for (std::map<std::wstring, PluginStats>::iterator cache_iter =
+ for (std::map<FilePath, PluginStats>::iterator cache_iter =
plugin_stats_buffer_.begin();
cache_iter != plugin_stats_buffer_.end(); ++cache_iter) {
- std::wstring plugin_path = cache_iter->first;
+ FilePath plugin_path = cache_iter->first;
PluginStats stats = cache_iter->second;
DictionaryValue* plugin_dict = new DictionaryValue;
- plugin_dict->SetString(prefs::kStabilityPluginPath, plugin_path);
+ plugin_dict->SetString(prefs::kStabilityPluginPath, plugin_path.value());
plugin_dict->SetInteger(prefs::kStabilityPluginLaunches,
stats.process_launches);
plugin_dict->SetInteger(prefs::kStabilityPluginCrashes,
diff --git a/chrome/browser/metrics_service.h b/chrome/browser/metrics_service.h
index fe8ce9b..137b534 100644
--- a/chrome/browser/metrics_service.h
+++ b/chrome/browser/metrics_service.h
@@ -15,6 +15,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/file_path.h"
#include "base/histogram.h"
#include "base/scoped_ptr.h"
#include "base/values.h"
@@ -422,7 +423,7 @@ class MetricsService : public NotificationObserver,
// Buffer of plugin notifications for quick access. See PluginStats
// documentation above for more details.
- std::map<std::wstring, PluginStats> plugin_stats_buffer_;
+ std::map<FilePath, PluginStats> plugin_stats_buffer_;
ScopedRunnableMethodFactory<MetricsService> log_sender_factory_;
ScopedRunnableMethodFactory<MetricsService> state_saver_factory_;
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index 4dcb107..351d586 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -48,20 +48,20 @@ static const char kDefaultPluginFinderURL[] =
class PluginNotificationTask : public Task {
public:
PluginNotificationTask(NotificationType notification_type,
- std::wstring dll_path,
+ FilePath dll_path,
HANDLE process);
virtual void Run();
private:
NotificationType notification_type_;
- std::wstring dll_path_;
+ FilePath dll_path_;
HANDLE process_;
};
PluginNotificationTask::PluginNotificationTask(
NotificationType notification_type,
- std::wstring dll_path,
+ FilePath dll_path,
HANDLE process)
: notification_type_(notification_type),
process_(process),
@@ -361,12 +361,12 @@ PluginProcessHost::~PluginProcessHost() {
}
}
-bool PluginProcessHost::Init(const std::wstring& dll,
+bool PluginProcessHost::Init(const FilePath& dll,
const std::string& activex_clsid,
const std::wstring& locale) {
DCHECK(channel_.get() == NULL);
- dll_path_ = dll;
+ plugin_path_ = dll;
channel_id_ = GenerateRandomChannelID(this);
channel_.reset(new IPC::Channel(channel_id_,
IPC::Channel::MODE_SERVER,
@@ -439,7 +439,7 @@ bool PluginProcessHost::Init(const std::wstring& dll,
CommandLine::AppendSwitchWithValue(&cmd_line,
switches::kPluginPath,
- dll);
+ dll.ToWStringHack());
bool in_sandbox = !browser_command_line.HasSwitch(switches::kNoSandbox) &&
browser_command_line.HasSwitch(switches::kSafePlugins);
@@ -492,12 +492,11 @@ bool PluginProcessHost::Init(const std::wstring& dll,
watcher_.StartWatching(process_.handle(), this);
- std::wstring gears_path;
- std::wstring dll_lc = dll;
+ FilePath gears_path;
if (PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_path)) {
- StringToLowerASCII(&gears_path);
- StringToLowerASCII(&dll_lc);
- if (dll_lc == gears_path) {
+ FilePath::StringType gears_path_lc = StringToLowerASCII(gears_path.value());
+ FilePath::StringType dll_lc = StringToLowerASCII(dll.value());
+ if (dll_lc == gears_path_lc) {
// Give Gears plugins "background" priority. See
// http://b/issue?id=1280317.
process_.SetProcessBackgrounded(true);
@@ -528,12 +527,12 @@ void PluginProcessHost::OnObjectSignaled(HANDLE object) {
// Report that this plugin crashed.
plugin_service_->main_message_loop()->PostTask(FROM_HERE,
new PluginNotificationTask(NOTIFY_PLUGIN_PROCESS_CRASHED,
- dll_path(), object));
+ plugin_path(), object));
}
// Notify in the main loop of the disconnection.
plugin_service_->main_message_loop()->PostTask(FROM_HERE,
new PluginNotificationTask(NOTIFY_PLUGIN_PROCESS_HOST_DISCONNECTED,
- dll_path(), object));
+ plugin_path(), object));
// Cancel all requests for plugin processes.
// TODO(mpcomplete): use a real process ID when http://b/issue?id=1210062 is
@@ -601,7 +600,7 @@ void PluginProcessHost::OnChannelConnected(int32 peer_pid) {
// Notify in the main loop of the connection.
plugin_service_->main_message_loop()->PostTask(FROM_HERE,
new PluginNotificationTask(NOTIFY_PLUGIN_PROCESS_HOST_CONNECTED,
- dll_path(), process()));
+ plugin_path(), process()));
}
void PluginProcessHost::OnChannelError() {
@@ -609,7 +608,7 @@ void PluginProcessHost::OnChannelError() {
for (size_t i = 0; i < pending_requests_.size(); ++i) {
ReplyToRenderer(pending_requests_[i].renderer_message_filter_.get(),
std::wstring(),
- std::wstring(),
+ FilePath(),
pending_requests_[i].reply_msg);
}
@@ -623,7 +622,7 @@ void PluginProcessHost::OpenChannelToPlugin(
// Notify in the main loop of the instantiation.
plugin_service_->main_message_loop()->PostTask(FROM_HERE,
new PluginNotificationTask(NOTIFY_PLUGIN_INSTANCE_CREATED,
- dll_path(), process()));
+ plugin_path(), process()));
if (opening_channel_) {
pending_requests_.push_back(
@@ -633,7 +632,7 @@ void PluginProcessHost::OpenChannelToPlugin(
if (!channel_.get()) {
// There was an error opening the channel, tell the renderer.
- ReplyToRenderer(renderer_message_filter, std::wstring(), std::wstring(),
+ ReplyToRenderer(renderer_message_filter, std::wstring(), FilePath(),
reply_msg);
return;
}
@@ -732,7 +731,7 @@ void PluginProcessHost::OnResolveProxy(const GURL& url,
void PluginProcessHost::ReplyToRenderer(
ResourceMessageFilter* renderer_message_filter,
- const std::wstring& channel, const std::wstring& plugin_path,
+ const std::wstring& channel, const FilePath& plugin_path,
IPC::Message* reply_msg) {
ViewHostMsg_OpenChannelToPlugin::WriteReplyParams(reply_msg, channel,
plugin_path);
@@ -765,7 +764,7 @@ void PluginProcessHost::RequestPluginChannel(
sent_requests_.push_back(ChannelRequest(renderer_message_filter, mime_type,
reply_msg));
} else {
- ReplyToRenderer(renderer_message_filter, std::wstring(), std::wstring(),
+ ReplyToRenderer(renderer_message_filter, std::wstring(), FilePath(),
reply_msg);
}
}
@@ -777,7 +776,7 @@ void PluginProcessHost::OnChannelCreated(int process_id,
== process_id) {
ReplyToRenderer(sent_requests_[i].renderer_message_filter_.get(),
channel_name,
- dll_path(),
+ plugin_path(),
sent_requests_[i].reply_msg);
sent_requests_.erase(sent_requests_.begin() + i);
@@ -825,7 +824,7 @@ void PluginProcessHost::OnPluginMessage(
DCHECK(MessageLoop::current() ==
ChromeThread::GetMessageLoop(ChromeThread::IO));
- ChromePluginLib *chrome_plugin = ChromePluginLib::Find(dll_path_);
+ ChromePluginLib *chrome_plugin = ChromePluginLib::Find(plugin_path_);
if (chrome_plugin) {
void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0]));
uint32 data_len = static_cast<uint32>(data.size());
diff --git a/chrome/browser/plugin_process_host.h b/chrome/browser/plugin_process_host.h
index a61d8d0..fb9dfe8 100644
--- a/chrome/browser/plugin_process_host.h
+++ b/chrome/browser/plugin_process_host.h
@@ -43,7 +43,7 @@ class PluginProcessHost : public IPC::Channel::Listener,
// be called before the object can be used. If dll is the ActiveX-shim, then
// activex_clsid is the class id of ActiveX control, otherwise activex_clsid
// is ignored.
- bool Init(const std::wstring& dll,
+ bool Init(const FilePath& dll,
const std::string& activex_clsid,
const std::wstring& locale);
@@ -68,13 +68,13 @@ class PluginProcessHost : public IPC::Channel::Listener,
const std::string& mime_type,
IPC::Message* reply_msg);
- const std::wstring& dll_path() const { return dll_path_; }
+ const FilePath& plugin_path() const { return plugin_path_; }
// Sends the reply to an open channel request to the renderer with the given
// channel name.
static void ReplyToRenderer(ResourceMessageFilter* renderer_message_filter,
const std::wstring& channel,
- const std::wstring& plugin_path,
+ const FilePath& plugin_path,
IPC::Message* reply_msg);
// This function is called on the IO thread once we receive a reply from the
@@ -150,8 +150,8 @@ class PluginProcessHost : public IPC::Channel::Listener,
// IPC Channel's id.
std::wstring channel_id_;
- // Path to the DLL of that plugin.
- std::wstring dll_path_;
+ // Path to the file of that plugin.
+ FilePath plugin_path_;
PluginService* plugin_service_;
diff --git a/chrome/browser/plugin_process_info.h b/chrome/browser/plugin_process_info.h
index badc902..90fc4f0 100644
--- a/chrome/browser/plugin_process_info.h
+++ b/chrome/browser/plugin_process_info.h
@@ -14,15 +14,17 @@
#include <string>
#include "windows.h"
+#include "base/file_path.h"
+
class PluginProcessInfo {
public:
- PluginProcessInfo(std::wstring dll_path, HANDLE process)
- : dll_path_(dll_path),
+ PluginProcessInfo(FilePath plugin_path, HANDLE process)
+ : plugin_path_(plugin_path),
process_(process) {
}
PluginProcessInfo(const PluginProcessInfo& ppi) {
- dll_path_ = ppi.dll_path_;
+ plugin_path_ = ppi.plugin_path_;
process_ = ppi.process_;
}
@@ -31,7 +33,7 @@ class PluginProcessInfo {
PluginProcessInfo&
PluginProcessInfo::operator=(const PluginProcessInfo& ppi) {
if (this != &ppi) {
- dll_path_ = ppi.dll_path_;
+ plugin_path_ = ppi.plugin_path_;
process_ = ppi.process_;
}
return *this;
@@ -42,19 +44,19 @@ class PluginProcessInfo {
bool operator <(const PluginProcessInfo& rhs) const {
if (process_ != rhs.process_)
return process_ < rhs.process_;
- return dll_path_ < rhs.dll_path_;
+ return plugin_path_ < rhs.plugin_path_;
}
bool operator ==(const PluginProcessInfo& rhs) const {
- return (process_ == rhs.process_) && (dll_path_ == rhs.dll_path_);
+ return (process_ == rhs.process_) && (plugin_path_ == rhs.plugin_path_);
}
- std::wstring dll_path() const { return dll_path_; }
+ FilePath plugin_path() const { return plugin_path_; }
HANDLE process() const { return process_; }
private:
- std::wstring dll_path_;
+ FilePath plugin_path_;
HANDLE process_;
};
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc
index ac2a3aa..a58787c 100644
--- a/chrome/browser/plugin_service.cc
+++ b/chrome/browser/plugin_service.cc
@@ -59,11 +59,11 @@ const std::wstring& PluginService::GetUILocale() {
return ui_locale_;
}
-PluginProcessHost* PluginService::FindPluginProcess(const std::wstring& dll) {
+PluginProcessHost* PluginService::FindPluginProcess(const FilePath& dll) {
DCHECK(MessageLoop::current() ==
ChromeThread::GetMessageLoop(ChromeThread::IO));
- if (dll.empty()) {
+ if (dll.value().empty()) {
NOTREACHED() << "should only be called if we have a plugin dll to load";
return NULL;
}
@@ -75,7 +75,7 @@ PluginProcessHost* PluginService::FindPluginProcess(const std::wstring& dll) {
}
PluginProcessHost* PluginService::FindOrStartPluginProcess(
- const std::wstring& dll,
+ const FilePath& dll,
const std::string& clsid) {
DCHECK(MessageLoop::current() ==
ChromeThread::GetMessageLoop(ChromeThread::IO));
@@ -106,14 +106,14 @@ void PluginService::OpenChannelToPlugin(
const std::wstring& locale, IPC::Message* reply_msg) {
DCHECK(MessageLoop::current() ==
ChromeThread::GetMessageLoop(ChromeThread::IO));
- std::wstring dll = GetPluginPath(url, mime_type, clsid, NULL);
+ FilePath dll = GetPluginPath(url, mime_type, clsid, NULL);
PluginProcessHost* plugin_host = FindOrStartPluginProcess(dll, clsid);
if (plugin_host) {
plugin_host->OpenChannelToPlugin(renderer_msg_filter, mime_type, reply_msg);
} else {
PluginProcessHost::ReplyToRenderer(renderer_msg_filter,
std::wstring(),
- std::wstring(),
+ FilePath(),
reply_msg);
}
}
@@ -143,10 +143,10 @@ void PluginService::RemoveHost(PluginProcessHost* host) {
}
}
-std::wstring PluginService::GetPluginPath(const GURL& url,
- const std::string& mime_type,
- const std::string& clsid,
- std::string* actual_mime_type) {
+FilePath PluginService::GetPluginPath(const GURL& url,
+ const std::string& mime_type,
+ const std::string& clsid,
+ std::string* actual_mime_type) {
AutoLock lock(lock_);
bool allow_wildcard = true;
WebPluginInfo info;
@@ -156,7 +156,7 @@ std::wstring PluginService::GetPluginPath(const GURL& url,
return info.file;
}
-bool PluginService::GetPluginInfoByDllPath(const std::wstring& dll_path,
+bool PluginService::GetPluginInfoByDllPath(const FilePath& dll_path,
WebPluginInfo* info) {
AutoLock lock(lock_);
return NPAPI::PluginList::Singleton()->GetPluginInfoByDllPath(dll_path, info);
diff --git a/chrome/browser/plugin_service.h b/chrome/browser/plugin_service.h
index a28b502..e34552a 100644
--- a/chrome/browser/plugin_service.h
+++ b/chrome/browser/plugin_service.h
@@ -57,13 +57,13 @@ class PluginService {
// Returns the plugin process host corresponding to the plugin process that
// has been started by this service. Returns NULL if no process has been
// started.
- PluginProcessHost* FindPluginProcess(const std::wstring& dll);
+ PluginProcessHost* FindPluginProcess(const FilePath& dll);
// Returns the plugin process host corresponding to the plugin process that
// has been started by this service. This will start a process to host the
// 'dll' if needed. If the process fails to start, the return value is NULL.
// Must be called on the IO thread.
- PluginProcessHost* FindOrStartPluginProcess(const std::wstring& dll,
+ PluginProcessHost* FindOrStartPluginProcess(const FilePath& dll,
const std::string& clsid);
// Opens a channel to a plugin process for the given mime type, starting
@@ -85,13 +85,13 @@ class PluginService {
bool HavePluginFor(const std::string& mime_type, bool allow_wildcard);
- std::wstring GetPluginPath(const GURL& url,
- const std::string& mime_type,
- const std::string& clsid,
- std::string* actual_mime_type);
+ FilePath GetPluginPath(const GURL& url,
+ const std::string& mime_type,
+ const std::string& clsid,
+ std::string* actual_mime_type);
// Get plugin info by matching full dll path.
- bool GetPluginInfoByDllPath(const std::wstring& dll_path,
+ bool GetPluginInfoByDllPath(const FilePath& dll_path,
WebPluginInfo* info);
// Returns true if the plugin's mime-type supports a given mime-type.
@@ -121,7 +121,7 @@ class PluginService {
void OnShutdown();
// mapping between plugin dll path and PluginProcessHost
- typedef base::hash_map<std::wstring, PluginProcessHost*> PluginMap;
+ typedef base::hash_map<FilePath, PluginProcessHost*> PluginMap;
PluginMap plugin_hosts_;
// The main thread's message loop.
diff --git a/chrome/browser/render_view_host_delegate.h b/chrome/browser/render_view_host_delegate.h
index f0c4b0e..4cb7dcc 100644
--- a/chrome/browser/render_view_host_delegate.h
+++ b/chrome/browser/render_view_host_delegate.h
@@ -335,7 +335,7 @@ class RenderViewHostDelegate {
virtual void OnMissingPluginStatus(int status) { }
// Notification from the renderer that a plugin instance has crashed.
- virtual void OnCrashedPlugin(const std::wstring& plugin_path) { }
+ virtual void OnCrashedPlugin(const FilePath& plugin_path) { }
// Notification from the renderer that JS runs out of memory.
virtual void OnJSOutOfMemory() { }
diff --git a/chrome/browser/resource_message_filter.cc b/chrome/browser/resource_message_filter.cc
index e4e8409..76b7fe4 100644
--- a/chrome/browser/resource_message_filter.cc
+++ b/chrome/browser/resource_message_filter.cc
@@ -308,12 +308,12 @@ void ResourceMessageFilter::OnGetDataDir(std::wstring* data_dir) {
*data_dir = plugin_service_->GetChromePluginDataDir();
}
-void ResourceMessageFilter::OnPluginMessage(const std::wstring& dll_path,
+void ResourceMessageFilter::OnPluginMessage(const FilePath& plugin_path,
const std::vector<uint8>& data) {
DCHECK(MessageLoop::current() ==
ChromeThread::GetMessageLoop(ChromeThread::IO));
- ChromePluginLib *chrome_plugin = ChromePluginLib::Find(dll_path);
+ ChromePluginLib *chrome_plugin = ChromePluginLib::Find(plugin_path);
if (chrome_plugin) {
void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0]));
uint32 data_len = static_cast<uint32>(data.size());
@@ -321,13 +321,13 @@ void ResourceMessageFilter::OnPluginMessage(const std::wstring& dll_path,
}
}
-void ResourceMessageFilter::OnPluginSyncMessage(const std::wstring& dll_path,
+void ResourceMessageFilter::OnPluginSyncMessage(const FilePath& plugin_path,
const std::vector<uint8>& data,
std::vector<uint8> *retval) {
DCHECK(MessageLoop::current() ==
ChromeThread::GetMessageLoop(ChromeThread::IO));
- ChromePluginLib *chrome_plugin = ChromePluginLib::Find(dll_path);
+ ChromePluginLib *chrome_plugin = ChromePluginLib::Find(plugin_path);
if (chrome_plugin) {
void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0]));
uint32 data_len = static_cast<uint32>(data.size());
@@ -398,7 +398,7 @@ void ResourceMessageFilter::OnGetPlugins(bool refresh,
void ResourceMessageFilter::OnGetPluginPath(const GURL& url,
const std::string& mime_type,
const std::string& clsid,
- std::wstring* filename,
+ FilePath* filename,
std::string* url_mime_type) {
*filename = plugin_service_->GetPluginPath(url, mime_type, clsid,
url_mime_type);
diff --git a/chrome/browser/resource_message_filter.h b/chrome/browser/resource_message_filter.h
index 44f0fd2..e2d67ca 100644
--- a/chrome/browser/resource_message_filter.h
+++ b/chrome/browser/resource_message_filter.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_RENDERER_RESOURCE_MSG_FILTER_H__
#include "base/clipboard.h"
+#include "base/file_path.h"
#include "base/gfx/rect.h"
#include "base/gfx/native_widget_types.h"
#include "base/ref_counted.h"
@@ -92,9 +93,9 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
void OnGetCookies(const GURL& url, const GURL& policy_url,
std::string* cookies);
void OnGetDataDir(std::wstring* data_dir);
- void OnPluginMessage(const std::wstring& dll_path,
+ void OnPluginMessage(const FilePath& plugin_path,
const std::vector<uint8>& message);
- void OnPluginSyncMessage(const std::wstring& dll_path,
+ void OnPluginSyncMessage(const FilePath& plugin_path,
const std::vector<uint8>& message,
std::vector<uint8> *retval);
@@ -107,7 +108,7 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
void OnGetPluginPath(const GURL& url,
const std::string& mime_type,
const std::string& clsid,
- std::wstring* filename,
+ FilePath* filename,
std::string* actual_mime_type);
void OnOpenChannelToPlugin(const GURL& url,
const std::string& mime_type,
diff --git a/chrome/browser/sandbox_policy.cc b/chrome/browser/sandbox_policy.cc
index 5b9dcc8..5e0e999 100644
--- a/chrome/browser/sandbox_policy.cc
+++ b/chrome/browser/sandbox_policy.cc
@@ -70,10 +70,10 @@ const wchar_t* const kTroublesomeDlls[] = {
} // namespace
PluginPolicyCategory GetPolicyCategoryForPlugin(
- const std::wstring& dll,
+ const FilePath& dll,
const std::wstring& clsid,
const std::wstring& list) {
- std::wstring filename = file_util::GetFilenameFromPath(dll);
+ std::wstring filename = dll.BaseName().value();
std::wstring plugin_dll = StringToLowerASCII(filename);
std::wstring trusted_plugins = StringToLowerASCII(list);
std::wstring activex_clsid = StringToLowerASCII(clsid);
@@ -297,7 +297,7 @@ bool ApplyPolicyForUntrustedPlugin(sandbox::TargetPolicy* policy) {
return true;
}
-bool AddPolicyForPlugin(const std::wstring &plugin_dll,
+bool AddPolicyForPlugin(const FilePath &plugin_dll,
const std::string &activex_clsid,
const std::wstring &trusted_plugins,
sandbox::TargetPolicy* policy) {
diff --git a/chrome/browser/sandbox_policy.h b/chrome/browser/sandbox_policy.h
index 3beafdd..3711073 100644
--- a/chrome/browser/sandbox_policy.h
+++ b/chrome/browser/sandbox_policy.h
@@ -6,6 +6,8 @@
#define CHROME_BROWSER_SANDBOX_POLICY_H_
#include <string>
+
+#include "base/file_path.h"
#include "sandbox/src/sandbox.h"
#include "webkit/activex_shim/activex_shared.h"
@@ -23,7 +25,7 @@ bool AddPolicyForGearsInRenderer(sandbox::TargetPolicy* policy);
// |trusted_plugins| contains the comma separate list of plugins that should
// not be sandboxed. The plugin in the list can be either the plugin dll name
// of the class id if it's an ActiveX.
-bool AddPolicyForPlugin(const std::wstring &plugin_dll,
+bool AddPolicyForPlugin(const FilePath &plugin_dll,
const std::string &activex_clsid,
const std::wstring &trusted_plugins,
sandbox::TargetPolicy* policy);
@@ -35,7 +37,7 @@ enum PluginPolicyCategory {
// Returns the policy category for the plugin dll.
PluginPolicyCategory GetPolicyCategoryForPlugin(
- const std::wstring& plugin_dll,
+ const FilePath& plugin_dll,
const std::wstring& activex_clsid,
const std::wstring& trusted_plugins);
diff --git a/chrome/browser/task_manager_resource_providers.cc b/chrome/browser/task_manager_resource_providers.cc
index 6e62e7a..71ed524 100644
--- a/chrome/browser/task_manager_resource_providers.cc
+++ b/chrome/browser/task_manager_resource_providers.cc
@@ -249,7 +249,7 @@ std::wstring TaskManagerPluginProcessResource::GetTitle() const {
std::wstring plugin_name;
WebPluginInfo info;
if (PluginService::GetInstance()->
- GetPluginInfoByDllPath(plugin_process_.dll_path(), &info))
+ GetPluginInfoByDllPath(plugin_process_.plugin_path(), &info))
plugin_name = info.name;
else
plugin_name = l10n_util::GetString(IDS_TASK_MANAGER_UNKNOWN_PLUGIN_NAME);
@@ -406,7 +406,7 @@ void TaskManagerPluginProcessResourceProvider::RetrievePluginProcessInfo() {
for (PluginProcessHostIterator iter; !iter.Done(); ++iter) {
PluginProcessHost* plugin = const_cast<PluginProcessHost*>(*iter);
DCHECK(plugin->process());
- PluginProcessInfo plugin_info(plugin->dll_path(), plugin->process());
+ PluginProcessInfo plugin_info(plugin->plugin_path(), plugin->process());
existing_plugin_process_info.push_back(plugin_info);
}
// Now notify the UI thread that we have retrieved the PluginProcessHosts.
diff --git a/chrome/browser/web_contents.cc b/chrome/browser/web_contents.cc
index 5f1c124..cef4558 100644
--- a/chrome/browser/web_contents.cc
+++ b/chrome/browser/web_contents.cc
@@ -1257,10 +1257,10 @@ void WebContents::OnMissingPluginStatus(int status) {
GetPluginInstaller()->OnMissingPluginStatus(status);
}
-void WebContents::OnCrashedPlugin(const std::wstring& plugin_path) {
- DCHECK(!plugin_path.empty());
+void WebContents::OnCrashedPlugin(const FilePath& plugin_path) {
+ DCHECK(!plugin_path.value().empty());
- std::wstring plugin_name = plugin_path;
+ std::wstring plugin_name = plugin_path.ToWStringHack();
scoped_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(plugin_path));
if (version_info.get()) {
diff --git a/chrome/browser/web_contents.h b/chrome/browser/web_contents.h
index 359a294..b14d07a 100644
--- a/chrome/browser/web_contents.h
+++ b/chrome/browser/web_contents.h
@@ -288,7 +288,7 @@ class WebContents : public TabContents,
virtual GURL GetAlternateErrorPageURL() const;
virtual WebPreferences GetWebkitPrefs();
virtual void OnMissingPluginStatus(int status);
- virtual void OnCrashedPlugin(const std::wstring& plugin_path);
+ virtual void OnCrashedPlugin(const FilePath& plugin_path);
virtual void OnJSOutOfMemory();
virtual void ShouldClosePage(bool proceed) {
render_manager_.ShouldClosePage(proceed);