| OLD | NEW |
| 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 #import "chrome/browser/cocoa/location_bar_view_mac.h" | 5 #import "chrome/browser/cocoa/location_bar_view_mac.h" |
| 6 | 6 |
| 7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/i18n/rtl.h" |
| 9 #include "base/nsimage_cache_mac.h" | 10 #include "base/nsimage_cache_mac.h" |
| 10 #include "base/stl_util-inl.h" | 11 #include "base/stl_util-inl.h" |
| 11 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 12 #include "base/sys_string_conversions.h" | 13 #include "base/sys_string_conversions.h" |
| 13 #include "chrome/app/chrome_dll_resource.h" | 14 #include "chrome/app/chrome_dll_resource.h" |
| 14 #include "chrome/browser/alternate_nav_url_fetcher.h" | 15 #include "chrome/browser/alternate_nav_url_fetcher.h" |
| 15 #import "chrome/browser/app_controller_mac.h" | 16 #import "chrome/browser/app_controller_mac.h" |
| 16 #import "chrome/browser/autocomplete/autocomplete_edit_view_mac.h" | 17 #import "chrome/browser/autocomplete/autocomplete_edit_view_mac.h" |
| 17 #include "chrome/browser/browser_list.h" | 18 #include "chrome/browser/browser_list.h" |
| 18 #import "chrome/browser/cocoa/autocomplete_text_field.h" | 19 #import "chrome/browser/cocoa/autocomplete_text_field.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 const size_t dot_index = description.find(L'.'); | 76 const size_t dot_index = description.find(L'.'); |
| 76 const size_t ws_index = description.find_first_of(kWhitespaceWide); | 77 const size_t ws_index = description.find_first_of(kWhitespaceWide); |
| 77 size_t chop_index = std::min(dot_index, ws_index); | 78 size_t chop_index = std::min(dot_index, ws_index); |
| 78 std::wstring min_string; | 79 std::wstring min_string; |
| 79 if (chop_index == std::wstring::npos) { | 80 if (chop_index == std::wstring::npos) { |
| 80 // No dot or whitespace, truncate to at most 3 chars. | 81 // No dot or whitespace, truncate to at most 3 chars. |
| 81 min_string = l10n_util::TruncateString(description, 3); | 82 min_string = l10n_util::TruncateString(description, 3); |
| 82 } else { | 83 } else { |
| 83 min_string = description.substr(0, chop_index); | 84 min_string = description.substr(0, chop_index); |
| 84 } | 85 } |
| 85 l10n_util::AdjustStringForLocaleDirection(min_string, &min_string); | 86 base::i18n::AdjustStringForLocaleDirection(min_string, &min_string); |
| 86 return min_string; | 87 return min_string; |
| 87 } | 88 } |
| 88 | 89 |
| 89 } // namespace | 90 } // namespace |
| 90 | 91 |
| 91 LocationBarViewMac::LocationBarViewMac( | 92 LocationBarViewMac::LocationBarViewMac( |
| 92 AutocompleteTextField* field, | 93 AutocompleteTextField* field, |
| 93 const BubblePositioner* bubble_positioner, | 94 const BubblePositioner* bubble_positioner, |
| 94 CommandUpdater* command_updater, | 95 CommandUpdater* command_updater, |
| 95 ToolbarModel* toolbar_model, | 96 ToolbarModel* toolbar_model, |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 ++result; | 951 ++result; |
| 951 } | 952 } |
| 952 return result; | 953 return result; |
| 953 } | 954 } |
| 954 | 955 |
| 955 void LocationBarViewMac::PageActionViewList::OnMousePressed(NSRect iconFrame, | 956 void LocationBarViewMac::PageActionViewList::OnMousePressed(NSRect iconFrame, |
| 956 size_t index) { | 957 size_t index) { |
| 957 ViewAt(index)->OnMousePressed(iconFrame); | 958 ViewAt(index)->OnMousePressed(iconFrame); |
| 958 } | 959 } |
| 959 | 960 |
| OLD | NEW |