| 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 { | 46 { |
| 47 } | 47 } |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 virtual void didChooseValue(const WebString& value) OVERRIDE | 50 virtual void didChooseValue(const WebString& value) OVERRIDE |
| 51 { | 51 { |
| 52 m_chooser->didChooseValue(value); | 52 m_chooser->didChooseValue(value); |
| 53 delete this; | 53 delete this; |
| 54 } | 54 } |
| 55 | 55 |
| 56 virtual void didChooseValue(double value) OVERRIDE |
| 57 { |
| 58 m_chooser->didChooseValue(value); |
| 59 delete this; |
| 60 } |
| 61 |
| 56 virtual void didCancelChooser() OVERRIDE | 62 virtual void didCancelChooser() OVERRIDE |
| 57 { | 63 { |
| 58 m_chooser->didCancelChooser(); | 64 m_chooser->didCancelChooser(); |
| 59 delete this; | 65 delete this; |
| 60 } | 66 } |
| 61 | 67 |
| 62 RefPtr<ExternalDateTimeChooser> m_chooser; | 68 RefPtr<ExternalDateTimeChooser> m_chooser; |
| 63 }; | 69 }; |
| 64 | 70 |
| 65 ExternalDateTimeChooser::~ExternalDateTimeChooser() | 71 ExternalDateTimeChooser::~ExternalDateTimeChooser() |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 107 |
| 102 bool ExternalDateTimeChooser::openDateTimeChooser(ChromeClientImpl* chromeClient
, WebViewClient* webViewClient, const DateTimeChooserParameters& parameters) | 108 bool ExternalDateTimeChooser::openDateTimeChooser(ChromeClientImpl* chromeClient
, WebViewClient* webViewClient, const DateTimeChooserParameters& parameters) |
| 103 { | 109 { |
| 104 if (!webViewClient) | 110 if (!webViewClient) |
| 105 return false; | 111 return false; |
| 106 | 112 |
| 107 WebDateTimeChooserParams webParams; | 113 WebDateTimeChooserParams webParams; |
| 108 webParams.type = toWebDateTimeInputType(parameters.type); | 114 webParams.type = toWebDateTimeInputType(parameters.type); |
| 109 webParams.anchorRectInScreen = chromeClient->rootViewToScreen(parameters.anc
horRectInRootView); | 115 webParams.anchorRectInScreen = chromeClient->rootViewToScreen(parameters.anc
horRectInRootView); |
| 110 webParams.currentValue = parameters.currentValue; | 116 webParams.currentValue = parameters.currentValue; |
| 117 webParams.doubleValue = parameters.doubleValue; |
| 111 webParams.suggestionValues = parameters.suggestionValues; | 118 webParams.suggestionValues = parameters.suggestionValues; |
| 112 webParams.localizedSuggestionValues = parameters.localizedSuggestionValues; | 119 webParams.localizedSuggestionValues = parameters.localizedSuggestionValues; |
| 113 webParams.suggestionLabels = parameters.suggestionLabels; | 120 webParams.suggestionLabels = parameters.suggestionLabels; |
| 114 webParams.minimum = parameters.minimum; | 121 webParams.minimum = parameters.minimum; |
| 115 webParams.maximum = parameters.maximum; | 122 webParams.maximum = parameters.maximum; |
| 116 webParams.step = parameters.step; | 123 webParams.step = parameters.step; |
| 117 webParams.stepBase = parameters.stepBase; | 124 webParams.stepBase = parameters.stepBase; |
| 118 webParams.isRequired = parameters.required; | 125 webParams.isRequired = parameters.required; |
| 119 webParams.isAnchorElementRTL = parameters.isAnchorElementRTL; | 126 webParams.isAnchorElementRTL = parameters.isAnchorElementRTL; |
| 120 | 127 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 132 { | 139 { |
| 133 if (m_client) | 140 if (m_client) |
| 134 m_client->didChooseValue(value); | 141 m_client->didChooseValue(value); |
| 135 // didChooseValue might run JavaScript code, and endChooser() might be | 142 // didChooseValue might run JavaScript code, and endChooser() might be |
| 136 // called. However DateTimeChooserCompletionImpl still has one reference to | 143 // called. However DateTimeChooserCompletionImpl still has one reference to |
| 137 // this object. | 144 // this object. |
| 138 if (m_client) | 145 if (m_client) |
| 139 m_client->didEndChooser(); | 146 m_client->didEndChooser(); |
| 140 } | 147 } |
| 141 | 148 |
| 149 void ExternalDateTimeChooser::didChooseValue(double value) |
| 150 { |
| 151 if (m_client) |
| 152 m_client->didChooseValue(value); |
| 153 // didChooseValue might run JavaScript code, and endChooser() might be |
| 154 // called. However DateTimeChooserCompletionImpl still has one reference to |
| 155 // this object. |
| 156 if (m_client) |
| 157 m_client->didEndChooser(); |
| 158 } |
| 159 |
| 142 void ExternalDateTimeChooser::didCancelChooser() | 160 void ExternalDateTimeChooser::didCancelChooser() |
| 143 { | 161 { |
| 144 if (m_client) | 162 if (m_client) |
| 145 m_client->didEndChooser(); | 163 m_client->didEndChooser(); |
| 146 } | 164 } |
| 147 | 165 |
| 148 void ExternalDateTimeChooser::endChooser() | 166 void ExternalDateTimeChooser::endChooser() |
| 149 { | 167 { |
| 150 DateTimeChooserClient* client = m_client; | 168 DateTimeChooserClient* client = m_client; |
| 151 m_client = 0; | 169 m_client = 0; |
| 152 client->didEndChooser(); | 170 client->didEndChooser(); |
| 153 } | 171 } |
| 154 | 172 |
| 155 } | 173 } |
| 156 | 174 |
| 157 #endif | 175 #endif |
| OLD | NEW |