| 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 m_chooser->endChooser(); | 73 m_chooser->endChooser(); |
| 74 if (m_popup) | 74 if (m_popup) |
| 75 closePopup(); | 75 closePopup(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 IntSize ColorChooserPopupUIController::contentSize() | 78 IntSize ColorChooserPopupUIController::contentSize() |
| 79 { | 79 { |
| 80 return IntSize(0, 0); | 80 return IntSize(0, 0); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void ColorChooserPopupUIController::writeDocument(DocumentWriter& writer) | 83 void ColorChooserPopupUIController::writeDocument(SharedBuffer* data) |
| 84 { | 84 { |
| 85 Vector<ColorSuggestion> suggestions = m_client->suggestions(); | 85 Vector<ColorSuggestion> suggestions = m_client->suggestions(); |
| 86 Vector<String> suggestionValues; | 86 Vector<String> suggestionValues; |
| 87 for (unsigned i = 0; i < suggestions.size(); i++) | 87 for (unsigned i = 0; i < suggestions.size(); i++) |
| 88 suggestionValues.append(suggestions[i].color.serialized()); | 88 suggestionValues.append(suggestions[i].color.serialized()); |
| 89 IntRect anchorRectInScreen = m_chromeClient->rootViewToScreen(m_client->elem
entRectRelativeToRootView()); | 89 IntRect anchorRectInScreen = m_chromeClient->rootViewToScreen(m_client->elem
entRectRelativeToRootView()); |
| 90 | 90 |
| 91 PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><styl
e>\n", writer); | 91 PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><styl
e>\n", data); |
| 92 writer.addData(pickerCommonCss, sizeof(pickerCommonCss)); | 92 data->append(pickerCommonCss, sizeof(pickerCommonCss)); |
| 93 writer.addData(colorSuggestionPickerCss, sizeof(colorSuggestionPickerCss)); | 93 data->append(colorSuggestionPickerCss, sizeof(colorSuggestionPickerCss)); |
| 94 PagePopupClient::addString("</style></head><body><div id=main>Loading...</di
v><script>\n" | 94 PagePopupClient::addString("</style></head><body><div id=main>Loading...</di
v><script>\n" |
| 95 "window.dialogArguments = {\n", writer); | 95 "window.dialogArguments = {\n", data); |
| 96 PagePopupClient::addProperty("values", suggestionValues, writer); | 96 PagePopupClient::addProperty("values", suggestionValues, data); |
| 97 PagePopupClient::addProperty("otherColorLabel", locale().queryString(WebLoca
lizedString::OtherColorLabel), writer); | 97 PagePopupClient::addProperty("otherColorLabel", locale().queryString(WebLoca
lizedString::OtherColorLabel), data); |
| 98 addProperty("anchorRectInScreen", anchorRectInScreen, writer); | 98 addProperty("anchorRectInScreen", anchorRectInScreen, data); |
| 99 PagePopupClient::addString("};\n", writer); | 99 PagePopupClient::addString("};\n", data); |
| 100 writer.addData(pickerCommonJs, sizeof(pickerCommonJs)); | 100 data->append(pickerCommonJs, sizeof(pickerCommonJs)); |
| 101 writer.addData(colorSuggestionPickerJs, sizeof(colorSuggestionPickerJs)); | 101 data->append(colorSuggestionPickerJs, sizeof(colorSuggestionPickerJs)); |
| 102 PagePopupClient::addString("</script></body>\n", writer); | 102 PagePopupClient::addString("</script></body>\n", data); |
| 103 } | 103 } |
| 104 | 104 |
| 105 Locale& ColorChooserPopupUIController::locale() | 105 Locale& ColorChooserPopupUIController::locale() |
| 106 { | 106 { |
| 107 return m_locale; | 107 return m_locale; |
| 108 } | 108 } |
| 109 | 109 |
| 110 void ColorChooserPopupUIController::setValueAndClosePopup(int numValue, const St
ring& stringValue) | 110 void ColorChooserPopupUIController::setValueAndClosePopup(int numValue, const St
ring& stringValue) |
| 111 { | 111 { |
| 112 ASSERT(m_popup); | 112 ASSERT(m_popup); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 143 } | 143 } |
| 144 | 144 |
| 145 void ColorChooserPopupUIController::closePopup() | 145 void ColorChooserPopupUIController::closePopup() |
| 146 { | 146 { |
| 147 if (!m_popup) | 147 if (!m_popup) |
| 148 return; | 148 return; |
| 149 m_chromeClient->closePagePopup(m_popup); | 149 m_chromeClient->closePagePopup(m_popup); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } | 152 } |
| OLD | NEW |