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

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

Issue 113403006: Update some uses of char16 to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/views/download/download_item_view.h" 5 #include "chrome/browser/ui/views/download/download_item_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 // a short string (e.g.: "This file is malicious") from being broken up 1236 // a short string (e.g.: "This file is malicious") from being broken up
1237 // unnecessarily. 1237 // unnecessarily.
1238 while (iter.Advance() && min_width > kDangerousTextWidth) { 1238 while (iter.Advance() && min_width > kDangerousTextWidth) {
1239 size_t pos = iter.pos(); 1239 size_t pos = iter.pos();
1240 if (pos >= original_text.length()) 1240 if (pos >= original_text.length())
1241 break; 1241 break;
1242 base::string16 current_text = original_text; 1242 base::string16 current_text = original_text;
1243 // This can be a low surrogate codepoint, but u_isUWhiteSpace will 1243 // This can be a low surrogate codepoint, but u_isUWhiteSpace will
1244 // return false and inserting a new line after a surrogate pair 1244 // return false and inserting a new line after a surrogate pair
1245 // is perfectly ok. 1245 // is perfectly ok.
1246 char16 line_end_char = current_text[pos - 1]; 1246 base::char16 line_end_char = current_text[pos - 1];
1247 if (u_isUWhiteSpace(line_end_char)) 1247 if (u_isUWhiteSpace(line_end_char))
1248 current_text.replace(pos - 1, 1, 1, char16('\n')); 1248 current_text.replace(pos - 1, 1, 1, base::char16('\n'));
1249 else 1249 else
1250 current_text.insert(pos, 1, char16('\n')); 1250 current_text.insert(pos, 1, base::char16('\n'));
1251 dangerous_download_label_->SetText(current_text); 1251 dangerous_download_label_->SetText(current_text);
1252 size = dangerous_download_label_->GetPreferredSize(); 1252 size = dangerous_download_label_->GetPreferredSize();
1253 1253
1254 // If the width is growing again, it means we passed the optimal width spot. 1254 // If the width is growing again, it means we passed the optimal width spot.
1255 if (size.width() > min_width) { 1255 if (size.width() > min_width) {
1256 dangerous_download_label_->SetText(prev_text); 1256 dangerous_download_label_->SetText(prev_text);
1257 break; 1257 break;
1258 } else { 1258 } else {
1259 min_width = size.width(); 1259 min_width = size.width();
1260 } 1260 }
(...skipping 18 matching lines...) Expand all
1279 if (x > drop_down_x_left_ && x < drop_down_x_right_) 1279 if (x > drop_down_x_left_ && x < drop_down_x_right_)
1280 return true; 1280 return true;
1281 return false; 1281 return false;
1282 } 1282 }
1283 1283
1284 void DownloadItemView::UpdateAccessibleName() { 1284 void DownloadItemView::UpdateAccessibleName() {
1285 base::string16 new_name; 1285 base::string16 new_name;
1286 if (IsShowingWarningDialog()) { 1286 if (IsShowingWarningDialog()) {
1287 new_name = dangerous_download_label_->text(); 1287 new_name = dangerous_download_label_->text();
1288 } else { 1288 } else {
1289 new_name = status_text_ + char16(' ') + 1289 new_name = status_text_ + base::char16(' ') +
1290 download()->GetFileNameToReportUser().LossyDisplayName(); 1290 download()->GetFileNameToReportUser().LossyDisplayName();
1291 } 1291 }
1292 1292
1293 // If the name has changed, notify assistive technology that the name 1293 // If the name has changed, notify assistive technology that the name
1294 // has changed so they can announce it immediately. 1294 // has changed so they can announce it immediately.
1295 if (new_name != accessible_name_) { 1295 if (new_name != accessible_name_) {
1296 accessible_name_ = new_name; 1296 accessible_name_ = new_name;
1297 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_NAME_CHANGED, true); 1297 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_NAME_CHANGED, true);
1298 } 1298 }
1299 } 1299 }
(...skipping 15 matching lines...) Expand all
1315 void DownloadItemView::AnimateStateTransition(State from, State to, 1315 void DownloadItemView::AnimateStateTransition(State from, State to,
1316 gfx::SlideAnimation* animation) { 1316 gfx::SlideAnimation* animation) {
1317 if (from == NORMAL && to == HOT) { 1317 if (from == NORMAL && to == HOT) {
1318 animation->Show(); 1318 animation->Show();
1319 } else if (from == HOT && to == NORMAL) { 1319 } else if (from == HOT && to == NORMAL) {
1320 animation->Hide(); 1320 animation->Hide();
1321 } else if (from != to) { 1321 } else if (from != to) {
1322 animation->Reset((to == HOT) ? 1.0 : 0.0); 1322 animation->Reset((to == HOT) ? 1.0 : 0.0);
1323 } 1323 }
1324 } 1324 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698