summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 18:37:31 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 18:37:31 +0000
commit630947caffc803a4cc96e3754af45aeedc957c0c (patch)
tree3950c0a479831c51a008a4ef210829a041498f33 /chrome
parent055aedeb2134e49c10c3b3a3593cb8df768d737c (diff)
downloadchromium_src-630947caffc803a4cc96e3754af45aeedc957c0c.zip
chromium_src-630947caffc803a4cc96e3754af45aeedc957c0c.tar.gz
chromium_src-630947caffc803a4cc96e3754af45aeedc957c0c.tar.bz2
Enable localization of default downloaded filename.
Instead of localizing "download" string in net_util.cc, make a caller, download_manger, provide a localized string. BUG=25289 TEST=NetUtilTest.GetSuggestedFilename,DownloadManagerTest.TestDownloadFilename Original patch by hayato@google.com at: http://codereview.chromium.org/343014/show Review URL: http://codereview.chromium.org/367003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30971 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/generated_resources.grd14
-rw-r--r--chrome/browser/bookmarks/bookmark_utils.cc3
-rw-r--r--chrome/browser/cocoa/web_drag_source.mm3
-rw-r--r--chrome/browser/download/download_manager.cc11
-rw-r--r--chrome/browser/download/save_package.cc6
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_view_win.cc3
6 files changed, 28 insertions, 12 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index bb4f689..3520ec7 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -2588,7 +2588,7 @@ each locale. -->
<message name="IDS_EXTENSION_PROMPT_WARNING_NEW_FULL_ACCESS" desc="Warning displayed in body of extension dialog when the extension requires access the local machine.">
This extension will have full access to your computer and private data, and will autoupdate without further notice or action by you.
</message>
-
+
<!-- chrome://extensions page -->
<message name="IDS_EXTENSIONS_DEVELOPER_TOOLS_LINK" desc="Text of the link for developer tools.">
Developer tools
@@ -2676,7 +2676,7 @@ each locale. -->
</message>
<message name="IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_NEW" desc="Message shown on successful packing of a new extension.">
Created the following files:
-
+
Extension: <ph name="EXTENSION_FILE">$1<ex>c:\users\aa\myextension.crx</ex></ph>
Key File: <ph name="KEY_FILE">$2<ex>c:\users\aa\myextension.pem</ex></ph>
@@ -4075,7 +4075,7 @@ Keep your key file in a safe place. You will need it to create new versions of y
Show Home button
</message>
</if>
-
+
<if expr="os == 'darwin'">
<!-- Mac has a Toolbar group (IDS_OPTIONS_HOMEPAGE_SHOW_BUTTON moved in this group) -->
<message name="IDS_OPTIONS_TOOLBAR_GROUP_NAME" desc="The title of the toolbar group">
@@ -5250,10 +5250,12 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_BOOKMARK_MANAGER_SEARCH_TITLE" desc="Text shown before the search text field.">
Search:
</message>
-
<message name="IDS_DEFAULT_FILENAME" desc="Default name for saved files when we have no idea what they could be.">
unknown
</message>
+ <message name="IDS_DEFAULT_DOWNLOAD_FILENAME" desc="Default name for downloaded files when we have no idea what they could be.">
+ download
+ </message>
<message name="IDS_BROWSER_WINDOW_MAC_TAB_UNTITLED" desc="Tabs and windows on MacOS with no title use this string.">
Untitled
</message>
@@ -5411,7 +5413,7 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_SYNC_SUCCESS" desc="Operation successful">
Success!
</message>
-
+
<!-- Sync app menu item strings -->
<message name="IDS_SYNC_MENU_BOOKMARKS_SYNCED_LABEL" desc="The text for the sync app menu item when bookmark sync has been enabled">
Bookmarks synced...
@@ -5419,7 +5421,7 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_SYNC_MENU_BOOKMARK_SYNC_ERROR_LABEL" desc="The text for the sync app menu item when a bookmark sync error has occured">
Bookmark sync error...
</message>
-
+
<!-- Merge and Sync dialog strings -->
<message name="IDS_SYNC_MERGE_INTRODUCTION" desc="The header at the top of the merge and sync dialog.">
Your bookmarks will be merged.
diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc
index 3af7910..54ea21cb 100644
--- a/chrome/browser/bookmarks/bookmark_utils.cc
+++ b/chrome/browser/bookmarks/bookmark_utils.cc
@@ -9,6 +9,7 @@
#include "app/l10n_util.h"
#include "app/tree_node_iterator.h"
#include "base/basictypes.h"
+#include "base/file_path.h"
#include "base/string_util.h"
#include "base/time.h"
#include "chrome/browser/bookmarks/bookmark_drag_data.h"
@@ -403,7 +404,7 @@ bool CanPasteFromClipboard(const BookmarkNode* node) {
std::string GetNameForURL(const GURL& url) {
if (url.is_valid()) {
return WideToUTF8(net::GetSuggestedFilename(
- url, std::string(), std::string(), "").ToWStringHack());
+ url, std::string(), std::string(), FilePath()).ToWStringHack());
} else {
return l10n_util::GetStringUTF8(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME);
}
diff --git a/chrome/browser/cocoa/web_drag_source.mm b/chrome/browser/cocoa/web_drag_source.mm
index 3790e0c..2fb135a 100644
--- a/chrome/browser/cocoa/web_drag_source.mm
+++ b/chrome/browser/cocoa/web_drag_source.mm
@@ -4,6 +4,7 @@
#import "chrome/browser/cocoa/web_drag_source.h"
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/nsimage_cache_mac.h"
#include "base/string_util.h"
@@ -52,7 +53,7 @@ FilePath GetFileNameFromDragData(
if (file_name.empty()) {
// Retrieve the name from the URL.
- file_name = net::GetSuggestedFilename(drop_data.url, "", "", "");
+ file_name = net::GetSuggestedFilename(drop_data.url, "", "", FilePath());
}
file_name = file_name.ReplaceExtension([SysUTF16ToNSString(
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index bb0a280..1295f25 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -1187,10 +1187,19 @@ void DownloadManager::GenerateExtension(
void DownloadManager::GenerateFilename(DownloadCreateInfo* info,
FilePath* generated_name) {
+ std::wstring default_name =
+ l10n_util::GetString(IDS_DEFAULT_DOWNLOAD_FILENAME);
+#if defined(OS_WIN)
+ FilePath default_file_path(default_name);
+#elif defined(OS_POSIX)
+ FilePath default_file_path(base::SysWideToNativeMB(default_name));
+#endif
+
*generated_name = net::GetSuggestedFilename(GURL(info->url),
info->content_disposition,
info->referrer_charset,
- "download");
+ default_file_path);
+
DCHECK(!generated_name->empty());
GenerateSafeFilename(info->mime_type, generated_name);
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index 15e4787..e4df35a 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/download/save_package.h"
#include "app/l10n_util.h"
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/i18n/file_util_icu.h"
#include "base/logging.h"
@@ -67,7 +68,8 @@ namespace {
// Default name which will be used when we can not get proper name from
// resource URL.
-const char kDefaultSaveName[] = "saved_resource";
+const FilePath::CharType kDefaultSaveName[] =
+ FILE_PATH_LITERAL("saved_resource");
const FilePath::CharType kDefaultHtmlExtension[] =
#if defined(OS_WIN)
@@ -339,7 +341,7 @@ bool SavePackage::GenerateFilename(const std::string& disposition,
// TODO(jungshik): Figure out the referrer charset when having one
// makes sense and pass it to GetSuggestedFilename.
FilePath file_path = net::GetSuggestedFilename(url, disposition, "",
- kDefaultSaveName);
+ FilePath(kDefaultSaveName));
DCHECK(!file_path.empty());
FilePath::StringType pure_file_name =
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_win.cc b/chrome/browser/views/tab_contents/tab_contents_view_win.cc
index 65937e0..29c967b 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_win.cc
+++ b/chrome/browser/views/tab_contents/tab_contents_view_win.cc
@@ -9,6 +9,7 @@
#include "app/gfx/canvas_paint.h"
#include "app/os_exchange_data.h"
#include "app/os_exchange_data_provider_win.h"
+#include "base/file_path.h"
#include "base/keyboard_codes.h"
#include "base/time.h"
#include "base/win_util.h"
@@ -138,7 +139,7 @@ void TabContentsViewWin::StartDragging(const WebDropData& drop_data,
file_name = file_name.BaseName().RemoveExtension();
if (file_name.value().empty()) {
// Retrieve the name from the URL.
- file_name = net::GetSuggestedFilename(drop_data.url, "", "", "");
+ file_name = net::GetSuggestedFilename(drop_data.url, "", "", FilePath());
if (file_name.value().size() + drop_data.file_extension.size() + 1 >
MAX_PATH) {
file_name = FilePath(file_name.value().substr(