| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 String PagePopupController::localizeNumberString(const String& numberString) { | 74 String PagePopupController::localizeNumberString(const String& numberString) { |
| 75 if (m_popupClient) | 75 if (m_popupClient) |
| 76 return m_popupClient->locale().convertToLocalizedNumber(numberString); | 76 return m_popupClient->locale().convertToLocalizedNumber(numberString); |
| 77 return numberString; | 77 return numberString; |
| 78 } | 78 } |
| 79 | 79 |
| 80 String PagePopupController::formatMonth(int year, int zeroBaseMonth) { | 80 String PagePopupController::formatMonth(int year, int zeroBaseMonth) { |
| 81 if (!m_popupClient) | 81 if (!m_popupClient) |
| 82 return emptyString(); | 82 return emptyString; |
| 83 DateComponents date; | 83 DateComponents date; |
| 84 date.setMonthsSinceEpoch((year - 1970) * 12.0 + zeroBaseMonth); | 84 date.setMonthsSinceEpoch((year - 1970) * 12.0 + zeroBaseMonth); |
| 85 return m_popupClient->locale().formatDateTime(date, Locale::FormatTypeMedium); | 85 return m_popupClient->locale().formatDateTime(date, Locale::FormatTypeMedium); |
| 86 } | 86 } |
| 87 | 87 |
| 88 String PagePopupController::formatShortMonth(int year, int zeroBaseMonth) { | 88 String PagePopupController::formatShortMonth(int year, int zeroBaseMonth) { |
| 89 if (!m_popupClient) | 89 if (!m_popupClient) |
| 90 return emptyString(); | 90 return emptyString; |
| 91 DateComponents date; | 91 DateComponents date; |
| 92 date.setMonthsSinceEpoch((year - 1970) * 12.0 + zeroBaseMonth); | 92 date.setMonthsSinceEpoch((year - 1970) * 12.0 + zeroBaseMonth); |
| 93 return m_popupClient->locale().formatDateTime(date, Locale::FormatTypeShort); | 93 return m_popupClient->locale().formatDateTime(date, Locale::FormatTypeShort); |
| 94 } | 94 } |
| 95 | 95 |
| 96 String PagePopupController::formatWeek(int year, | 96 String PagePopupController::formatWeek(int year, |
| 97 int weekNumber, | 97 int weekNumber, |
| 98 const String& localizedDateString) { | 98 const String& localizedDateString) { |
| 99 if (!m_popupClient) | 99 if (!m_popupClient) |
| 100 return emptyString(); | 100 return emptyString; |
| 101 DateComponents week; | 101 DateComponents week; |
| 102 bool setWeekResult = week.setWeek(year, weekNumber); | 102 bool setWeekResult = week.setWeek(year, weekNumber); |
| 103 DCHECK(setWeekResult); | 103 DCHECK(setWeekResult); |
| 104 String localizedWeek = m_popupClient->locale().formatDateTime(week); | 104 String localizedWeek = m_popupClient->locale().formatDateTime(week); |
| 105 return m_popupClient->locale().queryString( | 105 return m_popupClient->locale().queryString( |
| 106 WebLocalizedString::AXCalendarWeekDescription, localizedWeek, | 106 WebLocalizedString::AXCalendarWeekDescription, localizedWeek, |
| 107 localizedDateString); | 107 localizedDateString); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void PagePopupController::clearPagePopupClient() { | 110 void PagePopupController::clearPagePopupClient() { |
| 111 m_popupClient = nullptr; | 111 m_popupClient = nullptr; |
| 112 } | 112 } |
| 113 | 113 |
| 114 void PagePopupController::setWindowRect(int x, int y, int width, int height) { | 114 void PagePopupController::setWindowRect(int x, int y, int width, int height) { |
| 115 m_popup.setWindowRect(IntRect(x, y, width, height)); | 115 m_popup.setWindowRect(IntRect(x, y, width, height)); |
| 116 } | 116 } |
| 117 | 117 |
| 118 } // namespace blink | 118 } // namespace blink |
| OLD | NEW |