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

Side by Side Diff: chrome/browser/ui/cocoa/download/download_item_controller.mm

Issue 6017001: Move ElideString() from base/string_util.cc to app/text_elider.cc to ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" 5 #import "chrome/browser/ui/cocoa/download/download_item_controller.h"
6 6
7 #include "app/l10n_util_mac.h" 7 #include "app/l10n_util_mac.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "app/text_elider.h" 9 #include "app/text_elider.h"
10 #include "base/mac_util.h" 10 #include "base/mac_util.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 FilePath filename(downloadModel->download()->target_name()); 184 FilePath filename(downloadModel->download()->target_name());
185 FilePath::StringType extension = filename.Extension(); 185 FilePath::StringType extension = filename.Extension();
186 186
187 // Remove leading '.' from the extension 187 // Remove leading '.' from the extension
188 if (extension.length() > 0) 188 if (extension.length() > 0)
189 extension = extension.substr(1); 189 extension = extension.substr(1);
190 190
191 // Elide giant extensions. 191 // Elide giant extensions.
192 if (extension.length() > kFileNameMaxLength / 2) { 192 if (extension.length() > kFileNameMaxLength / 2) {
193 std::wstring wide_extension; 193 std::wstring wide_extension;
194 ElideString(UTF8ToWide(extension), kFileNameMaxLength / 2, 194 gfx::ElideString(UTF8ToWide(extension), kFileNameMaxLength / 2,
195 &wide_extension); 195 &wide_extension);
196 extension = WideToUTF8(wide_extension); 196 extension = WideToUTF8(wide_extension);
197 } 197 }
198 198
199 // Rebuild the filename.extension. 199 // Rebuild the filename.extension.
200 std::wstring rootname = UTF8ToWide(filename.RemoveExtension().value()); 200 std::wstring rootname = UTF8ToWide(filename.RemoveExtension().value());
201 ElideString(rootname, kFileNameMaxLength - extension.length(), &rootname); 201 gfx::ElideString(rootname, kFileNameMaxLength - extension.length(),
202 &rootname);
202 std::string new_filename = WideToUTF8(rootname); 203 std::string new_filename = WideToUTF8(rootname);
203 if (extension.length()) 204 if (extension.length())
204 new_filename += std::string(".") + extension; 205 new_filename += std::string(".") + extension;
205 206
206 dangerousWarning = l10n_util::GetNSStringFWithFixup( 207 dangerousWarning = l10n_util::GetNSStringFWithFixup(
207 IDS_PROMPT_DANGEROUS_DOWNLOAD, UTF8ToUTF16(new_filename)); 208 IDS_PROMPT_DANGEROUS_DOWNLOAD, UTF8ToUTF16(new_filename));
208 confirmButtonTitle = l10n_util::GetNSStringWithFixup(IDS_SAVE_DOWNLOAD); 209 confirmButtonTitle = l10n_util::GetNSStringWithFixup(IDS_SAVE_DOWNLOAD);
209 } 210 }
210 [dangerousDownloadLabel_ setStringValue:dangerousWarning]; 211 [dangerousDownloadLabel_ setStringValue:dangerousWarning];
211 [dangerousDownloadConfirmButton_ setTitle:confirmButtonTitle]; 212 [dangerousDownloadConfirmButton_ setTitle:confirmButtonTitle];
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 [sender setTitle:l10n_util::GetNSStringWithFixup( 388 [sender setTitle:l10n_util::GetNSStringWithFixup(
388 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; 389 IDS_DOWNLOAD_MENU_PAUSE_ITEM)];
389 } else { 390 } else {
390 [sender setTitle:l10n_util::GetNSStringWithFixup( 391 [sender setTitle:l10n_util::GetNSStringWithFixup(
391 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; 392 IDS_DOWNLOAD_MENU_RESUME_ITEM)];
392 } 393 }
393 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); 394 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE);
394 } 395 }
395 396
396 @end 397 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc ('k') | chrome/browser/ui/cocoa/external_protocol_dialog.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698