OLD | NEW |
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 #import "chrome/browser/ui/cocoa/about_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/about_window_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 AttributedStringAppendString(legal_block, sub_str); | 726 AttributedStringAppendString(legal_block, sub_str); |
727 | 727 |
728 #if defined(GOOGLE_CHROME_BUILD) | 728 #if defined(GOOGLE_CHROME_BUILD) |
729 // Terms of service is only valid for Google Chrome | 729 // Terms of service is only valid for Google Chrome |
730 | 730 |
731 // The url within terms should point here: | 731 // The url within terms should point here: |
732 NSString* kTOS = [NSString stringWithUTF8String:chrome::kChromeUITermsURL]; | 732 NSString* kTOS = [NSString stringWithUTF8String:chrome::kChromeUITermsURL]; |
733 // Following Windows. There is one marker in the string for where the terms | 733 // Following Windows. There is one marker in the string for where the terms |
734 // link goes, but the text of the link comes from a second string resources. | 734 // link goes, but the text of the link comes from a second string resources. |
735 std::vector<size_t> url_offsets; | 735 std::vector<size_t> url_offsets; |
736 NSString* about_terms = l10n_util::GetNSStringF(IDS_ABOUT_TERMS_OF_SERVICE, | 736 NSString* about_terms = l10n_util::GetNSStringF( |
737 string16(), | 737 IDS_ABOUT_OLD_TERMS_OF_SERVICE, |
738 string16(), | 738 string16(), |
739 &url_offsets); | 739 string16(), |
| 740 &url_offsets); |
740 DCHECK_EQ(url_offsets.size(), 1U); | 741 DCHECK_EQ(url_offsets.size(), 1U); |
741 NSString* terms_link_text = | 742 NSString* terms_link_text = |
742 l10n_util::GetNSStringWithFixup(IDS_TERMS_OF_SERVICE); | 743 l10n_util::GetNSStringWithFixup(IDS_TERMS_OF_SERVICE); |
743 | 744 |
744 AttributedStringAppendString(legal_block, @"\n\n"); | 745 AttributedStringAppendString(legal_block, @"\n\n"); |
745 sub_str = [about_terms substringToIndex:url_offsets[0]]; | 746 sub_str = [about_terms substringToIndex:url_offsets[0]]; |
746 AttributedStringAppendString(legal_block, sub_str); | 747 AttributedStringAppendString(legal_block, sub_str); |
747 AttributedStringAppendHyperlink(legal_block, terms_link_text, kTOS); | 748 AttributedStringAppendHyperlink(legal_block, terms_link_text, kTOS); |
748 sub_str = [about_terms substringFromIndex:url_offsets[0]]; | 749 sub_str = [about_terms substringFromIndex:url_offsets[0]]; |
749 AttributedStringAppendString(legal_block, sub_str); | 750 AttributedStringAppendString(legal_block, sub_str); |
750 #endif // GOOGLE_CHROME_BUILD | 751 #endif // GOOGLE_CHROME_BUILD |
751 | 752 |
752 // We need to explicitly select Lucida Grande because once we click on | 753 // We need to explicitly select Lucida Grande because once we click on |
753 // the NSTextView, it changes to Helvetica 12 otherwise. | 754 // the NSTextView, it changes to Helvetica 12 otherwise. |
754 NSRange string_range = NSMakeRange(0, [legal_block length]); | 755 NSRange string_range = NSMakeRange(0, [legal_block length]); |
755 [legal_block addAttribute:NSFontAttributeName | 756 [legal_block addAttribute:NSFontAttributeName |
756 value:[NSFont labelFontOfSize:11] | 757 value:[NSFont labelFontOfSize:11] |
757 range:string_range]; | 758 range:string_range]; |
758 | 759 |
759 [legal_block endEditing]; | 760 [legal_block endEditing]; |
760 return legal_block; | 761 return legal_block; |
761 } | 762 } |
762 | 763 |
763 @end // @implementation AboutWindowController | 764 @end // @implementation AboutWindowController |
OLD | NEW |