Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / web / ColorChooserPopupUIController.cpp
index 8a70f1d..0f7e4db 100644 (file)
  */
 
 #include "config.h"
-#include "ColorChooserPopupUIController.h"
+#include "web/ColorChooserPopupUIController.h"
 
-#include "ChromeClientImpl.h"
-#include "ColorSuggestionPicker.h"
-#include "PickerCommon.h"
-#include "WebColorChooser.h"
-#include "WebViewImpl.h"
 #include "core/frame/FrameView.h"
-#include "platform/ColorChooserClient.h"
+#include "core/html/forms/ColorChooserClient.h"
+#include "core/page/PagePopup.h"
 #include "platform/geometry/IntRect.h"
-
-using namespace WebCore;
+#include "public/platform/Platform.h"
+#include "public/web/WebColorChooser.h"
+#include "web/ChromeClientImpl.h"
+#include "web/WebViewImpl.h"
 
 namespace blink {
 
@@ -46,10 +44,9 @@ enum ColorPickerPopupAction {
     ColorPickerPopupActionSetValue = 0
 };
 
-ColorChooserPopupUIController::ColorChooserPopupUIController(ChromeClientImpl* chromeClient, ColorChooserClient* client)
-    : ColorChooserUIController(chromeClient, client)
+ColorChooserPopupUIController::ColorChooserPopupUIController(LocalFrame* frame, ChromeClientImpl* chromeClient, ColorChooserClient* client)
+    : ColorChooserUIController(frame, client)
     , m_chromeClient(chromeClient)
-    , m_client(client)
     , m_popup(0)
     , m_locale(Locale::defaultLocale())
 {
@@ -57,6 +54,8 @@ ColorChooserPopupUIController::ColorChooserPopupUIController(ChromeClientImpl* c
 
 ColorChooserPopupUIController::~ColorChooserPopupUIController()
 {
+    closePopup();
+    // ~ColorChooserUIController ends the ColorChooser.
 }
 
 void ColorChooserPopupUIController::openUI()
@@ -71,8 +70,13 @@ void ColorChooserPopupUIController::endChooser()
 {
     if (m_chooser)
         m_chooser->endChooser();
-    if (m_popup)
-        closePopup();
+
+    closePopup();
+}
+
+AXObject* ColorChooserPopupUIController::rootAXObject()
+{
+    return m_popup ? m_popup->rootAXObject() : 0;
 }
 
 IntSize ColorChooserPopupUIController::contentSize()
@@ -89,16 +93,16 @@ void ColorChooserPopupUIController::writeDocument(SharedBuffer* data)
     IntRect anchorRectInScreen = m_chromeClient->rootViewToScreen(m_client->elementRectRelativeToRootView());
 
     PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", data);
-    data->append(pickerCommonCss, sizeof(pickerCommonCss));
-    data->append(colorSuggestionPickerCss, sizeof(colorSuggestionPickerCss));
+    data->append(Platform::current()->loadResource("pickerCommon.css"));
+    data->append(Platform::current()->loadResource("colorSuggestionPicker.css"));
     PagePopupClient::addString("</style></head><body><div id=main>Loading...</div><script>\n"
         "window.dialogArguments = {\n", data);
     PagePopupClient::addProperty("values", suggestionValues, data);
     PagePopupClient::addProperty("otherColorLabel", locale().queryString(WebLocalizedString::OtherColorLabel), data);
     addProperty("anchorRectInScreen", anchorRectInScreen, data);
     PagePopupClient::addString("};\n", data);
-    data->append(pickerCommonJs, sizeof(pickerCommonJs));
-    data->append(colorSuggestionPickerJs, sizeof(colorSuggestionPickerJs));
+    data->append(Platform::current()->loadResource("pickerCommon.js"));
+    data->append(Platform::current()->loadResource("colorSuggestionPicker.js"));
     PagePopupClient::addString("</script></body>\n", data);
 }
 
@@ -135,6 +139,10 @@ void ColorChooserPopupUIController::didClosePopup()
         didEndChooser();
 }
 
+Element& ColorChooserPopupUIController::ownerElement()
+{
+    return m_client->ownerElement();
+}
 
 void ColorChooserPopupUIController::openPopup()
 {
@@ -149,4 +157,4 @@ void ColorChooserPopupUIController::closePopup()
     m_chromeClient->closePagePopup(m_popup);
 }
 
-}
+} // namespace blink