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

Unified Diff: chrome/browser/extensions/file_manager_util.cc

Issue 7057053: Escaping file names correctly. Also fixed a crush in chromeos debug build while saving a web page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed opening files with spaces in their names. Created 9 years, 7 months 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: chrome/browser/extensions/file_manager_util.cc
diff --git a/chrome/browser/extensions/file_manager_util.cc b/chrome/browser/extensions/file_manager_util.cc
index 833e81711bfc776630e1e4a731ebeb3395a4f065..98e7dc5d58ba76df0853cef37e6319698313dc5c 100644
--- a/chrome/browser/extensions/file_manager_util.cc
+++ b/chrome/browser/extensions/file_manager_util.cc
@@ -16,6 +16,7 @@
#include "content/browser/browser_thread.h"
#include "content/browser/user_metrics.h"
#include "grit/generated_resources.h"
+#include "net/base/escape.h"
#include "third_party/libjingle/source/talk/base/urlencode.h"
rginda 2011/06/01 16:53:51 libjingle has a UrlEncodeStringWithoutEncodingSpac
SeRya 2011/06/02 08:42:40 Done.
#include "ui/base/l10n/l10n_util.h"
#include "webkit/fileapi/file_system_context.h"
@@ -130,7 +131,6 @@ void FileManagerUtil::ShowFullTabUrl(Profile*,
browser->ShowSingletonTab(GURL(url));
}
-
void FileManagerUtil::ViewItem(const FilePath& full_path, bool enqueue) {
std::string ext = full_path.Extension();
// For things supported natively by the browser, we should open it
@@ -138,7 +138,7 @@ void FileManagerUtil::ViewItem(const FilePath& full_path, bool enqueue) {
if (IsSupportedBrowserExtension(ext.data())) {
std::string path;
path = "file://";
- path.append(full_path.value());
+ path.append(EscapeUrlEncodedData(full_path.value(), false));
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
bool result = BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -190,9 +190,9 @@ std::string FileManagerUtil::GetArgumentsJson(
arg_value.SetString("defaultPath", default_path.value());
arg_value.SetString("defaultExtension", default_extension);
- ListValue* types_list = new ListValue();
if (file_types) {
+ ListValue* types_list = new ListValue();
for (size_t i = 0; i < file_types->extensions.size(); ++i) {
ListValue* extensions_list = new ListValue();
for (size_t j = 0; j < file_types->extensions[i].size(); ++j) {
@@ -213,6 +213,7 @@ std::string FileManagerUtil::GetArgumentsJson(
types_list->Set(i, dict);
}
+ arg_value.Set("typeList", types_list);
}
std::string rv;

Powered by Google App Engine
This is Rietveld 408576698