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

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

Issue 3108027: Convert GetDisplayStringInLTRDirectionality from wstring to string16. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 4 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 unified diff | Download patch
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"
11 #include "app/text_elider.h" 11 #include "app/text_elider.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/histogram.h" 14 #include "base/histogram.h"
15 #include "base/i18n/rtl.h" 15 #include "base/i18n/rtl.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/sys_string_conversions.h" 17 #include "base/sys_string_conversions.h"
18 #include "base/utf_string_conversions.h"
18 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/browser_theme_provider.h" 20 #include "chrome/browser/browser_theme_provider.h"
20 #include "chrome/browser/download/download_item_model.h" 21 #include "chrome/browser/download/download_item_model.h"
21 #include "chrome/browser/download/download_util.h" 22 #include "chrome/browser/download/download_util.h"
22 #include "chrome/browser/views/download_shelf_view.h" 23 #include "chrome/browser/views/download_shelf_view.h"
23 #include "gfx/canvas_skia.h" 24 #include "gfx/canvas_skia.h"
24 #include "gfx/color_utils.h" 25 #include "gfx/color_utils.h"
25 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
26 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
27 #include "views/controls/button/native_button.h" 28 #include "views/controls/button/native_button.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 if (extension.length() > kFileNameMaxLength / 2) 279 if (extension.length() > kFileNameMaxLength / 2)
279 ElideString(extension, kFileNameMaxLength / 2, &extension); 280 ElideString(extension, kFileNameMaxLength / 2, &extension);
280 281
281 // The dangerous download label text is different for an extension file. 282 // The dangerous download label text is different for an extension file.
282 if (download->is_extension_install()) { 283 if (download->is_extension_install()) {
283 dangerous_download_label_ = new views::Label( 284 dangerous_download_label_ = new views::Label(
284 l10n_util::GetString(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION)); 285 l10n_util::GetString(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION));
285 } else { 286 } else {
286 ElideString(rootname, kFileNameMaxLength - extension.length(), &rootname); 287 ElideString(rootname, kFileNameMaxLength - extension.length(), &rootname);
287 std::wstring filename = rootname + L"." + extension; 288 std::wstring filename = rootname + L"." + extension;
288 base::i18n::GetDisplayStringInLTRDirectionality(&filename); 289 filename = UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality(
290 WideToUTF16(filename)));
289 dangerous_download_label_ = new views::Label( 291 dangerous_download_label_ = new views::Label(
290 l10n_util::GetStringF(IDS_PROMPT_DANGEROUS_DOWNLOAD, filename)); 292 l10n_util::GetStringF(IDS_PROMPT_DANGEROUS_DOWNLOAD, filename));
291 } 293 }
292 dangerous_download_label_->SetMultiLine(true); 294 dangerous_download_label_->SetMultiLine(true);
293 dangerous_download_label_->SetHorizontalAlignment( 295 dangerous_download_label_->SetHorizontalAlignment(
294 views::Label::ALIGN_LEFT); 296 views::Label::ALIGN_LEFT);
295 AddChildView(dangerous_download_label_); 297 AddChildView(dangerous_download_label_);
296 SizeLabelToMinWidth(); 298 SizeLabelToMinWidth();
297 } 299 }
298 300
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 void DownloadItemView::Reenable() { 1001 void DownloadItemView::Reenable() {
1000 disabled_while_opening_ = false; 1002 disabled_while_opening_ = false;
1001 SetEnabled(true); // Triggers a repaint. 1003 SetEnabled(true); // Triggers a repaint.
1002 } 1004 }
1003 1005
1004 bool DownloadItemView::InDropDownButtonXCoordinateRange(int x) { 1006 bool DownloadItemView::InDropDownButtonXCoordinateRange(int x) {
1005 if (x > drop_down_x_left_ && x < drop_down_x_right_) 1007 if (x > drop_down_x_left_ && x < drop_down_x_right_)
1006 return true; 1008 return true;
1007 return false; 1009 return false;
1008 } 1010 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698