OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/login/wizard_accessibility_handler.h" | 5 #include "chrome/browser/chromeos/login/wizard_accessibility_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/char_iterator.h" | 9 #include "base/i18n/char_iterator.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 old_indices[prefix_char_len], | 423 old_indices[prefix_char_len], |
424 old_indices[old_suffix_char_start] - old_indices[prefix_char_len]); | 424 old_indices[old_suffix_char_start] - old_indices[prefix_char_len]); |
425 | 425 |
426 // Find the substring that was inserted (if any) to get the new string | 426 // Find the substring that was inserted (if any) to get the new string |
427 // from the old - it's the part in the middle of the new string if you | 427 // from the old - it's the part in the middle of the new string if you |
428 // remove the common prefix and suffix. | 428 // remove the common prefix and suffix. |
429 std::string inserted = new_value.substr( | 429 std::string inserted = new_value.substr( |
430 new_indices[prefix_char_len], | 430 new_indices[prefix_char_len], |
431 new_indices[new_suffix_char_start] - new_indices[prefix_char_len]); | 431 new_indices[new_suffix_char_start] - new_indices[prefix_char_len]); |
432 | 432 |
433 if (inserted.size() > 0 && deleted.size() > 0) { | 433 if (!inserted.empty() && !deleted.empty()) { |
434 // Replace one substring with another, speak inserted text. | 434 // Replace one substring with another, speak inserted text. |
435 AppendUtterance(inserted, out_spoken_description); | 435 AppendUtterance(inserted, out_spoken_description); |
436 } else if (inserted.size() > 0) { | 436 } else if (!inserted.empty()) { |
437 // Speak inserted text. | 437 // Speak inserted text. |
438 AppendUtterance(inserted, out_spoken_description); | 438 AppendUtterance(inserted, out_spoken_description); |
439 } else if (deleted.size() > 0) { | 439 } else if (!deleted.empty()) { |
440 // Speak deleted text. | 440 // Speak deleted text. |
441 AppendUtterance(deleted, out_spoken_description); | 441 AppendUtterance(deleted, out_spoken_description); |
442 } | 442 } |
443 } | 443 } |
444 | 444 |
445 } // namespace chromeos | 445 } // namespace chromeos |
OLD | NEW |