Index: chrome/browser/chromeos/extensions/file_handler_util.cc |
diff --git a/chrome/browser/chromeos/extensions/file_handler_util.cc b/chrome/browser/chromeos/extensions/file_handler_util.cc |
index 743f8c548cd5edbbddf5719ee1d67013a78625fb..969e9b6bfd4824b5adfe34efadeb64d8982afa5a 100644 |
--- a/chrome/browser/chromeos/extensions/file_handler_util.cc |
+++ b/chrome/browser/chromeos/extensions/file_handler_util.cc |
@@ -6,9 +6,11 @@ |
#include "base/bind.h" |
#include "base/file_util.h" |
+#include "base/i18n/case_conversion.h" |
#include "base/json/json_writer.h" |
#include "base/string_util.h" |
#include "base/stringprintf.h" |
+#include "base/utf_string_conversions.h" |
#include "chrome/browser/extensions/extension_event_router.h" |
#include "chrome/browser/extensions/extension_service.h" |
#include "chrome/browser/extensions/extension_tab_util.h" |
@@ -22,6 +24,7 @@ |
#include "content/public/browser/render_process_host.h" |
#include "content/public/browser/site_instance.h" |
#include "content/public/browser/web_contents.h" |
+#include "net/base/escape.h" |
#include "webkit/fileapi/file_system_context.h" |
#include "webkit/fileapi/file_system_mount_point_provider.h" |
#include "webkit/fileapi/file_system_util.h" |
@@ -95,6 +98,14 @@ URLPatternSet GetAllMatchingPatterns(const FileBrowserHandler* handler, |
typedef std::set<const FileBrowserHandler*> ActionSet; |
+std::string EscapedUtf8ToLower(const std::string& str) { |
+ string16 utf16 = UTF8ToUTF16( |
+ net::UnescapeURLComponent(str, net::UnescapeRule::NORMAL)); |
SeRya
2012/03/14 11:35:04
Looks suspicious. You are unescaping whole URL wit
Vladislav Kaznacheev
2012/03/14 12:24:43
Actually there is no net::UnescapeURL. The second
|
+ return net::EscapeUrlEncodedData( |
+ UTF16ToUTF8(base::i18n::ToLower(utf16)), |
+ false /* do not replace space with plus */); |
+} |
+ |
bool GetFileBrowserHandlers(Profile* profile, |
const GURL& selected_file_url, |
ActionSet* results) { |
@@ -102,6 +113,11 @@ bool GetFileBrowserHandlers(Profile* profile, |
if (!service) |
return false; // In unit-tests, we may not have an ExtensionService. |
+ // We need case-insensitive matching, and pattern in the handler is already |
+ // in lower case. |
+ const GURL lowercase_url(EscapedUtf8ToLower(selected_file_url.spec())); |
+ LOG(ERROR) << lowercase_url.spec(); |
+ |
for (ExtensionSet::const_iterator iter = service->extensions()->begin(); |
iter != service->extensions()->end(); |
++iter) { |
@@ -117,7 +133,7 @@ bool GetFileBrowserHandlers(Profile* profile, |
action_iter != extension->file_browser_handlers()->end(); |
++action_iter) { |
const FileBrowserHandler* action = action_iter->get(); |
- if (!action->MatchesURL(selected_file_url)) |
+ if (!action->MatchesURL(lowercase_url)) |
continue; |
results->insert(action_iter->get()); |