summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-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
-rw-r--r--chrome/common/chrome_plugin_lib.cc25
-rw-r--r--chrome/common/chrome_plugin_lib.h25
-rw-r--r--chrome/common/chrome_plugin_unittest.cc7
-rw-r--r--chrome/common/ipc_message_utils.h19
-rw-r--r--chrome/common/render_messages_internal.h12
-rw-r--r--chrome/plugin/plugin_main.cc5
-rw-r--r--chrome/plugin/plugin_process.cc8
-rw-r--r--chrome/plugin/plugin_process.h8
-rw-r--r--chrome/plugin/plugin_thread.cc2
-rw-r--r--chrome/plugin/webplugin_delegate_stub.cc3
-rw-r--r--chrome/renderer/render_thread.cc4
-rw-r--r--chrome/renderer/render_thread.h3
-rw-r--r--chrome/renderer/render_view.cc9
-rw-r--r--chrome/renderer/render_view.h2
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc5
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.h4
35 files changed, 178 insertions, 139 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);
diff --git a/chrome/common/chrome_plugin_lib.cc b/chrome/common/chrome_plugin_lib.cc
index 642c623..d9848c9 100644
--- a/chrome/common/chrome_plugin_lib.cc
+++ b/chrome/common/chrome_plugin_lib.cc
@@ -25,7 +25,7 @@ const TCHAR ChromePluginLib::kRegistryChromePlugins[] =
static const TCHAR kRegistryLoadOnStartup[] = _T("LoadOnStartup");
static const TCHAR kRegistryPath[] = _T("Path");
-typedef base::hash_map<std::wstring, scoped_refptr<ChromePluginLib> >
+typedef base::hash_map<FilePath, scoped_refptr<ChromePluginLib> >
PluginMap;
// A map of all the instantiated plugins.
@@ -43,7 +43,7 @@ static bool IsSingleProcessMode() {
}
// static
-ChromePluginLib* ChromePluginLib::Create(const std::wstring& filename,
+ChromePluginLib* ChromePluginLib::Create(const FilePath& filename,
const CPBrowserFuncs* bfuncs) {
// Keep a map of loaded plugins to ensure we only load each library once.
if (!g_loaded_libs) {
@@ -53,8 +53,13 @@ ChromePluginLib* ChromePluginLib::Create(const std::wstring& filename,
}
DCHECK(IsPluginThread());
- // Lower case to match how PluginList::LoadPlugin stores the path.
- std::wstring filename_lc = StringToLowerASCII(filename);
+#if defined(OS_WIN)
+ // Lower case to match how PluginLib::CreatePluginLib stores the path. See
+ // there for the rationale behind this.
+ FilePath filename_lc(StringToLowerASCII(filename.value()));
+#else
+ FilePath filename_lc = filename;
+#endif // OS_WIN
PluginMap::const_iterator iter = g_loaded_libs->find(filename_lc);
if (iter != g_loaded_libs->end())
@@ -69,7 +74,7 @@ ChromePluginLib* ChromePluginLib::Create(const std::wstring& filename,
}
// static
-ChromePluginLib* ChromePluginLib::Find(const std::wstring& filename) {
+ChromePluginLib* ChromePluginLib::Find(const FilePath& filename) {
if (g_loaded_libs) {
PluginMap::const_iterator iter = g_loaded_libs->find(filename);
if (iter != g_loaded_libs->end())
@@ -79,7 +84,7 @@ ChromePluginLib* ChromePluginLib::Find(const std::wstring& filename) {
}
// static
-void ChromePluginLib::Destroy(const std::wstring& filename) {
+void ChromePluginLib::Destroy(const FilePath& filename) {
DCHECK(g_loaded_libs);
PluginMap::iterator iter = g_loaded_libs->find(filename);
if (iter != g_loaded_libs->end()) {
@@ -104,7 +109,7 @@ void ChromePluginLib::RegisterPluginsWithNPAPI() {
if (IsSingleProcessMode())
return;
- std::wstring path;
+ FilePath path;
if (!PathService::Get(chrome::FILE_GEARS_PLUGIN, &path))
return;
// Note: we can only access the NPAPI list because the PluginService has done
@@ -127,7 +132,7 @@ void ChromePluginLib::LoadChromePlugins(const CPBrowserFuncs* bfuncs) {
if (IsSingleProcessMode())
return;
- std::wstring path;
+ FilePath path;
if (!PathService::Get(chrome::FILE_GEARS_PLUGIN, &path))
return;
@@ -177,7 +182,7 @@ const CPPluginFuncs& ChromePluginLib::functions() const {
return plugin_funcs_;
}
-ChromePluginLib::ChromePluginLib(const std::wstring& filename)
+ChromePluginLib::ChromePluginLib(const FilePath& filename)
: filename_(filename),
module_(0),
initialized_(false),
@@ -229,7 +234,7 @@ int ChromePluginLib::CP_Test(void* param) {
bool ChromePluginLib::Load() {
DCHECK(module_ == 0);
- module_ = LoadLibrary(filename_.c_str());
+ module_ = LoadLibrary(filename_.value().c_str());
if (module_ == 0)
return false;
diff --git a/chrome/common/chrome_plugin_lib.h b/chrome/common/chrome_plugin_lib.h
index f58b9c8..eb2e95f 100644
--- a/chrome/common/chrome_plugin_lib.h
+++ b/chrome/common/chrome_plugin_lib.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/file_path.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "chrome/common/chrome_plugin_api.h"
@@ -20,10 +21,10 @@ class MessageLoop;
// issues a NOTIFY_CHROME_PLUGIN_UNLOADED notification.
class ChromePluginLib : public base::RefCounted<ChromePluginLib> {
public:
- static ChromePluginLib* Create(const std::wstring& filename,
+ static ChromePluginLib* Create(const FilePath& filename,
const CPBrowserFuncs* bfuncs);
- static ChromePluginLib* Find(const std::wstring& filename);
- static void Destroy(const std::wstring& filename);
+ static ChromePluginLib* Find(const FilePath& filename);
+ static void Destroy(const FilePath& filename);
static bool IsPluginThread();
static MessageLoop* GetPluginThreadLoop();
@@ -49,7 +50,7 @@ class ChromePluginLib : public base::RefCounted<ChromePluginLib> {
CPID cpid() { return reinterpret_cast<CPID>(this); }
- const std::wstring& filename() { return filename_; }
+ const FilePath& filename() { return filename_; }
// Plugin API functions
@@ -62,7 +63,7 @@ class ChromePluginLib : public base::RefCounted<ChromePluginLib> {
private:
friend class base::RefCounted<ChromePluginLib>;
- ChromePluginLib(const std::wstring& filename);
+ ChromePluginLib(const FilePath& filename);
~ChromePluginLib();
// Method to initialize a Plugin.
@@ -79,20 +80,20 @@ class ChromePluginLib : public base::RefCounted<ChromePluginLib> {
// Unloading the plugin DLL.
void Unload();
- std::wstring filename_; // the path to the DLL
- HMODULE module_; // the opened DLL handle
- bool initialized_; // is the plugin initialized
+ FilePath filename_; // the path to the DLL
+ HMODULE module_; // the opened DLL handle
+ bool initialized_; // is the plugin initialized
// DLL exports, looked up by name.
- CP_VersionNegotiateFunc CP_VersionNegotiate_;
- CP_InitializeFunc CP_Initialize_;
+ CP_VersionNegotiateFunc CP_VersionNegotiate_;
+ CP_InitializeFunc CP_Initialize_;
// Additional function pointers provided by the plugin.
- CPPluginFuncs plugin_funcs_;
+ CPPluginFuncs plugin_funcs_;
// Used for unit tests.
typedef int (STDCALL *CP_TestFunc)(void*);
- CP_TestFunc CP_Test_;
+ CP_TestFunc CP_Test_;
DISALLOW_COPY_AND_ASSIGN(ChromePluginLib);
};
diff --git a/chrome/common/chrome_plugin_unittest.cc b/chrome/common/chrome_plugin_unittest.cc
index 1465f1a..09ae2f4 100644
--- a/chrome/common/chrome_plugin_unittest.cc
+++ b/chrome/common/chrome_plugin_unittest.cc
@@ -17,7 +17,8 @@
namespace {
const wchar_t kDocRoot[] = L"chrome/test/data";
-const wchar_t kPluginFilename[] = L"test_chrome_plugin.dll";
+const FilePath::CharType kPluginFilename[] =
+ FILE_PATH_LITERAL("test_chrome_plugin.dll");
class ChromePluginTest : public testing::Test, public URLRequest::Delegate {
public:
@@ -117,9 +118,9 @@ static void STDCALL CPT_InvokeLater(TestFuncParams::CallbackFunc callback,
}
void ChromePluginTest::LoadPlugin() {
- std::wstring path;
+ FilePath path;
PathService::Get(base::DIR_EXE, &path);
- file_util::AppendToPath(&path, kPluginFilename);
+ path = path.Append(kPluginFilename);
plugin_ = ChromePluginLib::Create(path, GetCPBrowserFuncsForBrowser());
// Exchange test APIs with the plugin.
diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h
index 476d7f9..39bb231 100644
--- a/chrome/common/ipc_message_utils.h
+++ b/chrome/common/ipc_message_utils.h
@@ -9,6 +9,7 @@
#include <vector>
#include <map>
+#include "base/file_path.h"
#include "base/string_util.h"
#include "base/tuple.h"
#include "chrome/common/ipc_sync_message.h"
@@ -604,6 +605,24 @@ struct ParamTraits<POINT> {
#endif // defined(OS_WIN)
template <>
+struct ParamTraits<FilePath> {
+ typedef FilePath param_type;
+ static void Write(Message* m, const param_type& p) {
+ ParamTraits<FilePath::StringType>::Write(m, p.value());
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ FilePath::StringType value;
+ if (!ParamTraits<FilePath::StringType>::Read(m, iter, &value))
+ return false;
+ *r = FilePath(value);
+ return true;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ ParamTraits<FilePath::StringType>::Log(p.value(), l);
+ }
+};
+
+template <>
struct ParamTraits<gfx::Point> {
typedef gfx::Point param_type;
static void Write(Message* m, const param_type& p);
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 64a76b2..e2b7c26 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -55,7 +55,7 @@ IPC_BEGIN_MESSAGES(View, 1)
// Allows a chrome plugin loaded in the browser process to send arbitrary
// data to an instance of the same plugin loaded in a renderer process.
IPC_MESSAGE_CONTROL2(ViewMsg_PluginMessage,
- std::wstring /* dll_path of plugin */,
+ FilePath /* plugin_path of plugin */,
std::vector<uint8> /* opaque data */)
#if defined(OS_WIN)
@@ -703,7 +703,7 @@ IPC_BEGIN_MESSAGES(ViewHost, 2)
GURL /* url */,
std::string /* mime_type */,
std::string /* clsid */,
- std::wstring /* filename */,
+ FilePath /* filename */,
std::string /* actual mime type for url */)
// Retrieve the data directory associated with the renderer's profile.
@@ -713,13 +713,13 @@ IPC_BEGIN_MESSAGES(ViewHost, 2)
// Allows a chrome plugin loaded in a renderer process to send arbitrary
// data to an instance of the same plugin loaded in the browser process.
IPC_MESSAGE_CONTROL2(ViewHostMsg_PluginMessage,
- std::wstring /* dll_path of plugin */,
+ FilePath /* plugin_path of plugin */,
std::vector<uint8> /* opaque data */)
// Allows a chrome plugin loaded in a renderer process to send arbitrary
// data to an instance of the same plugin loaded in the browser process.
IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_PluginSyncMessage,
- std::wstring /* dll_path of plugin */,
+ FilePath /* plugin_path of plugin */,
std::vector<uint8> /* opaque data */,
std::vector<uint8> /* opaque data */)
@@ -811,7 +811,7 @@ IPC_BEGIN_MESSAGES(ViewHost, 2)
std::string /* clsid */,
std::wstring /* locale */,
std::wstring /* channel_name */,
- std::wstring /* plugin_path */)
+ FilePath /* plugin_path */)
// Clipboard IPC messages
@@ -991,7 +991,7 @@ IPC_BEGIN_MESSAGES(ViewHost, 2)
// Sent by the renderer process to indicate that a plugin instance has
// crashed.
IPC_MESSAGE_ROUTED1(ViewHostMsg_CrashedPlugin,
- std::wstring /* plugin_path */)
+ FilePath /* plugin_path */)
// Dsiplays a JavaScript out-of-memory message in the infobar.
IPC_MESSAGE_ROUTED0(ViewHostMsg_JSOutOfMemory)
diff --git a/chrome/plugin/plugin_main.cc b/chrome/plugin/plugin_main.cc
index 84aa0b5..b925a01 100644
--- a/chrome/plugin/plugin_main.cc
+++ b/chrome/plugin/plugin_main.cc
@@ -50,8 +50,9 @@ int PluginMain(CommandLine &parsed_command_line,
std::wstring channel_name =
parsed_command_line.GetSwitchValue(switches::kProcessChannelID);
- std::wstring plugin_path =
- parsed_command_line.GetSwitchValue(switches::kPluginPath);
+ FilePath plugin_path =
+ FilePath::FromWStringHack(
+ parsed_command_line.GetSwitchValue(switches::kPluginPath));
if (PluginProcess::GlobalInit(channel_name, plugin_path)) {
if (!no_sandbox && target_services) {
target_services->LowerToken();
diff --git a/chrome/plugin/plugin_process.cc b/chrome/plugin/plugin_process.cc
index 23f9948..fe19b9b 100644
--- a/chrome/plugin/plugin_process.cc
+++ b/chrome/plugin/plugin_process.cc
@@ -16,7 +16,7 @@
// Custom factory to allow us to pass additional ctor arguments.
class PluginProcessFactory : public ChildProcessFactoryInterface {
public:
- explicit PluginProcessFactory(const std::wstring& plugin_path)
+ explicit PluginProcessFactory(const FilePath& plugin_path)
: plugin_path_(plugin_path) {
}
@@ -24,7 +24,7 @@ class PluginProcessFactory : public ChildProcessFactoryInterface {
return new PluginProcess(channel_name, plugin_path_);
}
- const std::wstring& plugin_path_;
+ const FilePath& plugin_path_;
};
// How long to wait after there are no more plugin instances before killing the
@@ -40,7 +40,7 @@ template <> struct RunnableMethodTraits<PluginProcess> {
};
PluginProcess::PluginProcess(const std::wstring& channel_name,
- const std::wstring& plugin_path) :
+ const FilePath& plugin_path) :
plugin_path_(plugin_path),
#pragma warning(suppress: 4355) // Okay to pass "this" here.
plugin_thread_(this, channel_name) {
@@ -50,7 +50,7 @@ PluginProcess::~PluginProcess() {
}
bool PluginProcess::GlobalInit(const std::wstring &channel_name,
- const std::wstring &plugin_path) {
+ const FilePath &plugin_path) {
PluginProcessFactory factory(plugin_path);
return ChildProcess::GlobalInit(channel_name, &factory);
}
diff --git a/chrome/plugin/plugin_process.h b/chrome/plugin/plugin_process.h
index 444d597..c7c0b78 100644
--- a/chrome/plugin/plugin_process.h
+++ b/chrome/plugin/plugin_process.h
@@ -14,7 +14,7 @@
class PluginProcess : public ChildProcess {
public:
static bool GlobalInit(const std::wstring& channel_name,
- const std::wstring& plugin_path);
+ const FilePath& plugin_path);
// Invoked with the response from the browser indicating whether it is
// ok to shutdown the plugin process.
@@ -26,19 +26,19 @@ class PluginProcess : public ChildProcess {
static void BrowserShutdown();
// File path of the plugin dll this process hosts.
- const std::wstring& plugin_path() { return plugin_path_; }
+ const FilePath& plugin_path() { return plugin_path_; }
private:
friend class PluginProcessFactory;
PluginProcess(const std::wstring& channel_name,
- const std::wstring& plugin_path);
+ const FilePath& plugin_path);
virtual ~PluginProcess();
virtual void OnFinalRelease();
void Shutdown();
void OnProcessShutdownTimeout();
- const std::wstring plugin_path_;
+ const FilePath plugin_path_;
// The thread where plugin instances live. Since NPAPI plugins weren't
// created with multi-threading in mind, running multiple instances on
diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc
index 4fb4454..e9c1ecd 100644
--- a/chrome/plugin/plugin_thread.cc
+++ b/chrome/plugin/plugin_thread.cc
@@ -77,7 +77,7 @@ void PluginThread::Init() {
// Preload the dll to avoid loading, unloading then reloading
preloaded_plugin_module_ = NPAPI::PluginLib::LoadPluginHelper(
- plugin_process_->plugin_path().c_str());
+ plugin_process_->plugin_path());
ChromePluginLib::Create(plugin_process_->plugin_path(),
GetCPBrowserFuncsForPlugin());
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc
index daebf40..6d9cfe6 100644
--- a/chrome/plugin/webplugin_delegate_stub.cc
+++ b/chrome/plugin/webplugin_delegate_stub.cc
@@ -124,7 +124,8 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params,
}
CommandLine command_line;
- std::wstring path = command_line.GetSwitchValue(switches::kPluginPath);
+ FilePath path =
+ FilePath(command_line.GetSwitchValue(switches::kPluginPath));
delegate_ = WebPluginDelegateImpl::Create(
path, mime_type_, params.containing_window);
if (delegate_) {
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index c5be113..5aa1dc6 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -175,10 +175,10 @@ void RenderThread::OnMessageReceived(const IPC::Message& msg) {
}
}
-void RenderThread::OnPluginMessage(const std::wstring& dll_path,
+void RenderThread::OnPluginMessage(const FilePath& plugin_path,
const std::vector<uint8>& data) {
CHECK(ChromePluginLib::IsPluginThread());
- 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/renderer/render_thread.h b/chrome/renderer/render_thread.h
index ae94815..c9dbea4 100644
--- a/chrome/renderer/render_thread.h
+++ b/chrome/renderer/render_thread.h
@@ -5,6 +5,7 @@
#ifndef CHROME_RENDERER_RENDER_THREAD_H_
#define CHROME_RENDERER_RENDER_THREAD_H_
+#include "base/file_path.h"
#include "base/ref_counted.h"
#include "base/shared_memory.h"
#include "base/task.h"
@@ -97,7 +98,7 @@ class RenderThread : public IPC::Channel::Listener,
void OnUpdateVisitedLinks(base::SharedMemoryHandle table);
void OnUpdateGreasemonkeyScripts(base::SharedMemoryHandle table);
- void OnPluginMessage(const std::wstring& dll_path,
+ void OnPluginMessage(const FilePath& plugin_path,
const std::vector<uint8>& data);
void OnSetNextPageID(int32 next_page_id);
void OnCreateNewView(HWND parent_hwnd,
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index fdbee76..c94e430 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -235,7 +235,7 @@ void RenderView::PluginDestroyed(WebPluginDelegateProxy* proxy) {
first_default_plugin_ = NULL;
}
-void RenderView::PluginCrashed(const std::wstring& plugin_path) {
+void RenderView::PluginCrashed(const FilePath& plugin_path) {
Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path));
}
@@ -1843,11 +1843,11 @@ WebPluginDelegate* RenderView::CreatePluginDelegate(
std::string* actual_mime_type) {
bool is_gears = false;
if (ShouldLoadPluginInProcess(mime_type, &is_gears)) {
- std::wstring path;
+ FilePath path;
render_thread_->Send(
new ViewHostMsg_GetPluginPath(url, mime_type, clsid, &path,
actual_mime_type));
- if (path.empty())
+ if (path.value().empty())
return NULL;
std::string mime_type_to_use;
@@ -1858,7 +1858,8 @@ WebPluginDelegate* RenderView::CreatePluginDelegate(
if (is_gears)
ChromePluginLib::Create(path, GetCPBrowserFuncsForRenderer());
- return WebPluginDelegateImpl::Create(path, mime_type_to_use, host_window_);
+ return WebPluginDelegateImpl::Create(path,
+ mime_type_to_use, host_window_);
}
WebPluginDelegateProxy* proxy =
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 24f8f9b..23fd8b6 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -288,7 +288,7 @@ class RenderView : public RenderWidget,
void PluginDestroyed(WebPluginDelegateProxy* proxy);
// Called when a plugin is crashed.
- void PluginCrashed(const std::wstring& plugin_path);
+ void PluginCrashed(const FilePath& plugin_path);
// Called from JavaScript window.external.AddSearchProvider() to add a
// keyword for a provider described in the given OpenSearch document.
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index b5c92a5..5a70548 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -207,7 +207,8 @@ bool WebPluginDelegateProxy::Initialize(const GURL& url, char** argn,
char** argv, int argc,
WebPlugin* plugin,
bool load_manually) {
- std::wstring channel_name, plugin_path;
+ std::wstring channel_name;
+ FilePath plugin_path;
if (!g_render_thread->Send(new ViewHostMsg_OpenChannelToPlugin(
url, mime_type_, clsid_, webkit_glue::GetWebKitLocale(),
&channel_name, &plugin_path)))
@@ -308,7 +309,7 @@ void WebPluginDelegateProxy::DidManualLoadFail() {
Send(new PluginMsg_DidManualLoadFail(instance_id_));
}
-std::wstring WebPluginDelegateProxy::GetPluginPath() {
+FilePath WebPluginDelegateProxy::GetPluginPath() {
return plugin_path_;
}
diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h
index 38e65e6..4f8b757 100644
--- a/chrome/renderer/webplugin_delegate_proxy.h
+++ b/chrome/renderer/webplugin_delegate_proxy.h
@@ -83,7 +83,7 @@ class WebPluginDelegateProxy : public WebPluginDelegate,
virtual void DidReceiveManualData(const char* buffer, int length);
virtual void DidFinishManualLoading();
virtual void DidManualLoadFail();
- virtual std::wstring GetPluginPath();
+ virtual FilePath GetPluginPath();
virtual void InstallMissingPlugin();
virtual WebPluginResourceClient* CreateResourceClient(int resource_id,
const std::string &url,
@@ -154,7 +154,7 @@ class WebPluginDelegateProxy : public WebPluginDelegate,
std::string mime_type_;
std::string clsid_;
int instance_id_;
- std::wstring plugin_path_;
+ FilePath plugin_path_;
gfx::Rect plugin_rect_;
gfx::Rect deferred_clip_rect_;