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 29 matching lines...) Expand all Loading... |
40 namespace WebKit { | 40 namespace WebKit { |
41 | 41 |
42 class WebDateTimeChooserCompletionImpl : public WebDateTimeChooserCompletion { | 42 class WebDateTimeChooserCompletionImpl : public WebDateTimeChooserCompletion { |
43 public: | 43 public: |
44 WebDateTimeChooserCompletionImpl(ExternalDateTimeChooser* chooser) | 44 WebDateTimeChooserCompletionImpl(ExternalDateTimeChooser* chooser) |
45 : m_chooser(chooser) | 45 : m_chooser(chooser) |
46 { | 46 { |
47 } | 47 } |
48 | 48 |
49 private: | 49 private: |
50 virtual void didChooseValue(const WebString& value) OVERRIDE | 50 virtual void didChooseValue(double 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 didCancelChooser() OVERRIDE | 56 virtual void didCancelChooser() OVERRIDE |
57 { | 57 { |
58 m_chooser->didCancelChooser(); | 58 m_chooser->didCancelChooser(); |
59 delete this; | 59 delete this; |
60 } | 60 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 bool ExternalDateTimeChooser::openDateTimeChooser(ChromeClientImpl* chromeClient
, WebViewClient* webViewClient, const DateTimeChooserParameters& parameters) | 102 bool ExternalDateTimeChooser::openDateTimeChooser(ChromeClientImpl* chromeClient
, WebViewClient* webViewClient, const DateTimeChooserParameters& parameters) |
103 { | 103 { |
104 if (!webViewClient) | 104 if (!webViewClient) |
105 return false; | 105 return false; |
106 | 106 |
107 WebDateTimeChooserParams webParams; | 107 WebDateTimeChooserParams webParams; |
108 webParams.type = toWebDateTimeInputType(parameters.type); | 108 webParams.type = toWebDateTimeInputType(parameters.type); |
109 webParams.anchorRectInScreen = chromeClient->rootViewToScreen(parameters.anc
horRectInRootView); | 109 webParams.anchorRectInScreen = chromeClient->rootViewToScreen(parameters.anc
horRectInRootView); |
110 webParams.currentValue = parameters.currentValue; | 110 webParams.currentValue = parameters.currentValue; |
111 webParams.suggestionValues = parameters.suggestionValues; | 111 webParams.suggestions = parameters.suggestions; |
112 webParams.localizedSuggestionValues = parameters.localizedSuggestionValues; | |
113 webParams.suggestionLabels = parameters.suggestionLabels; | |
114 webParams.minimum = parameters.minimum; | 112 webParams.minimum = parameters.minimum; |
115 webParams.maximum = parameters.maximum; | 113 webParams.maximum = parameters.maximum; |
116 webParams.step = parameters.step; | 114 webParams.step = parameters.step; |
117 webParams.stepBase = parameters.stepBase; | 115 webParams.stepBase = parameters.stepBase; |
118 webParams.isRequired = parameters.required; | 116 webParams.isRequired = parameters.required; |
119 webParams.isAnchorElementRTL = parameters.isAnchorElementRTL; | 117 webParams.isAnchorElementRTL = parameters.isAnchorElementRTL; |
120 | 118 |
121 WebDateTimeChooserCompletion* completion = new WebDateTimeChooserCompletionI
mpl(this); | 119 WebDateTimeChooserCompletion* completion = new WebDateTimeChooserCompletionI
mpl(this); |
122 if (webViewClient->openDateTimeChooser(webParams, completion)) | 120 if (webViewClient->openDateTimeChooser(webParams, completion)) |
123 return true; | 121 return true; |
124 // We can't open a chooser. Calling | 122 // We can't open a chooser. Calling |
125 // WebDateTimeChooserCompletionImpl::didCancelChooser to delete the | 123 // WebDateTimeChooserCompletionImpl::didCancelChooser to delete the |
126 // WebDateTimeChooserCompletionImpl object and deref this. | 124 // WebDateTimeChooserCompletionImpl object and deref this. |
127 completion->didCancelChooser(); | 125 completion->didCancelChooser(); |
128 return false; | 126 return false; |
129 } | 127 } |
130 | 128 |
131 void ExternalDateTimeChooser::didChooseValue(const WebString& value) | 129 void ExternalDateTimeChooser::didChooseValue(double value) |
132 { | 130 { |
133 if (m_client) | 131 if (m_client) |
134 m_client->didChooseValue(value); | 132 m_client->didChooseValue(value); |
135 // didChooseValue might run JavaScript code, and endChooser() might be | 133 // didChooseValue might run JavaScript code, and endChooser() might be |
136 // called. However DateTimeChooserCompletionImpl still has one reference to | 134 // called. However DateTimeChooserCompletionImpl still has one reference to |
137 // this object. | 135 // this object. |
138 if (m_client) | 136 if (m_client) |
139 m_client->didEndChooser(); | 137 m_client->didEndChooser(); |
140 } | 138 } |
141 | 139 |
142 void ExternalDateTimeChooser::didCancelChooser() | 140 void ExternalDateTimeChooser::didCancelChooser() |
143 { | 141 { |
144 if (m_client) | 142 if (m_client) |
145 m_client->didEndChooser(); | 143 m_client->didEndChooser(); |
146 } | 144 } |
147 | 145 |
148 void ExternalDateTimeChooser::endChooser() | 146 void ExternalDateTimeChooser::endChooser() |
149 { | 147 { |
150 DateTimeChooserClient* client = m_client; | 148 DateTimeChooserClient* client = m_client; |
151 m_client = 0; | 149 m_client = 0; |
152 client->didEndChooser(); | 150 client->didEndChooser(); |
153 } | 151 } |
154 | 152 |
155 } | 153 } |
156 | 154 |
157 #endif | 155 #endif |
OLD | NEW |