| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 , m_client(client) | 57 , m_client(client) |
| 58 , m_popup(0) | 58 , m_popup(0) |
| 59 , m_parameters(parameters) | 59 , m_parameters(parameters) |
| 60 , m_locale(WebCore::Locale::createDefault()) | 60 , m_locale(WebCore::Locale::createDefault()) |
| 61 { | 61 { |
| 62 ASSERT(m_chromeClient); | 62 ASSERT(m_chromeClient); |
| 63 ASSERT(m_client); | 63 ASSERT(m_client); |
| 64 m_popup = m_chromeClient->openPagePopup(this, m_parameters.anchorRectInRootV
iew); | 64 m_popup = m_chromeClient->openPagePopup(this, m_parameters.anchorRectInRootV
iew); |
| 65 } | 65 } |
| 66 | 66 |
| 67 PassRefPtr<DateTimeChooserImpl> DateTimeChooserImpl::create(ChromeClientImpl* ch
romeClient, WebCore::DateTimeChooserClient* client, const WebCore::DateTimeChoos
erParameters& parameters) |
| 68 { |
| 69 return adoptRef(new DateTimeChooserImpl(chromeClient, client, parameters)); |
| 70 } |
| 71 |
| 67 DateTimeChooserImpl::~DateTimeChooserImpl() | 72 DateTimeChooserImpl::~DateTimeChooserImpl() |
| 68 { | 73 { |
| 69 } | 74 } |
| 70 | 75 |
| 71 void DateTimeChooserImpl::endChooser() | 76 void DateTimeChooserImpl::endChooser() |
| 72 { | 77 { |
| 73 if (!m_popup) | 78 if (!m_popup) |
| 74 return; | 79 return; |
| 75 m_chromeClient->closePagePopup(m_popup); | 80 m_chromeClient->closePagePopup(m_popup); |
| 76 } | 81 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 addString("</script></body>\n", writer); | 148 addString("</script></body>\n", writer); |
| 144 } | 149 } |
| 145 | 150 |
| 146 WebCore::Locale& DateTimeChooserImpl::locale() | 151 WebCore::Locale& DateTimeChooserImpl::locale() |
| 147 { | 152 { |
| 148 return *m_locale; | 153 return *m_locale; |
| 149 } | 154 } |
| 150 | 155 |
| 151 void DateTimeChooserImpl::setValueAndClosePopup(int numValue, const String& stri
ngValue) | 156 void DateTimeChooserImpl::setValueAndClosePopup(int numValue, const String& stri
ngValue) |
| 152 { | 157 { |
| 158 RefPtr<DateTimeChooserImpl> protector(this); |
| 153 if (numValue >= 0) | 159 if (numValue >= 0) |
| 154 m_client->didChooseValue(stringValue); | 160 m_client->didChooseValue(stringValue); |
| 155 endChooser(); | 161 endChooser(); |
| 156 } | 162 } |
| 157 | 163 |
| 158 void DateTimeChooserImpl::didClosePopup() | 164 void DateTimeChooserImpl::didClosePopup() |
| 159 { | 165 { |
| 160 ASSERT(m_client); | 166 ASSERT(m_client); |
| 161 m_popup = 0; | 167 m_popup = 0; |
| 162 m_client->didEndChooser(); | 168 m_client->didEndChooser(); |
| 163 } | 169 } |
| 164 | 170 |
| 165 } // namespace WebKit | 171 } // namespace WebKit |
| 166 | 172 |
| 167 #endif // ENABLE(CALENDAR_PICKER) | 173 #endif // ENABLE(CALENDAR_PICKER) |
| OLD | NEW |