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

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

Issue 1073005: Move RTL related functions from app/l10n_util to base/i18n/rtl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/gfx/canvas.h" 9 #include "app/gfx/canvas.h"
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
11 #include "app/resource_bundle.h" 11 #include "app/resource_bundle.h"
12 #include "app/text_elider.h" 12 #include "app/text_elider.h"
13 #include "app/theme_provider.h" 13 #include "app/theme_provider.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/i18n/rtl.h"
16 #include "base/string_util.h" 17 #include "base/string_util.h"
17 #include "base/sys_string_conversions.h" 18 #include "base/sys_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/color_utils.h" 24 #include "gfx/color_utils.h"
24 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
25 #include "grit/theme_resources.h" 26 #include "grit/theme_resources.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 84 }
84 85
85 void Run(const gfx::Point& point) { 86 void Run(const gfx::Point& point) {
86 if (download_->state() == DownloadItem::COMPLETE) 87 if (download_->state() == DownloadItem::COMPLETE)
87 menu_.reset(new views::Menu2(GetFinishedMenuModel())); 88 menu_.reset(new views::Menu2(GetFinishedMenuModel()));
88 else 89 else
89 menu_.reset(new views::Menu2(GetInProgressMenuModel())); 90 menu_.reset(new views::Menu2(GetInProgressMenuModel()));
90 91
91 // The menu's alignment is determined based on the UI layout. 92 // The menu's alignment is determined based on the UI layout.
92 views::Menu2::Alignment alignment; 93 views::Menu2::Alignment alignment;
93 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) 94 if (base::i18n::IsRTL())
94 alignment = views::Menu2::ALIGN_TOPRIGHT; 95 alignment = views::Menu2::ALIGN_TOPRIGHT;
95 else 96 else
96 alignment = views::Menu2::ALIGN_TOPLEFT; 97 alignment = views::Menu2::ALIGN_TOPLEFT;
97 menu_->RunMenuAt(point, alignment); 98 menu_->RunMenuAt(point, alignment);
98 } 99 }
99 100
100 // This method runs when the caller has been deleted and we should not attempt 101 // This method runs when the caller has been deleted and we should not attempt
101 // to access |download_|. 102 // to access |download_|.
102 void Stop() { 103 void Stop() {
103 download_ = NULL; 104 download_ = NULL;
(...skipping 174 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 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) 289 if (base::i18n::IsRTL())
289 l10n_util::WrapStringWithLTRFormatting(&filename); 290 base::i18n::WrapStringWithLTRFormatting(&filename);
290 dangerous_download_label_ = new views::Label( 291 dangerous_download_label_ = new views::Label(
291 l10n_util::GetStringF(IDS_PROMPT_DANGEROUS_DOWNLOAD, filename)); 292 l10n_util::GetStringF(IDS_PROMPT_DANGEROUS_DOWNLOAD, filename));
292 } 293 }
293 dangerous_download_label_->SetMultiLine(true); 294 dangerous_download_label_->SetMultiLine(true);
294 dangerous_download_label_->SetHorizontalAlignment( 295 dangerous_download_label_->SetHorizontalAlignment(
295 views::Label::ALIGN_LEFT); 296 views::Label::ALIGN_LEFT);
296 AddChildView(dangerous_download_label_); 297 AddChildView(dangerous_download_label_);
297 SizeLabelToMinWidth(); 298 SizeLabelToMinWidth();
298 } 299 }
299 300
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 void DownloadItemView::Reenable() { 996 void DownloadItemView::Reenable() {
996 disabled_while_opening_ = false; 997 disabled_while_opening_ = false;
997 SetEnabled(true); // Triggers a repaint. 998 SetEnabled(true); // Triggers a repaint.
998 } 999 }
999 1000
1000 bool DownloadItemView::InDropDownButtonXCoordinateRange(int x) { 1001 bool DownloadItemView::InDropDownButtonXCoordinateRange(int x) {
1001 if (x > drop_down_x_left_ && x < drop_down_x_right_) 1002 if (x > drop_down_x_left_ && x < drop_down_x_right_)
1002 return true; 1003 return true;
1003 return false; 1004 return false;
1004 } 1005 }
OLDNEW
« no previous file with comments | « chrome/browser/views/bookmark_context_menu.cc ('k') | chrome/browser/views/edit_search_engine_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698