Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: Source/web/ColorChooserPopupUIController.cpp

Issue 364323002: Embed CSS/JS under Source/web/resources/ as GRD resources (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-treatnullas-emptystring
Patch Set: add missing include Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/SharedBuffer.cpp ('k') | Source/web/DateTimeChooserImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "web/ColorChooserPopupUIController.h" 27 #include "web/ColorChooserPopupUIController.h"
28 28
29 #include "core/frame/FrameView.h" 29 #include "core/frame/FrameView.h"
30 #include "platform/ColorChooserClient.h" 30 #include "platform/ColorChooserClient.h"
31 #include "platform/geometry/IntRect.h" 31 #include "platform/geometry/IntRect.h"
32 #include "public/platform/Platform.h"
32 #include "public/web/WebColorChooser.h" 33 #include "public/web/WebColorChooser.h"
33 #include "web/ChromeClientImpl.h" 34 #include "web/ChromeClientImpl.h"
34 #include "web/ColorSuggestionPicker.h"
35 #include "web/PickerCommon.h"
36 #include "web/WebViewImpl.h" 35 #include "web/WebViewImpl.h"
37 36
38 using namespace WebCore; 37 using namespace WebCore;
39 38
40 namespace blink { 39 namespace blink {
41 40
42 // Keep in sync with Actions in colorSuggestionPicker.js. 41 // Keep in sync with Actions in colorSuggestionPicker.js.
43 enum ColorPickerPopupAction { 42 enum ColorPickerPopupAction {
44 ColorPickerPopupActionChooseOtherColor = -2, 43 ColorPickerPopupActionChooseOtherColor = -2,
45 ColorPickerPopupActionCancel = -1, 44 ColorPickerPopupActionCancel = -1,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 81
83 void ColorChooserPopupUIController::writeDocument(SharedBuffer* data) 82 void ColorChooserPopupUIController::writeDocument(SharedBuffer* data)
84 { 83 {
85 Vector<ColorSuggestion> suggestions = m_client->suggestions(); 84 Vector<ColorSuggestion> suggestions = m_client->suggestions();
86 Vector<String> suggestionValues; 85 Vector<String> suggestionValues;
87 for (unsigned i = 0; i < suggestions.size(); i++) 86 for (unsigned i = 0; i < suggestions.size(); i++)
88 suggestionValues.append(suggestions[i].color.serialized()); 87 suggestionValues.append(suggestions[i].color.serialized());
89 IntRect anchorRectInScreen = m_chromeClient->rootViewToScreen(m_client->elem entRectRelativeToRootView()); 88 IntRect anchorRectInScreen = m_chromeClient->rootViewToScreen(m_client->elem entRectRelativeToRootView());
90 89
91 PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><styl e>\n", data); 90 PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><styl e>\n", data);
92 data->append(pickerCommonCss, sizeof(pickerCommonCss)); 91 data->append(blink::Platform::current()->loadResource("pickerCommon.css"));
93 data->append(colorSuggestionPickerCss, sizeof(colorSuggestionPickerCss)); 92 data->append(blink::Platform::current()->loadResource("colorSuggestionPicker .css"));
94 PagePopupClient::addString("</style></head><body><div id=main>Loading...</di v><script>\n" 93 PagePopupClient::addString("</style></head><body><div id=main>Loading...</di v><script>\n"
95 "window.dialogArguments = {\n", data); 94 "window.dialogArguments = {\n", data);
96 PagePopupClient::addProperty("values", suggestionValues, data); 95 PagePopupClient::addProperty("values", suggestionValues, data);
97 PagePopupClient::addProperty("otherColorLabel", locale().queryString(WebLoca lizedString::OtherColorLabel), data); 96 PagePopupClient::addProperty("otherColorLabel", locale().queryString(WebLoca lizedString::OtherColorLabel), data);
98 addProperty("anchorRectInScreen", anchorRectInScreen, data); 97 addProperty("anchorRectInScreen", anchorRectInScreen, data);
99 PagePopupClient::addString("};\n", data); 98 PagePopupClient::addString("};\n", data);
100 data->append(pickerCommonJs, sizeof(pickerCommonJs)); 99 data->append(blink::Platform::current()->loadResource("pickerCommon.js"));
101 data->append(colorSuggestionPickerJs, sizeof(colorSuggestionPickerJs)); 100 data->append(blink::Platform::current()->loadResource("colorSuggestionPicker .js"));
102 PagePopupClient::addString("</script></body>\n", data); 101 PagePopupClient::addString("</script></body>\n", data);
103 } 102 }
104 103
105 Locale& ColorChooserPopupUIController::locale() 104 Locale& ColorChooserPopupUIController::locale()
106 { 105 {
107 return m_locale; 106 return m_locale;
108 } 107 }
109 108
110 void ColorChooserPopupUIController::setValueAndClosePopup(int numValue, const St ring& stringValue) 109 void ColorChooserPopupUIController::setValueAndClosePopup(int numValue, const St ring& stringValue)
111 { 110 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 142 }
144 143
145 void ColorChooserPopupUIController::closePopup() 144 void ColorChooserPopupUIController::closePopup()
146 { 145 {
147 if (!m_popup) 146 if (!m_popup)
148 return; 147 return;
149 m_chromeClient->closePagePopup(m_popup); 148 m_chromeClient->closePagePopup(m_popup);
150 } 149 }
151 150
152 } 151 }
OLDNEW
« no previous file with comments | « Source/platform/SharedBuffer.cpp ('k') | Source/web/DateTimeChooserImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698