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

Side by Side Diff: chrome/browser/ui/views/download_item_view.cc

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 #include "chrome/browser/views/download_item_view.h" 5 #include "chrome/browser/views/download_item_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 #if defined(OS_LINUX) 271 #if defined(OS_LINUX)
272 std::wstring rootname = 272 std::wstring rootname =
273 base::SysNativeMBToWide(filename.RemoveExtension().value()); 273 base::SysNativeMBToWide(filename.RemoveExtension().value());
274 #else 274 #else
275 std::wstring rootname = filename.RemoveExtension().value(); 275 std::wstring rootname = filename.RemoveExtension().value();
276 #endif 276 #endif
277 277
278 // Elide giant extensions (this shouldn't currently be hit, but might 278 // Elide giant extensions (this shouldn't currently be hit, but might
279 // in future, should we ever notice unsafe giant extensions). 279 // in future, should we ever notice unsafe giant extensions).
280 if (extension.length() > kFileNameMaxLength / 2) 280 if (extension.length() > kFileNameMaxLength / 2)
281 ElideString(extension, kFileNameMaxLength / 2, &extension); 281 gfx::ElideString(extension, kFileNameMaxLength / 2, &extension);
282 282
283 // The dangerous download label text is different for an extension file. 283 // The dangerous download label text is different for an extension file.
284 if (download->is_extension_install()) { 284 if (download->is_extension_install()) {
285 dangerous_download_label_ = new views::Label( 285 dangerous_download_label_ = new views::Label(
286 l10n_util::GetString(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION)); 286 l10n_util::GetString(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION));
287 } else { 287 } else {
288 ElideString(rootname, kFileNameMaxLength - extension.length(), &rootname); 288 gfx::ElideString(rootname,
289 kFileNameMaxLength - extension.length(),
290 &rootname);
289 std::wstring filename = rootname + L"." + extension; 291 std::wstring filename = rootname + L"." + extension;
290 filename = UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality( 292 filename = UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality(
291 WideToUTF16(filename))); 293 WideToUTF16(filename)));
292 dangerous_download_label_ = new views::Label( 294 dangerous_download_label_ = new views::Label(
293 l10n_util::GetStringF(IDS_PROMPT_DANGEROUS_DOWNLOAD, filename)); 295 l10n_util::GetStringF(IDS_PROMPT_DANGEROUS_DOWNLOAD, filename));
294 } 296 }
295 dangerous_download_label_->SetMultiLine(true); 297 dangerous_download_label_->SetMultiLine(true);
296 dangerous_download_label_->SetHorizontalAlignment( 298 dangerous_download_label_->SetHorizontalAlignment(
297 views::Label::ALIGN_LEFT); 299 views::Label::ALIGN_LEFT);
298 AddChildView(dangerous_download_label_); 300 AddChildView(dangerous_download_label_);
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 1071
1070 // If the name has changed, call SetAccessibleName and notify 1072 // If the name has changed, call SetAccessibleName and notify
1071 // assistive technology that the name has changed so they can 1073 // assistive technology that the name has changed so they can
1072 // announce it immediately. 1074 // announce it immediately.
1073 if (new_name != current_name) { 1075 if (new_name != current_name) {
1074 SetAccessibleName(new_name); 1076 SetAccessibleName(new_name);
1075 if (GetWidget()) 1077 if (GetWidget())
1076 NotifyAccessibilityEvent(AccessibilityTypes::EVENT_NAME_CHANGED); 1078 NotifyAccessibilityEvent(AccessibilityTypes::EVENT_NAME_CHANGED);
1077 } 1079 }
1078 } 1080 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/external_protocol_dialog.mm ('k') | chrome/browser/ui/views/external_protocol_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698