From 72a454cd3513ac24fbdd0e0cb9ad70b86a99b801 Mon Sep 17 00:00:00 2001 From: Kristian Monsen Date: Tue, 31 May 2011 20:30:28 +0100 Subject: Merge Chromium.org at r11.0.672.0: Initial merge by git. Change-Id: I8b4aaf611a2a405fe3fe10e8a94ea7658645c192 --- webkit/glue/DEPS | 1 + webkit/glue/alt_error_page_resource_fetcher.h | 2 +- webkit/glue/context_menu.cc | 10 + webkit/glue/context_menu.h | 15 +- webkit/glue/context_menu_unittest.cc | 3 +- webkit/glue/cpp_bound_class.cc | 6 +- webkit/glue/cpp_bound_class_unittest.cc | 11 +- webkit/glue/cpp_variant.cc | 35 +- webkit/glue/cpp_variant.h | 11 +- webkit/glue/cpp_variant_unittest.cc | 73 +- webkit/glue/devtools_strings.grd | 155 ---- webkit/glue/dom_operations.cc | 22 +- webkit/glue/dom_operations_unittest.cc | 2 +- webkit/glue/dom_serializer_unittest.cc | 28 +- webkit/glue/form_field.cc | 6 +- webkit/glue/form_field.h | 2 +- .../ftp_directory_listing_response_delegate.cc | 4 +- .../glue/ftp_directory_listing_response_delegate.h | 2 +- webkit/glue/glue_serialize.cc | 16 +- webkit/glue/glue_serialize.h | 2 +- webkit/glue/glue_serialize_unittest.cc | 6 +- webkit/glue/idb_bindings.cc | 8 +- webkit/glue/iframe_redirect_unittest.cc | 12 +- webkit/glue/image_decoder.cc | 6 +- webkit/glue/image_decoder.h | 2 +- webkit/glue/image_resource_fetcher.cc | 12 +- webkit/glue/inspector_strings.grd | 998 ++++++++++++++++++--- webkit/glue/media/audio_decoder.cc | 2 +- webkit/glue/media/buffered_data_source.cc | 92 +- webkit/glue/media/buffered_data_source.h | 10 +- webkit/glue/media/buffered_data_source_unittest.cc | 87 +- webkit/glue/media/buffered_resource_loader.cc | 17 +- webkit/glue/media/buffered_resource_loader.h | 12 +- .../media/buffered_resource_loader_unittest.cc | 89 +- webkit/glue/media/simple_data_source.cc | 23 +- webkit/glue/media/simple_data_source.h | 12 +- webkit/glue/media/simple_data_source_unittest.cc | 121 ++- webkit/glue/media/video_renderer_impl.h | 6 +- webkit/glue/mimetype_unittest.cc | 6 +- webkit/glue/multipart_response_delegate.cc | 11 +- webkit/glue/multipart_response_delegate.h | 2 +- .../glue/multipart_response_delegate_unittest.cc | 8 +- webkit/glue/npruntime_util.cc | 2 +- webkit/glue/password_form.h | 2 +- webkit/glue/password_form_dom_manager.cc | 4 +- webkit/glue/plugins/plugin_list.h | 1 - webkit/glue/regular_expression_unittest.cc | 6 +- webkit/glue/resource_fetcher.cc | 40 +- webkit/glue/resource_fetcher.h | 13 +- webkit/glue/resource_fetcher_unittest.cc | 135 ++- webkit/glue/resource_loader_bridge.h | 4 +- .../linux-checkbox-disabled-indeterminate.png | Bin 3914 -> 0 bytes .../glue/resources/linux-checkbox-disabled-off.png | Bin 2850 -> 0 bytes .../glue/resources/linux-checkbox-disabled-on.png | Bin 3015 -> 0 bytes .../resources/linux-checkbox-indeterminate.png | Bin 3098 -> 0 bytes webkit/glue/resources/linux-checkbox-off.png | Bin 3024 -> 0 bytes webkit/glue/resources/linux-checkbox-on.png | Bin 3165 -> 0 bytes webkit/glue/resources/linux-progress-bar.png | Bin 182 -> 0 bytes .../glue/resources/linux-progress-border-left.png | Bin 148 -> 0 bytes .../glue/resources/linux-progress-border-right.png | Bin 146 -> 0 bytes webkit/glue/resources/linux-progress-value.png | Bin 167 -> 0 bytes webkit/glue/resources/linux-radio-disabled-off.png | Bin 2910 -> 0 bytes webkit/glue/resources/linux-radio-disabled-on.png | Bin 3015 -> 0 bytes webkit/glue/resources/linux-radio-off.png | Bin 3133 -> 0 bytes webkit/glue/resources/linux-radio-on.png | Bin 3148 -> 0 bytes webkit/glue/scoped_clipboard_writer_glue.h | 8 +- webkit/glue/simple_webmimeregistry_impl.cc | 2 +- webkit/glue/simple_webmimeregistry_impl.h | 2 +- webkit/glue/site_isolation_metrics.cc | 12 +- webkit/glue/site_isolation_metrics.h | 2 +- webkit/glue/user_agent.cc | 10 +- webkit/glue/user_agent.h | 2 +- webkit/glue/web_io_operators.cc | 10 +- webkit/glue/webaccessibility.cc | 28 +- webkit/glue/webaccessibility.h | 2 +- webkit/glue/webclipboard_impl.cc | 56 +- webkit/glue/webclipboard_impl.h | 17 +- webkit/glue/webcursor.cc | 4 +- webkit/glue/webcursor.h | 6 +- webkit/glue/webcursor_gtk.cc | 4 +- webkit/glue/webcursor_mac.mm | 6 +- webkit/glue/webcursor_unittest.cc | 2 +- webkit/glue/webcursor_win.cc | 4 +- webkit/glue/webdropdata.cc | 10 +- webkit/glue/webdropdata_win.cc | 14 +- webkit/glue/webfileutilities_impl.cc | 4 +- webkit/glue/webfileutilities_impl.h | 2 +- webkit/glue/webframe_unittest.cc | 10 +- webkit/glue/webkit_glue.cc | 41 +- webkit/glue/webkit_glue.gypi | 69 +- webkit/glue/webkit_glue.h | 28 +- webkit/glue/webkit_resources.grd | 19 +- webkit/glue/webkit_strings.grd | 23 + webkit/glue/webkitclient_impl.cc | 110 ++- webkit/glue/webkitclient_impl.h | 2 +- webkit/glue/webmediaplayer_impl.cc | 62 +- webkit/glue/webmediaplayer_impl.h | 19 +- webkit/glue/webmenuitem.h | 28 +- webkit/glue/webmenurunner_mac.h | 5 +- webkit/glue/webmenurunner_mac.mm | 165 ++-- .../glue/webpasswordautocompletelistener_impl.cc | 6 +- webkit/glue/webpasswordautocompletelistener_impl.h | 4 +- webkit/glue/webpreferences.cc | 35 +- webkit/glue/webpreferences.h | 8 +- webkit/glue/websocketstreamhandle_impl.cc | 6 +- webkit/glue/websocketstreamhandle_impl.h | 2 +- webkit/glue/webthemeengine_impl_linux.cc | 108 ++- webkit/glue/webthemeengine_impl_linux.h | 2 +- webkit/glue/webthemeengine_impl_mac.cc | 4 +- webkit/glue/webthemeengine_impl_mac.h | 2 +- webkit/glue/webthemeengine_impl_win.cc | 4 +- webkit/glue/webthemeengine_impl_win.h | 2 +- webkit/glue/weburlloader_impl.cc | 71 +- webkit/glue/weburlloader_impl.h | 2 +- webkit/glue/webvideoframe_impl.cc | 2 +- webkit/glue/webvideoframe_impl.h | 2 +- webkit/glue/webview_unittest.cc | 2 +- webkit/glue/window_open_disposition.h | 2 +- 118 files changed, 2170 insertions(+), 1037 deletions(-) delete mode 100644 webkit/glue/devtools_strings.grd delete mode 100644 webkit/glue/resources/linux-checkbox-disabled-indeterminate.png delete mode 100644 webkit/glue/resources/linux-checkbox-disabled-off.png delete mode 100644 webkit/glue/resources/linux-checkbox-disabled-on.png delete mode 100644 webkit/glue/resources/linux-checkbox-indeterminate.png delete mode 100644 webkit/glue/resources/linux-checkbox-off.png delete mode 100644 webkit/glue/resources/linux-checkbox-on.png delete mode 100644 webkit/glue/resources/linux-progress-bar.png delete mode 100644 webkit/glue/resources/linux-progress-border-left.png delete mode 100644 webkit/glue/resources/linux-progress-border-right.png delete mode 100644 webkit/glue/resources/linux-progress-value.png delete mode 100644 webkit/glue/resources/linux-radio-disabled-off.png delete mode 100644 webkit/glue/resources/linux-radio-disabled-on.png delete mode 100644 webkit/glue/resources/linux-radio-off.png delete mode 100644 webkit/glue/resources/linux-radio-on.png (limited to 'webkit') diff --git a/webkit/glue/DEPS b/webkit/glue/DEPS index 0a36ef7..e4479d5 100644 --- a/webkit/glue/DEPS +++ b/webkit/glue/DEPS @@ -4,6 +4,7 @@ include_rules = [ "+media", "+skia/ext", "+skia/include", + "+ui", "+webkit/tools/test_shell", # Needed for test shell tests. # This is not actually a directory, but npruntime_util.cc includes a file diff --git a/webkit/glue/alt_error_page_resource_fetcher.h b/webkit/glue/alt_error_page_resource_fetcher.h index 86671df..3cccaf4 100644 --- a/webkit/glue/alt_error_page_resource_fetcher.h +++ b/webkit/glue/alt_error_page_resource_fetcher.h @@ -8,7 +8,7 @@ #include "base/callback.h" #include "base/scoped_ptr.h" #include "googleurl/src/gurl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" namespace WebKit { class WebFrame; diff --git a/webkit/glue/context_menu.cc b/webkit/glue/context_menu.cc index bdfe790..6db5c51 100644 --- a/webkit/glue/context_menu.cc +++ b/webkit/glue/context_menu.cc @@ -4,6 +4,15 @@ #include "webkit/glue/context_menu.h" +namespace webkit_glue { + +CustomContextMenuContext::CustomContextMenuContext() + : is_pepper_menu(false), + request_id(0) { +} + +} // namespace webkit_glue + ContextMenuParams::ContextMenuParams() { } @@ -30,6 +39,7 @@ ContextMenuParams::ContextMenuParams(const WebKit::WebContextMenuData& data) edit_flags(data.editFlags), security_info(data.securityInfo), frame_charset(data.frameEncoding.utf8()) { + custom_context.is_pepper_menu = false; for (size_t i = 0; i < data.customItems.size(); ++i) custom_items.push_back(WebMenuItem(data.customItems[i])); } diff --git a/webkit/glue/context_menu.h b/webkit/glue/context_menu.h index c87de41..2f38807 100644 --- a/webkit/glue/context_menu.h +++ b/webkit/glue/context_menu.h @@ -12,8 +12,20 @@ #include "googleurl/src/gurl.h" #include "webkit/glue/webmenuitem.h" -#include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" +namespace webkit_glue { + +struct CustomContextMenuContext { + bool is_pepper_menu; + int request_id; + + CustomContextMenuContext(); +}; + +} // namespace webkit_glue + +// TODO(viettrungluu): Put this in the webkit_glue namespace. // Parameters structure for ViewHostMsg_ContextMenu. // FIXME(beng): This would be more useful in the future and more efficient // if the parameters here weren't so literally mapped to what @@ -94,6 +106,7 @@ struct ContextMenuParams { // The character encoding of the frame on which the menu is invoked. std::string frame_charset; + webkit_glue::CustomContextMenuContext custom_context; std::vector custom_items; ContextMenuParams(); diff --git a/webkit/glue/context_menu_unittest.cc b/webkit/glue/context_menu_unittest.cc index 9cefc9f..7f54afd 100644 --- a/webkit/glue/context_menu_unittest.cc +++ b/webkit/glue/context_menu_unittest.cc @@ -11,7 +11,8 @@ #include "base/file_util.h" #include "base/message_loop.h" #include "googleurl/src/gurl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/glue/webkit_glue.h" #include "webkit/tools/test_shell/test_shell_test.h" #include "webkit/tools/test_shell/test_webview_delegate.h" diff --git a/webkit/glue/cpp_bound_class.cc b/webkit/glue/cpp_bound_class.cc index c5d15b6..9688e4d 100644 --- a/webkit/glue/cpp_bound_class.cc +++ b/webkit/glue/cpp_bound_class.cc @@ -15,9 +15,9 @@ #include "base/compiler_specific.h" #include "base/logging.h" #include "base/utf_string_conversions.h" -#include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" #include "webkit/glue/cpp_bound_class.h" using WebKit::WebBindings; diff --git a/webkit/glue/cpp_bound_class_unittest.cc b/webkit/glue/cpp_bound_class_unittest.cc index f2ef018..fd6691f 100644 --- a/webkit/glue/cpp_bound_class_unittest.cc +++ b/webkit/glue/cpp_bound_class_unittest.cc @@ -10,10 +10,10 @@ #include "base/message_loop.h" #include "base/string_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/glue/cpp_binding_example.h" #include "webkit/glue/webkit_glue.h" #include "webkit/tools/test_shell/test_shell_test.h" @@ -230,8 +230,7 @@ TEST_F(CppBoundClassTest, SetAndGetPropertiesWithCallbacks) { CheckJavaScriptSuccess(js); } -// Disabled, http://crbug.com/68445. -TEST_F(CppBoundClassTest, DISABLED_InvokeMethods) { +TEST_F(CppBoundClassTest, InvokeMethods) { // The expression on the left is expected to return the value on the right. static const std::string tests[] = { "example.echoValue(true)", "true", diff --git a/webkit/glue/cpp_variant.cc b/webkit/glue/cpp_variant.cc index 0d16cdd..699f7f1 100644 --- a/webkit/glue/cpp_variant.cc +++ b/webkit/glue/cpp_variant.cc @@ -1,11 +1,11 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // This file contains definitions for CppVariant. #include -#include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" #include "webkit/glue/cpp_variant.h" #include "base/logging.h" #include "base/string_util.h" @@ -211,14 +211,14 @@ bool CppVariant::ToBoolean() const { return value.boolValue; } -std::vector CppVariant::ToStringVector() const { +std::vector CppVariant::ToVector() const { DCHECK(isObject()); - std::vector string_vector; + std::vector vector; NPObject* np_value = value.objectValue; NPIdentifier length_id = WebBindings::getStringIdentifier("length"); if (WebBindings::hasProperty(NULL, np_value, length_id)) { - NPVariant length_value; + CppVariant length_value; if (WebBindings::getProperty(NULL, np_value, length_id, &length_value)) { int length = 0; // The length is a double in some cases. @@ -226,30 +226,25 @@ std::vector CppVariant::ToStringVector() const { length = static_cast(NPVARIANT_TO_DOUBLE(length_value)); else if (NPVARIANT_IS_INT32(length_value)) length = NPVARIANT_TO_INT32(length_value); - WebBindings::releaseVariantValue(&length_value); + else + NOTREACHED(); // For sanity, only allow 60000 items. length = std::min(60000, length); for (int i = 0; i < length; ++i) { // Get each of the items. - std::string index = base::StringPrintf("%d", i); - NPIdentifier index_id = WebBindings::getStringIdentifier(index.c_str()); - if (WebBindings::hasProperty(NULL, np_value, index_id)) { - NPVariant index_value; - if (WebBindings::getProperty(NULL, np_value, index_id, &index_value)) { - if (NPVARIANT_IS_STRING(index_value)) { - std::string string( - NPVARIANT_TO_STRING(index_value).UTF8Characters, - NPVARIANT_TO_STRING(index_value).UTF8Length); - string_vector.push_back(string); - } - WebBindings::releaseVariantValue(&index_value); - } + NPIdentifier index = WebBindings::getIntIdentifier(i); + if (WebBindings::hasProperty(NULL, np_value, index)) { + CppVariant index_value; + if (WebBindings::getProperty(NULL, np_value, index, &index_value)) + vector.push_back(index_value); } } } + } else { + NOTREACHED(); } - return string_vector; + return vector; } bool CppVariant::Invoke(const std::string& method, const CppVariant* args, diff --git a/webkit/glue/cpp_variant.h b/webkit/glue/cpp_variant.h index 34f843a..01efd7d 100644 --- a/webkit/glue/cpp_variant.h +++ b/webkit/glue/cpp_variant.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -89,14 +89,15 @@ class CppVariant : public NPVariant { bool isObject() const { return (type == NPVariantType_Object); } // Converters. The CppVariant must be of a type convertible to these values. - // For example, ToInteger() works only if isNumber() is true. + // For example, ToInt32() works only if isNumber() is true. std::string ToString() const; int32_t ToInt32() const; double ToDouble() const; bool ToBoolean() const; - // Returns a vector of strings for the specified argument. This is useful - // for converting a JavaScript array of strings into a vector of strings. - std::vector ToStringVector() const; + // Returns a vector of CppVariant for the specified variant. This should only + // be called on an Object. If the object has no "length" property an empty + // vector is returned. + std::vector ToVector() const; // Invoke method of the given name on an object with the supplied arguments. // The first argument should be the object on which the method is to be diff --git a/webkit/glue/cpp_variant_unittest.cc b/webkit/glue/cpp_variant_unittest.cc index 43c78de..f3c6b61 100644 --- a/webkit/glue/cpp_variant_unittest.cc +++ b/webkit/glue/cpp_variant_unittest.cc @@ -1,10 +1,13 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + #include "base/compiler_specific.h" +#include "base/string_util.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" #include "webkit/glue/cpp_variant.h" using WebKit::WebBindings; @@ -273,7 +276,7 @@ TEST(CppVariantTest, SetsSimpleTypesAndValues) { CppVariant cpp; cpp.Set(true); EXPECT_EQ(NPVariantType_Bool, cpp.type); - EXPECT_EQ(true, cpp.value.boolValue); + EXPECT_TRUE(cpp.value.boolValue); cpp.Set(5); EXPECT_EQ(NPVariantType_Int32, cpp.type); @@ -424,3 +427,67 @@ TEST(CppVariantTest, IsTypeFunctionsWork) { WebBindings::releaseObject(obj); CheckObject(cpp); } + +bool MockNPHasPropertyFunction(NPObject *npobj, NPIdentifier name) { + return true; +} + +bool MockNPGetPropertyFunction(NPObject *npobj, NPIdentifier name, + NPVariant *result) { + if (WebBindings::getStringIdentifier("length") == name) { + DOUBLE_TO_NPVARIANT(4, *result); + } else if (WebBindings::getIntIdentifier(0) == name) { + DOUBLE_TO_NPVARIANT(0, *result); + } else if (WebBindings::getIntIdentifier(1) == name) { + BOOLEAN_TO_NPVARIANT(true, *result); + } else if (WebBindings::getIntIdentifier(2) == name) { + NULL_TO_NPVARIANT(*result); + } else if (WebBindings::getIntIdentifier(3) == name) { + const char* s = "string"; + size_t length = strlen(s); + char* mem = static_cast(malloc(length + 1)); + base::strlcpy(mem, s, length + 1); + STRINGZ_TO_NPVARIANT(mem, *result); + } + + return true; +} + +TEST(CppVariantTest, ToVector) { + NPClass array_like_class = { + NP_CLASS_STRUCT_VERSION, + 0, // NPAllocateFunctionPtr allocate; + 0, // NPDeallocateFunctionPtr deallocate; + 0, // NPInvalidateFunctionPtr invalidate; + 0, // NPHasMethodFunctionPtr hasMethod; + 0, // NPInvokeFunctionPtr invoke; + 0, // NPInvokeDefaultFunctionPtr invokeDefault; + MockNPHasPropertyFunction, // NPHasPropertyFunctionPtr hasProperty; + MockNPGetPropertyFunction, // NPGetPropertyFunctionPtr getProperty; + 0, // NPSetPropertyFunctionPtr setProperty; + 0, // NPRemovePropertyFunctionPtr removeProperty; + 0, // NPEnumerationFunctionPtr enumerate; + 0 // NPConstructFunctionPtr construct; + }; + + NPObject* obj = WebBindings::createObject(NULL, &array_like_class); + + CppVariant cpp; + cpp.Set(obj); + + std::vector cpp_vector = cpp.ToVector(); + EXPECT_EQ(4u, cpp_vector.size()); + + EXPECT_TRUE(cpp_vector[0].isDouble()); + EXPECT_EQ(0, cpp_vector[0].ToDouble()); + + EXPECT_TRUE(cpp_vector[1].isBool()); + EXPECT_EQ(true, cpp_vector[1].ToBoolean()); + + EXPECT_TRUE(cpp_vector[2].isNull()); + + EXPECT_TRUE(cpp_vector[3].isString()); + CheckString("string", cpp_vector[3]); + + WebBindings::releaseObject(obj); +} diff --git a/webkit/glue/devtools_strings.grd b/webkit/glue/devtools_strings.grd deleted file mode 100644 index 36f14ca..0000000 --- a/webkit/glue/devtools_strings.grd +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Failed to resolve children: %sAllocation failure - - - Corrupted object: %sbad - - - Failed to resolve scope variables: %sUndefined variable - - - Processing... - - - %d1000 ticks processed - - - <source is not available> - - - <Unknown scope type> - - - Developer Tools - %shttp://www.example.com/ - - - Heap - - - Take heap snapshot. - - - Snapshot %d1 - - - Used %1$s100MB of %2$s200MB (%3$.0f50%%) - - - Constructor - - - Count - - - ± Count - - - ± Size - - - Compared to %sSnapshot 1 - - - Show absolute counts and sizes. - - - Show counts and sizes as percentages. - - - new - - - deleted - - - %s+ >1000%% - - - %$1s+%$2.2f5%% - - - %$1s%$2d - - - %$1s%$2s - - - Objects and Data - - - Code - - - - diff --git a/webkit/glue/dom_operations.cc b/webkit/glue/dom_operations.cc index 07c43b2..2533f57 100644 --- a/webkit/glue/dom_operations.cc +++ b/webkit/glue/dom_operations.cc @@ -9,17 +9,17 @@ #include "base/compiler_specific.h" #include "base/logging.h" #include "base/string_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebAnimationController.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" -#include "third_party/WebKit/WebKit/chromium/public/WebElement.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" -#include "third_party/WebKit/WebKit/chromium/public/WebNode.h" -#include "third_party/WebKit/WebKit/chromium/public/WebNodeCollection.h" -#include "third_party/WebKit/WebKit/chromium/public/WebNodeList.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebVector.h" -#include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebAnimationController.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeCollection.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" using WebKit::WebAnimationController; using WebKit::WebDocument; diff --git a/webkit/glue/dom_operations_unittest.cc b/webkit/glue/dom_operations_unittest.cc index fac49c6..8d8d96b 100644 --- a/webkit/glue/dom_operations_unittest.cc +++ b/webkit/glue/dom_operations_unittest.cc @@ -8,7 +8,7 @@ #include "base/utf_string_conversions.h" #include "net/base/net_util.h" #include "net/url_request/url_request_context.h" -#include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/glue/dom_operations.h" #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" #include "webkit/tools/test_shell/test_shell_test.h" diff --git a/webkit/glue/dom_serializer_unittest.cc b/webkit/glue/dom_serializer_unittest.cc index 62b5a3d..7bf3f62 100644 --- a/webkit/glue/dom_serializer_unittest.cc +++ b/webkit/glue/dom_serializer_unittest.cc @@ -10,20 +10,20 @@ #include "base/utf_string_conversions.h" #include "net/base/net_util.h" #include "net/url_request/url_request_context.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" -#include "third_party/WebKit/WebKit/chromium/public/WebElement.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebNode.h" -#include "third_party/WebKit/WebKit/chromium/public/WebNodeCollection.h" -#include "third_party/WebKit/WebKit/chromium/public/WebNodeList.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPageSerializer.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPageSerializerClient.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebVector.h" -#include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeCollection.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializer.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/glue/dom_operations.h" #include "webkit/glue/webkit_glue.h" #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" diff --git a/webkit/glue/form_field.cc b/webkit/glue/form_field.cc index bcc9926..82cac6a 100644 --- a/webkit/glue/form_field.cc +++ b/webkit/glue/form_field.cc @@ -6,9 +6,9 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" -#include "third_party/WebKit/WebKit/chromium/public/WebOptionElement.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSelectElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebOptionElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSelectElement.h" using WebKit::WebFormControlElement; using WebKit::WebElement; diff --git a/webkit/glue/form_field.h b/webkit/glue/form_field.h index 23b7380..1874c44 100644 --- a/webkit/glue/form_field.h +++ b/webkit/glue/form_field.h @@ -8,7 +8,7 @@ #include #include "base/string16.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFormControlElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement.h" namespace webkit_glue { diff --git a/webkit/glue/ftp_directory_listing_response_delegate.cc b/webkit/glue/ftp_directory_listing_response_delegate.cc index 80737db..0a2542b 100644 --- a/webkit/glue/ftp_directory_listing_response_delegate.cc +++ b/webkit/glue/ftp_directory_listing_response_delegate.cc @@ -18,8 +18,8 @@ #include "net/base/net_util.h" #include "net/ftp/ftp_directory_listing_parser.h" #include "net/ftp/ftp_server_type_histograms.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderClient.h" using net::FtpDirectoryListingEntry; diff --git a/webkit/glue/ftp_directory_listing_response_delegate.h b/webkit/glue/ftp_directory_listing_response_delegate.h index e259c1e..9502761 100644 --- a/webkit/glue/ftp_directory_listing_response_delegate.h +++ b/webkit/glue/ftp_directory_listing_response_delegate.h @@ -11,7 +11,7 @@ #include #include "net/ftp/ftp_directory_listing_buffer.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" namespace WebKit { class WebURLLoader; diff --git a/webkit/glue/glue_serialize.cc b/webkit/glue/glue_serialize.cc index 5b76784..df055fe 100644 --- a/webkit/glue/glue_serialize.cc +++ b/webkit/glue/glue_serialize.cc @@ -9,14 +9,14 @@ #include "base/pickle.h" #include "base/utf_string_conversions.h" #include "googleurl/src/gurl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h" -#include "third_party/WebKit/WebKit/chromium/public/WebHTTPBody.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSerializedScriptValue.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebVector.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebHTTPBody.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptValue.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" #include "webkit/glue/webkit_glue.h" using WebKit::WebData; diff --git a/webkit/glue/glue_serialize.h b/webkit/glue/glue_serialize.h index 303fe3a..3c5ee31 100644 --- a/webkit/glue/glue_serialize.h +++ b/webkit/glue/glue_serialize.h @@ -11,7 +11,7 @@ #define WEBKIT_GLUE_GLUE_SERIALIZE_H_ #include -#include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" namespace webkit_glue { diff --git a/webkit/glue/glue_serialize_unittest.cc b/webkit/glue/glue_serialize_unittest.cc index 342696d..eebd9bf 100644 --- a/webkit/glue/glue_serialize_unittest.cc +++ b/webkit/glue/glue_serialize_unittest.cc @@ -7,9 +7,9 @@ #include "base/pickle.h" #include "base/string_util.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/WebKit/chromium/public/WebHTTPBody.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" -#include "third_party/WebKit/WebKit/chromium/public/WebVector.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebHTTPBody.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" #include "webkit/glue/glue_serialize.h" #include "webkit/glue/web_io_operators.h" diff --git a/webkit/glue/idb_bindings.cc b/webkit/glue/idb_bindings.cc index 4af085f..c565f94 100644 --- a/webkit/glue/idb_bindings.cc +++ b/webkit/glue/idb_bindings.cc @@ -8,10 +8,10 @@ #include "base/scoped_ptr.h" #include "base/string16.h" #include "base/utf_string_conversions.h" -#include "third_party/WebKit/WebKit/chromium/public/WebIDBKey.h" -#include "third_party/WebKit/WebKit/chromium/public/WebIDBKeyPath.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSerializedScriptValue.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptValue.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" #include "v8/include/v8.h" namespace webkit_glue { diff --git a/webkit/glue/iframe_redirect_unittest.cc b/webkit/glue/iframe_redirect_unittest.cc index 9170d19..de98175 100644 --- a/webkit/glue/iframe_redirect_unittest.cc +++ b/webkit/glue/iframe_redirect_unittest.cc @@ -6,12 +6,12 @@ #include "base/file_util.h" #include "base/string_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebVector.h" -#include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/glue/webkit_glue.h" #include "webkit/tools/test_shell/test_shell_test.h" diff --git a/webkit/glue/image_decoder.cc b/webkit/glue/image_decoder.cc index 6850909..2982961 100644 --- a/webkit/glue/image_decoder.cc +++ b/webkit/glue/image_decoder.cc @@ -4,9 +4,9 @@ #include "webkit/glue/image_decoder.h" -#include "third_party/WebKit/WebKit/chromium/public/WebData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebImage.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" #include "third_party/skia/include/core/SkBitmap.h" #if WEBKIT_USING_CG diff --git a/webkit/glue/image_decoder.h b/webkit/glue/image_decoder.h index 62d9253..b19c8ef 100644 --- a/webkit/glue/image_decoder.h +++ b/webkit/glue/image_decoder.h @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/basictypes.h" -#include "gfx/size.h" +#include "ui/gfx/size.h" class SkBitmap; diff --git a/webkit/glue/image_resource_fetcher.cc b/webkit/glue/image_resource_fetcher.cc index 6185834..65d80bd 100644 --- a/webkit/glue/image_resource_fetcher.cc +++ b/webkit/glue/image_resource_fetcher.cc @@ -5,8 +5,8 @@ #include "webkit/glue/image_resource_fetcher.h" #include "base/callback.h" -#include "gfx/size.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "ui/gfx/size.h" #include "webkit/glue/image_decoder.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -47,8 +47,12 @@ void ImageResourceFetcher::OnURLFetchComplete( // If we get here, it means no image from server or couldn't decode the // response as an image. The delegate will see a null image, indicating // that an error occurred. - callback_->Run(this, bitmap); - callback_.reset(); + + // Take care to clear callback_ before running the callback as it may lead to + // our destruction. + scoped_ptr callback; + callback.swap(callback_); + callback->Run(this, bitmap); } } // namespace webkit_glue diff --git a/webkit/glue/inspector_strings.grd b/webkit/glue/inspector_strings.grd index 22f147d..54fe5c6 100644 --- a/webkit/glue/inspector_strings.grd +++ b/webkit/glue/inspector_strings.grd @@ -4,8 +4,8 @@ each locale. Specifically, these are UI strings that are used by WebKit Inspector that need to be translated for each locale.--> - - @@ -92,28 +106,59 @@ so we include the original license below: + + + - + + + + + + + + + + + + + + + + + + + + + + + - - ''' (%d1) + + ''' (%d2) - - ''' (repeated %d2 times) + + ''' (repeated %d3 times) + + + 1 - %d1000 %.0f100B + + %.0f100KB + + + %.0f100MB + %.0f100ms @@ -132,15 +177,21 @@ so we include the original license below: %.2f5KB + + %.2f100MB + %.2f5s - - %.3f5MB - %.3f5ms + + %d10 console messages are not shown. + + + %1$d10 cookies (%2$s10KB) + %d1 error @@ -162,6 +213,9 @@ so we include the original license below: %d2 matches + + %1$d10 of %2$d100 captured records are visible + %d1 style change @@ -174,12 +228,33 @@ so we include the original license below: %d2 warnings + + %1$d100 × %2$d100 pixels (Natural: %3$d100 × %4$d100 pixels) + + + %1$d100 × %2$d100 pixels + %1$d100 × %2$d100 + + %1$sfoo.html (%2$s10KB) + + + %1$s5 seconds (at %2$s10:25) + %spicture.gif (from cache) + + %sPaint - Details + + + %s+ >1000%% + + + %s10KB collected + %s5ms download @@ -189,24 +264,84 @@ so we include the original license below: %1$s5ms latency, %2$s5ms download (%3$s10ms total) + + %1$s10MB of %2$s20MB + + + %1$s+%2$.2f100%% + + + %1$s+%2$d10 + + + %1$s+%2$s10KB + (anonymous function) + + (internal script) + + + (from cache) + (program) - - (program): %shttp://site/script.js - (text) + + (unable to decode value) + (whitespace) 1 match + + <source is not available> + + + Application Cache + + + Accept suggestion + + + Activate all breakpoints. + + + Add Attribute + + + Add Breakpoint + + + Add Conditional Breakpoint… + + + Add New + + + Add + + + Aggregated Time + + + All Nodes + + + All Panels + + + All + + + Allow debugging workers. Enabling this option will replace native workers with the iframe-based JavaScript implementation + Always enable @@ -216,176 +351,491 @@ so we include the original license below: An unexpected error %sNo memory occurred. + + Any XHR + + + As Authored + + + Assertion failed: + + + Attribute Modified + + + Audit Present State + + + Audits + Average + + Blocking + Breakpoints + + Cookies + + + CPU PROFILES + + + Call Site stack + Call Stack Calls + + Clear CPU profiles. + + + Clear Console + + + Clear audit results. + Clear changes log. Clear console log. + + Clear + + + Click to change color format + Closure - - COOKIES + + Code + + + Collected + + + Compared to %sSnapshot 1 Computed Style - - Cookies + + Connecting - - DATABASES + + Console - - DOM + + Constructor - - Database no longer has expected version. + + Content + + + Continue to Here + + + Continue + + + Control CPU profiling by pressing the %sbutton glyph button on the status bar. + + + Copy as HTML + + + Count Databases + + DNS Lookup + + + DOMContent event fired + + + DOMContent event + + + Database no longer has expected version. + + + Database not found. + + + Deactivate all breakpoints. + + + Debug + Debugging disabled. Click to enable. Debugging enabled. Click to disable. - - Debugging scripts requires you to start the debugger. + + Delete Node + + + Delete watch expression. Delete + + Details + Dimensions + + Disable Breakpoint + Dock to main window. + + Document + Documents - - Don't pause on exceptions. + + Domain - - Double-Click to Add + + Don't pause on exceptions.\nClick to Pause on all exceptions. + + + Double-Click to toggle between URL encoded and decoded formats + + + Edit Attribute + + + Edit Breakpoint… + + + Edit Text + + + Edit as HTML + + + Edit attribute + + + Edit + + + Elements Panel Elements + + Enable Breakpoint + Enable Debugging Enable Profiling - - Enable resource tracking - Enabling debugging will make scripts run slower. Enabling profiling will make scripts run slower. - - Enabling resource tracking will reload the page and make page loading slower. + + Errors + + + Evaluate Script Event Document + + Event Listeners + Event Target + + Event + Exclude selected function. + + Execute command + + + Expand/collapse + + + Expected Content Length + + + Expires + + + Export all to HAR + + + Export to HAR + File size + + File System + + + Find next/previous + + + Finish Loading + Focus selected function. + + Font + Fonts + + Form Data + + + Function Call + Function - - GRAPHS + + GC Event + + + Get a heap snapshot by pressing the %sbutton glyph button on the status bar. Global - + + Go + + + Go to line: + + + HEAP SNAPSHOTS + + + HSL Colors + + + HTTP + + + Headers + + Heavy (Bottom Up) + + Hex Colors + Hide changes view. Hide console. + + Hide the records that are shorter than %s15 ms + + + Image + Images - - Inline Style Attribute + + Increment/decrement by %f10 + + + Increment/decrement value + + + Inherited from + + + Install Timer Key - - LOCAL STORAGE + + Keyboard Shortcuts + + + Local Storage + + + Layout + + + Load event fired + + + Load event + + + Loading (%1$d5 of %2$d10) + + + Loading + + + Local Files Local + + Location + + + Logs + + + MIME Type + MIME type + + Mark + + + Matched CSS Rules + + + Media + + + Memory + Metrics + + Name + + + Navigate elements + + + New Style Rule + + + Next/previous call frame + + + Next/previous command + + + Next/previous line + + + Next/previous panel + + + Next/previous property + + + Next/previous suggestion + + + No Application Cache information available. + No Breakpoints + + No Event Listeners + No Properties No Variables - + + No audits to run + + + Node Removed + + Not Found - + Not Paused + + Objects + + + Offline + + + Online + Only enable for this session + + Open Link in New Window + + + Open Link in Resources Panel + Other - - Pause on exceptions. + + Paint + + + Parse + + + Path + + + Pause on all exceptions.\nClick to Pause on uncaught exceptions. + + + Pause on uncaught exceptions.\nClick to Not pause on exceptions. Pause script execution. @@ -411,60 +861,168 @@ so we include the original license below: Properties - - Prototype + + Proxy + + + Pseudo ::%sabove element + + + Pseudo element + + + Query String Parameters + + + RECORDS + + + RESULTS - - Query + + RGB Colors - - RESOURCES + + Recalculate Style + + + Receive Data + + + Receive Response + + + Receiving + + + Record + + + Recording… Refresh + + Remove Breakpoint + + + Remove Timer + + + Rendering + + + Repeats + + + Request Cookies + Request Headers + + Request Method + + + Request Payload + + + Request URL + Resource interpreted as %1$stext/javascript but transferred with MIME type %2$stext/javascript. - - Resource tracking disabled. Click to enable. - - - Resource tracking enabled. Click to disable. + + Resource Resources + + Response Cookies + Response Headers Restore all functions. + + Reveal in Elements Panel + Run %d1 - - SESSION STORAGE + + Run + + + Session Storage + + + SSL + + + Schedule Request Scope Variables + + Script + + + Scripting + + + Scripts Panel + Scripts Search %sfoo + + Search + + + Secure + + + Select All + Select an element in the page to inspect it. + + Select audits to run + + + Selected Node Only + + + Self Time + Self + + Send Request + + + Sending + + + Session + + + Show All Nodes (%d100 More) + + + Show absolute counts and sizes. + Show absolute total and self times. @@ -474,6 +1032,9 @@ so we include the original license below: Show console. + + Show counts and sizes as percentages. + Show inherited @@ -483,46 +1044,58 @@ so we include the original license below: Show the previous script resource. + + Show the records that are shorter than %s15 ms + Show total and self times as percentages. Size - - Sort by Duration - - - Sort by End Time + + Snapshot %d1 - - Sort by Latency + + Duration - - Sort by Response Time + + End Time - - Sort by Size + + Latency - - Sort by Start Time + + Response Time - - Source + + Start Time Start profiling. + + Status Code + Step into next function call. + + Step into + Step out of current function. + + Step out + Step over next function call. - + + Step over + + Stepping @@ -531,30 +1104,69 @@ so we include the original license below: Style Attribute + + Styles Pane + Styles + + Stylesheet + Stylesheets + + Subtree Modified + + + Take heap snapshot. + + + The breakpoint on line %d15 will stop only if this expression is true: + The “%sfoo”\ntable is empty. - + This site has no cookies. - - This storage is empty. + + This request has no detailed timing info. Time + + Timeline + + + Timelines + + + Timeout + + + Timer Fired + + + Timer ID + + + Timing + + + Toggle console + Total - + Tree (Top Down) + + Type + Undock into separate window. @@ -564,15 +1176,42 @@ so we include the original license below: Use small resource rows. + + Used Heap Size + Value + + Waiting + + + Warnings + + + Watch Expressions + + + Welcome to the Profiles panel + With Block + + Workers + + + XHR Load + + + XHR Ready State Change + XHR + + XMLHttpRequest logging + You could save bandwidth by having your web server compress this transfer with gzip or zlib. @@ -582,8 +1221,14 @@ so we include the original license below: You need to enable profiling before you can use the Profiles panel. - - You need to enable resource tracking to use this panel. + + [empty domain] + + + \xb1 Count + + + \xb1 Size border @@ -591,20 +1236,8 @@ so we include the original license below: content - - document - - - element’s “%swidth” attribute - - - font - - - image - - - inline stylesheet + + deleted line %d25 @@ -612,8 +1245,11 @@ so we include the original license below: margin - - other + + new + + + or padding @@ -621,12 +1257,6 @@ so we include the original license below: position - - script - - - stylesheet - user agent stylesheet @@ -636,6 +1266,162 @@ so we include the original license below: via inspector + + Break on Attributes Modifications + + + Break on Node Removal + + + Break on Subtree Modifications + + + <node> + + + Paused on a \"%1$sfoo\" breakpoint set on %2$sdiv, because a new child was added to its descendant %3$sspan. + + + Paused on a \"%1$sfoo\" breakpoint set on %2$sdiv, because a new child was added to that node. + + + Paused on a \"%1$sfoo\" breakpoint set on %2$sdiv, because its descendant %3$sspan was removed. + + + Paused on a \"%1$sfoo\" breakpoint set on %2$sfoo.js:25. + + + Paused on a XMLHttpRequest. + + + Paused on a \"%sclick\" Event Listener. + + + Paused on a JavaScript breakpoint. + + + URL contains \"%sgoogle\" + + + Network + + + Status + + + Method + + + Pending + + + %d100 requests + + + %s100KB transferred + + + %1$s5s (onload: %2$s1s, DOMContentLoaded: %3$s3s) + + + DOM Breakpoints + + + Event Listener Breakpoints + + + XHR Breakpoints + + + Mouse + + + Drag + + + Keyboard + + + Clipboard + + + DOM Mutation + + + Device + + + Load + + + Control + + + Timer + + + Set Timer + + + Clear Timer + + + No requests captured. Reload the page to see detailed information on the network activity. + + + Persistent File System + + + Temporary File System + + + File System root path not available. + + + File System is disabled. + + + Error in fetching root path for file system. + + + Reveal folder in OS + + + This request has no cookies. + + + (original) + + + (%1$d100, %2$d100) + + + Revert to this revision + + + WebSockets + + + Frames + + + Text + + + Transfer + + + Preserve Log upon Navigation + + + Go to Line + + + URL + + + Format script. + diff --git a/webkit/glue/media/audio_decoder.cc b/webkit/glue/media/audio_decoder.cc index 3fc05c9..0a236d2 100644 --- a/webkit/glue/media/audio_decoder.cc +++ b/webkit/glue/media/audio_decoder.cc @@ -9,7 +9,7 @@ #include "base/string_util.h" #include "base/time.h" #include "media/filters/audio_file_reader.h" -#include "third_party/WebKit/WebKit/chromium/public/WebAudioBus.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioBus.h" using media::AudioFileReader; using media::InMemoryDataReader; diff --git a/webkit/glue/media/buffered_data_source.cc b/webkit/glue/media/buffered_data_source.cc index b6efa16..913d400 100644 --- a/webkit/glue/media/buffered_data_source.cc +++ b/webkit/glue/media/buffered_data_source.cc @@ -38,7 +38,6 @@ BufferedDataSource::BufferedDataSource( loaded_(false), streaming_(false), frame_(frame), - single_origin_(true), loader_(NULL), network_activity_(false), initialize_callback_(NULL), @@ -115,7 +114,7 @@ bool BufferedDataSource::IsUrlSupported(const std::string& url) { void BufferedDataSource::Stop(media::FilterCallback* callback) { { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); stop_signal_received_ = true; } if (callback) { @@ -137,9 +136,25 @@ void BufferedDataSource::SetPlaybackRate(float playback_rate) { // media::DataSource implementation. void BufferedDataSource::Read(int64 position, size_t size, uint8* data, media::DataSource::ReadCallback* read_callback) { + DCHECK(read_callback); + + { + base::AutoLock auto_lock(lock_); + DCHECK(!read_callback_.get()); + + if (stop_signal_received_ || stopped_on_render_loop_) { + read_callback->RunWithParams( + Tuple1(static_cast(media::DataSource::kReadError))); + delete read_callback; + return; + } + + read_callback_.reset(read_callback); + } + render_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, &BufferedDataSource::ReadTask, - position, static_cast(size), data, read_callback)); + position, static_cast(size), data)); } bool BufferedDataSource::GetSize(int64* size_out) { @@ -157,16 +172,18 @@ bool BufferedDataSource::IsStreaming() { bool BufferedDataSource::HasSingleOrigin() { DCHECK(MessageLoop::current() == render_loop_); - return single_origin_; + return loader_.get() ? loader_->HasSingleOrigin() : true; } void BufferedDataSource::Abort() { DCHECK(MessageLoop::current() == render_loop_); - // If we are told to abort, immediately return from any pending read - // with an error. - if (read_callback_.get()) { - AutoLock auto_lock(lock_); + { + base::AutoLock auto_lock(lock_); + + // If we are told to abort, immediately return from any pending read + // with an error. + if (read_callback_.get()) DoneRead_Locked(net::ERR_FAILED); } @@ -212,19 +229,21 @@ void BufferedDataSource::InitializeTask() { } void BufferedDataSource::ReadTask( - int64 position, int read_size, uint8* buffer, - media::DataSource::ReadCallback* read_callback) { + int64 position, + int read_size, + uint8* buffer) { DCHECK(MessageLoop::current() == render_loop_); - if (stopped_on_render_loop_) - return; + { + base::AutoLock auto_lock(lock_); + if (stopped_on_render_loop_) + return; - DCHECK(!read_callback_.get()); - DCHECK(read_callback); + DCHECK(read_callback_.get()); + } // Saves the read parameters. read_position_ = position; read_size_ = read_size; - read_callback_.reset(read_callback); read_buffer_ = buffer; read_submitted_time_ = base::Time::Now(); read_attempts_ = 0; @@ -235,8 +254,14 @@ void BufferedDataSource::ReadTask( void BufferedDataSource::CleanupTask() { DCHECK(MessageLoop::current() == render_loop_); - if (stopped_on_render_loop_) - return; + + { + base::AutoLock auto_lock(lock_); + if (stopped_on_render_loop_) + return; + + read_callback_.reset(); + } // Stop the watch dog. watch_dog_timer_.Stop(); @@ -246,7 +271,6 @@ void BufferedDataSource::CleanupTask() { loader_->Stop(); // Reset the parameters of the current read request. - read_callback_.reset(); read_position_ = 0; read_size_ = 0; read_buffer_ = 0; @@ -262,9 +286,12 @@ void BufferedDataSource::RestartLoadingTask() { if (stopped_on_render_loop_) return; - // If there's no outstanding read then return early. - if (!read_callback_.get()) - return; + { + // If there's no outstanding read then return early. + base::AutoLock auto_lock(lock_); + if (!read_callback_.get()) + return; + } loader_ = CreateResourceLoader(read_position_, kPositionNotSpecified); loader_->SetAllowDefer(!media_is_paused_); @@ -280,8 +307,11 @@ void BufferedDataSource::WatchDogTask() { return; // We only care if there is an active read request. - if (!read_callback_.get()) - return; + { + base::AutoLock auto_lock(lock_); + if (!read_callback_.get()) + return; + } DCHECK(loader_.get()); base::TimeDelta delta = base::Time::Now() - read_submitted_time_; @@ -375,9 +405,6 @@ void BufferedDataSource::HttpInitialStartCallback(int error) { DCHECK(MessageLoop::current() == render_loop_); DCHECK(loader_.get()); - // Check if the request ended up at a different origin via redirect. - single_origin_ = url_.GetOrigin() == loader_->url().GetOrigin(); - int64 instance_size = loader_->instance_size(); bool partial_response = loader_->partial_response(); bool success = error == net::OK; @@ -414,7 +441,7 @@ void BufferedDataSource::HttpInitialStartCallback(int error) { // let tasks on render thread to run but make sure they don't call outside // this object when Stop() method is ever called. Locking this method is safe // because |lock_| is only acquired in tasks on render thread. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stop_signal_received_) return; @@ -444,9 +471,6 @@ void BufferedDataSource::NonHttpInitialStartCallback(int error) { DCHECK(MessageLoop::current() == render_loop_); DCHECK(loader_.get()); - // Check if the request ended up at a different origin via redirect. - single_origin_ = url_.GetOrigin() == loader_->url().GetOrigin(); - int64 instance_size = loader_->instance_size(); bool success = error == net::OK && instance_size != kPositionNotSpecified; @@ -465,7 +489,7 @@ void BufferedDataSource::NonHttpInitialStartCallback(int error) { // let tasks on render thread to run but make sure they don't call outside // this object when Stop() method is ever called. Locking this method is safe // because |lock_| is only acquired in tasks on render thread. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stop_signal_received_) return; @@ -504,7 +528,7 @@ void BufferedDataSource::PartialReadStartCallback(int error) { // let tasks on render thread to run but make sure they don't call outside // this object when Stop() method is ever called. Locking this method is // safe because |lock_| is only acquired in tasks on render thread. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stop_signal_received_) return; DoneRead_Locked(net::ERR_INVALID_RESPONSE); @@ -534,7 +558,7 @@ void BufferedDataSource::ReadCallback(int error) { // let tasks on render thread to run but make sure they don't call outside // this object when Stop() method is ever called. Locking this method is safe // because |lock_| is only acquired in tasks on render thread. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stop_signal_received_) return; @@ -570,7 +594,7 @@ void BufferedDataSource::NetworkEventCallback() { // let tasks on render thread to run but make sure they don't call outside // this object when Stop() method is ever called. Locking this method is safe // because |lock_| is only acquired in tasks on render thread. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stop_signal_received_) return; diff --git a/webkit/glue/media/buffered_data_source.h b/webkit/glue/media/buffered_data_source.h index 1c4e3fa..895b259 100644 --- a/webkit/glue/media/buffered_data_source.h +++ b/webkit/glue/media/buffered_data_source.h @@ -8,8 +8,8 @@ #include #include "base/callback.h" -#include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "webkit/glue/media/buffered_resource_loader.h" namespace webkit_glue { @@ -62,8 +62,7 @@ class BufferedDataSource : public WebDataSource { void InitializeTask(); // Task posted to perform actual reading on the render thread. - void ReadTask(int64 position, int read_size, uint8* read_buffer, - media::DataSource::ReadCallback* read_callback); + void ReadTask(int64 position, int read_size, uint8* read_buffer); // Task posted when Stop() is called. Stops |watch_dog_timer_| and // |loader_|, reset Read() variables, and set |stopped_on_render_loop_| @@ -138,9 +137,6 @@ class BufferedDataSource : public WebDataSource { // A webframe for loading. WebKit::WebFrame* frame_; - // True if the media resource has a single origin. - bool single_origin_; - // A resource loader for the media resource. scoped_refptr loader_; @@ -175,7 +171,7 @@ class BufferedDataSource : public WebDataSource { MessageLoop* render_loop_; // Protects |stopped_|. - Lock lock_; + base::Lock lock_; // Stop signal to suppressing activities. This variable is set on the pipeline // thread and read from the render thread. diff --git a/webkit/glue/media/buffered_data_source_unittest.cc b/webkit/glue/media/buffered_data_source_unittest.cc index dcb11ec..f370803 100644 --- a/webkit/glue/media/buffered_data_source_unittest.cc +++ b/webkit/glue/media/buffered_data_source_unittest.cc @@ -1,15 +1,16 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include #include "base/test/test_timeouts.h" +#include "media/base/mock_callback.h" #include "media/base/mock_filter_host.h" #include "media/base/mock_filters.h" #include "net/base/net_errors.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" #include "webkit/glue/media/buffered_data_source.h" #include "webkit/mocks/mock_webframe.h" @@ -104,7 +105,6 @@ class BufferedDataSourceTest : public testing::Test { } virtual ~BufferedDataSourceTest() { - ignore_result(frame_.release()); } void ExpectCreateAndStartResourceLoader(int start_error) { @@ -167,7 +167,6 @@ class BufferedDataSourceTest : public testing::Test { ON_CALL(*loader_, Read(_, _, _ , _)) .WillByDefault(DeleteArg<3>()); - StrictMock callback; ON_CALL(*loader_, instance_size()) .WillByDefault(Return(instance_size)); ON_CALL(*loader_, partial_response()) @@ -188,18 +187,13 @@ class BufferedDataSourceTest : public testing::Test { } else { EXPECT_CALL(host_, SetStreaming(true)); } - - EXPECT_CALL(callback, OnFilterCallback()); - EXPECT_CALL(callback, OnCallbackDestroyed()); } else { EXPECT_CALL(host_, SetError(media::PIPELINE_ERROR_NETWORK)); EXPECT_CALL(*loader_, Stop()); - EXPECT_CALL(callback, OnFilterCallback()); - EXPECT_CALL(callback, OnCallbackDestroyed()); } // Actual initialization of the data source. - data_source_->Initialize(url, callback.NewCallback()); + data_source_->Initialize(url, media::NewExpectedCallback()); message_loop_->RunAllPending(); if (initialized_ok) { @@ -220,10 +214,7 @@ class BufferedDataSourceTest : public testing::Test { EXPECT_CALL(*loader_, Stop()); } - StrictMock callback; - EXPECT_CALL(callback, OnFilterCallback()); - EXPECT_CALL(callback, OnCallbackDestroyed()); - data_source_->Stop(callback.NewCallback()); + data_source_->Stop(media::NewExpectedCallback()); message_loop_->RunAllPending(); } @@ -501,4 +492,70 @@ TEST_F(BufferedDataSourceTest, FileHasLoadedState) { StopDataSource(); } +// This test makes sure that Stop() does not require a task to run on +// |message_loop_| before it calls its callback. This prevents accidental +// introduction of a pipeline teardown deadlock. The pipeline owner blocks +// the render message loop while waiting for Stop() to complete. Since this +// object runs on the render message loop, Stop() will not complete if it +// requires a task to run on the the message loop that is being blocked. +TEST_F(BufferedDataSourceTest, StopDoesNotUseMessageLoopForCallback) { + InitializeDataSource(kFileUrl, net::OK, true, 1024, LOADED); + + // Create a callback that lets us verify that it was called before + // Stop() returns. This is to make sure that the callback does not + // require |message_loop_| to execute tasks before being called. + media::MockCallback* stop_callback = media::NewExpectedCallback(); + bool stop_done_called = false; + ON_CALL(*stop_callback, RunWithParams(_)) + .WillByDefault(Assign(&stop_done_called, true)); + + // Stop() the data source like normal. + data_source_->Stop(stop_callback); + + // Verify that the callback was called inside the Stop() call. + EXPECT_TRUE(stop_done_called); + + message_loop_->RunAllPending(); +} + +TEST_F(BufferedDataSourceTest, AbortDuringPendingRead) { + InitializeDataSource(kFileUrl, net::OK, true, 1024, LOADED); + + // Setup a way to verify that Read() is not called on the loader. + // We are doing this to make sure that the ReadTask() is still on + // the message loop queue when Abort() is called. + bool read_called = false; + ON_CALL(*loader_, Read(_, _, _ , _)) + .WillByDefault(DoAll(Assign(&read_called, true), + DeleteArg<3>())); + + // Initiate a Read() on the data source, but don't allow the + // message loop to run. + data_source_->Read( + 0, 10, buffer_, + NewCallback(static_cast(this), + &BufferedDataSourceTest::ReadCallback)); + + // Call Abort() with the read pending. + EXPECT_CALL(*this, ReadCallback(-1)); + EXPECT_CALL(*loader_, Stop()); + data_source_->Abort(); + + // Verify that Read()'s after the Abort() issue callback with an error. + EXPECT_CALL(*this, ReadCallback(-1)); + data_source_->Read( + 0, 10, buffer_, + NewCallback(static_cast(this), + &BufferedDataSourceTest::ReadCallback)); + + // Stop() the data source like normal. + data_source_->Stop(media::NewExpectedCallback()); + + // Allow cleanup task to run. + message_loop_->RunAllPending(); + + // Verify that Read() was not called on the loader. + EXPECT_FALSE(read_called); +} + } // namespace webkit_glue diff --git a/webkit/glue/media/buffered_resource_loader.cc b/webkit/glue/media/buffered_resource_loader.cc index 61aac72..a86d2dd 100644 --- a/webkit/glue/media/buffered_resource_loader.cc +++ b/webkit/glue/media/buffered_resource_loader.cc @@ -7,10 +7,10 @@ #include "base/format_macros.h" #include "base/string_util.h" #include "net/base/net_errors.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" #include "webkit/glue/multipart_response_delegate.h" #include "webkit/glue/webkit_glue.h" @@ -61,6 +61,7 @@ BufferedResourceLoader::BufferedResourceLoader( url_(url), first_byte_position_(first_byte_position), last_byte_position_(last_byte_position), + single_origin_(true), start_callback_(NULL), offset_(0), content_length_(kPositionNotSpecified), @@ -255,6 +256,10 @@ void BufferedResourceLoader::willSendRequest( return; } + // Only allow |single_origin_| if we haven't seen a different origin yet. + if (single_origin_) + single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin(); + url_ = newRequest.url(); } @@ -425,6 +430,10 @@ void BufferedResourceLoader::didFail( Release(); } +bool BufferedResourceLoader::HasSingleOrigin() const { + return single_origin_; +} + ///////////////////////////////////////////////////////////////////////////// // Helper methods. void BufferedResourceLoader::EnableDeferIfNeeded() { diff --git a/webkit/glue/media/buffered_resource_loader.h b/webkit/glue/media/buffered_resource_loader.h index 09b05e6..fe01fb4 100644 --- a/webkit/glue/media/buffered_resource_loader.h +++ b/webkit/glue/media/buffered_resource_loader.h @@ -8,16 +8,15 @@ #include #include "base/callback.h" -#include "base/lock.h" #include "base/scoped_ptr.h" #include "base/timer.h" #include "googleurl/src/gurl.h" #include "media/base/seekable_buffer.h" #include "net/base/file_stream.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLLoader.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoader.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" #include "webkit/glue/media/web_data_source.h" #include "webkit/glue/webmediaplayer_impl.h" @@ -140,6 +139,8 @@ class BufferedResourceLoader : WebKit::WebURLLoader* loader, const WebKit::WebURLError&); + bool HasSingleOrigin() const; + protected: friend class base::RefCountedThreadSafe; @@ -213,6 +214,7 @@ class BufferedResourceLoader : GURL url_; int64 first_byte_position_; int64 last_byte_position_; + bool single_origin_; // Callback method that listens to network events. scoped_ptr event_callback_; diff --git a/webkit/glue/media/buffered_resource_loader_unittest.cc b/webkit/glue/media/buffered_resource_loader_unittest.cc index 8e64c26..dc67edf 100644 --- a/webkit/glue/media/buffered_resource_loader_unittest.cc +++ b/webkit/glue/media/buffered_resource_loader_unittest.cc @@ -8,11 +8,11 @@ #include "base/stringprintf.h" #include "net/base/net_errors.h" #include "net/http/http_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrameClient.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" -#include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/glue/media/buffered_resource_loader.h" #include "webkit/mocks/mock_webframe.h" #include "webkit/mocks/mock_weburlloader.h" @@ -41,6 +41,11 @@ using WebKit::WebView; namespace { const char* kHttpUrl = "http://test"; +const char kHttpRedirectToSameDomainUrl1[] = "http://test/ing"; +const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2"; +const char kHttpRedirectToDifferentDomainUrl1[] = "http://test2"; +const char kHttpRedirectToDifferentDomainUrl2[] = "http://test2/ing"; + const int kDataSize = 1024; const int kHttpOK = 200; const int kHttpPartialContent = 206; @@ -67,14 +72,11 @@ ACTION_P(RequestCanceled, loader) { class BufferedResourceLoaderTest : public testing::Test { public: BufferedResourceLoaderTest() { - url_loader_ = new NiceMock(); - for (int i = 0; i < kDataSize; ++i) data_[i] = i; } virtual ~BufferedResourceLoaderTest() { - ignore_result(frame_.release()); } void Initialize(const char* url, int first_position, int last_position) { @@ -84,6 +86,7 @@ class BufferedResourceLoaderTest : public testing::Test { frame_.reset(new NiceMock()); + url_loader_ = new NiceMock(); loader_ = new BufferedResourceLoader(gurl_, first_position_, last_position_); loader_->SetURLLoaderForTest(url_loader_); @@ -138,11 +141,22 @@ class BufferedResourceLoaderTest : public testing::Test { EXPECT_TRUE(loader_->partial_response()); } + void Redirect(const char* url) { + GURL redirectUrl(url); + WebKit::WebURLRequest newRequest(redirectUrl); + WebKit::WebURLResponse redirectResponse(gurl_); + + loader_->willSendRequest(url_loader_, newRequest, redirectResponse); + + MessageLoop::current()->RunAllPending(); + } + void StopWhenLoad() { InSequence s; EXPECT_CALL(*url_loader_, cancel()) .WillOnce(RequestCanceled(loader_)); loader_->Stop(); + loader_ = NULL; } // Helper method to write to |loader_| from |data_|. @@ -480,7 +494,64 @@ TEST_F(BufferedResourceLoaderTest, AllowDefer_DeferredReadPastWindow) { ReadLoader(20, 5, buffer); StopWhenLoad(); } + +// NOTE: This test will need to be reworked a little once +// http://code.google.com/p/chromium/issues/detail?id=72578 +// is fixed. +TEST_F(BufferedResourceLoaderTest, HasSingleOrigin) { + // Make sure no redirect case works as expected. + Initialize(kHttpUrl, -1, -1); + Start(); + FullResponse(1024); + EXPECT_TRUE(loader_->HasSingleOrigin()); + StopWhenLoad(); + + // Test redirect to the same domain. + Initialize(kHttpUrl, -1, -1); + Start(); + Redirect(kHttpRedirectToSameDomainUrl1); + FullResponse(1024); + EXPECT_TRUE(loader_->HasSingleOrigin()); + StopWhenLoad(); + + // Test redirect twice to the same domain. + Initialize(kHttpUrl, -1, -1); + Start(); + Redirect(kHttpRedirectToSameDomainUrl1); + Redirect(kHttpRedirectToSameDomainUrl2); + FullResponse(1024); + EXPECT_TRUE(loader_->HasSingleOrigin()); + StopWhenLoad(); + + // Test redirect to a different domain. + Initialize(kHttpUrl, -1, -1); + Start(); + Redirect(kHttpRedirectToDifferentDomainUrl1); + FullResponse(1024); + EXPECT_FALSE(loader_->HasSingleOrigin()); + StopWhenLoad(); + + // Test redirect twice to a different domain. + Initialize(kHttpUrl, -1, -1); + Start(); + Redirect(kHttpRedirectToDifferentDomainUrl1); + Redirect(kHttpRedirectToDifferentDomainUrl2); + FullResponse(1024); + EXPECT_FALSE(loader_->HasSingleOrigin()); + StopWhenLoad(); + + // Test to a different domain and then back to the same domain. + // NOTE: A different origin was encountered at least once so that + // makes HasSingleOrigin() become false. + Initialize(kHttpUrl, -1, -1); + Start(); + Redirect(kHttpRedirectToDifferentDomainUrl1); + Redirect(kHttpRedirectToSameDomainUrl1); + FullResponse(1024); + EXPECT_FALSE(loader_->HasSingleOrigin()); + StopWhenLoad(); +} + // TODO(hclam): add unit test for defer loading. } // namespace webkit_glue - diff --git a/webkit/glue/media/simple_data_source.cc b/webkit/glue/media/simple_data_source.cc index 8869e28..07f7587 100644 --- a/webkit/glue/media/simple_data_source.cc +++ b/webkit/glue/media/simple_data_source.cc @@ -10,8 +10,8 @@ #include "net/base/data_url.h" #include "net/base/load_flags.h" #include "net/url_request/url_request_status.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" #include "webkit/glue/webkit_glue.h" namespace { @@ -35,12 +35,12 @@ SimpleDataSource::SimpleDataSource( } SimpleDataSource::~SimpleDataSource() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(state_ == UNINITIALIZED || state_ == STOPPED); } void SimpleDataSource::Stop(media::FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); state_ = STOPPED; if (callback) { callback->Run(); @@ -54,7 +54,7 @@ void SimpleDataSource::Stop(media::FilterCallback* callback) { void SimpleDataSource::Initialize(const std::string& url, media::FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK_EQ(state_, UNINITIALIZED); DCHECK(callback); state_ = INITIALIZING; @@ -113,7 +113,10 @@ void SimpleDataSource::willSendRequest( WebKit::WebURLRequest& newRequest, const WebKit::WebURLResponse& redirectResponse) { DCHECK(MessageLoop::current() == render_loop_); - single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin(); + + // Only allow |single_origin_| if we haven't seen a different origin yet. + if (single_origin_) + single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin(); url_ = newRequest.url(); } @@ -157,7 +160,7 @@ void SimpleDataSource::didFinishLoading( WebKit::WebURLLoader* loader, double finishTime) { DCHECK(MessageLoop::current() == render_loop_); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // It's possible this gets called after Stop(), in which case |host_| is no // longer valid. if (state_ == STOPPED) @@ -179,7 +182,7 @@ void SimpleDataSource::didFail( WebKit::WebURLLoader* loader, const WebKit::WebURLError& error) { DCHECK(MessageLoop::current() == render_loop_); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // It's possible this gets called after Stop(), in which case |host_| is no // longer valid. if (state_ == STOPPED) @@ -217,7 +220,7 @@ void SimpleDataSource::SetURL(const GURL& url) { void SimpleDataSource::StartTask() { DCHECK(MessageLoop::current() == render_loop_); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // We may have stopped. if (state_ == STOPPED) @@ -253,7 +256,7 @@ void SimpleDataSource::StartTask() { void SimpleDataSource::CancelTask() { DCHECK(MessageLoop::current() == render_loop_); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK_EQ(state_, STOPPED); // Cancel any pending requests. diff --git a/webkit/glue/media/simple_data_source.h b/webkit/glue/media/simple_data_source.h index f4c83e6..10d93ff 100644 --- a/webkit/glue/media/simple_data_source.h +++ b/webkit/glue/media/simple_data_source.h @@ -16,11 +16,11 @@ #include "base/message_loop.h" #include "base/scoped_ptr.h" #include "media/base/filters.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLLoader.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoader.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" #include "webkit/glue/media/web_data_source.h" class MessageLoop; @@ -120,7 +120,7 @@ class SimpleDataSource : public WebDataSource, State state_; // Used for accessing |state_|. - Lock lock_; + base::Lock lock_; // Filter callbacks. scoped_ptr initialize_callback_; diff --git a/webkit/glue/media/simple_data_source_unittest.cc b/webkit/glue/media/simple_data_source_unittest.cc index 55dc913..a9a70a4 100644 --- a/webkit/glue/media/simple_data_source_unittest.cc +++ b/webkit/glue/media/simple_data_source_unittest.cc @@ -1,17 +1,17 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/callback.h" #include "media/base/filters.h" +#include "media/base/mock_callback.h" #include "media/base/mock_filter_host.h" #include "media/base/mock_filters.h" #include "net/base/net_errors.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLLoader.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoader.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" #include "webkit/glue/media/simple_data_source.h" #include "webkit/mocks/mock_webframe.h" #include "webkit/mocks/mock_weburlloader.h" @@ -42,6 +42,10 @@ const char kDataUrl[] = "data:text/plain;base64,YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoK"; const char kDataUrlDecoded[] = "abcdefghijklmnopqrstuvwxyz"; const char kInvalidUrl[] = "whatever://test"; +const char kHttpRedirectToSameDomainUrl1[] = "http://test/ing"; +const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2"; +const char kHttpRedirectToDifferentDomainUrl1[] = "http://test2"; +const char kHttpRedirectToDifferentDomainUrl2[] = "http://test2/ing"; } // namespace @@ -56,10 +60,10 @@ class SimpleDataSourceTest : public testing::Test { } virtual ~SimpleDataSourceTest() { - ignore_result(frame_.release()); } - void InitializeDataSource(const char* url) { + void InitializeDataSource(const char* url, + media::MockCallback* callback) { gurl_ = GURL(url); frame_.reset(new NiceMock()); @@ -72,9 +76,7 @@ class SimpleDataSourceTest : public testing::Test { data_source_->set_host(&host_); data_source_->SetURLLoaderForTest(url_loader_); - InSequence s; - - data_source_->Initialize(url, callback_.NewCallback()); + data_source_->Initialize(url, callback); MessageLoop::current()->RunAllPending(); } @@ -96,8 +98,6 @@ class SimpleDataSourceTest : public testing::Test { InSequence s; EXPECT_CALL(host_, SetTotalBytes(kDataSize)); EXPECT_CALL(host_, SetBufferedBytes(kDataSize)); - EXPECT_CALL(callback_, OnFilterCallback()); - EXPECT_CALL(callback_, OnCallbackDestroyed()); data_source_->didFinishLoading(NULL, 0); @@ -108,8 +108,6 @@ class SimpleDataSourceTest : public testing::Test { void RequestFailed() { InSequence s; EXPECT_CALL(host_, SetError(media::PIPELINE_ERROR_NETWORK)); - EXPECT_CALL(callback_, OnFilterCallback()); - EXPECT_CALL(callback_, OnCallbackDestroyed()); WebURLError error; error.reason = net::ERR_FAILED; @@ -119,12 +117,18 @@ class SimpleDataSourceTest : public testing::Test { MessageLoop::current()->RunAllPending(); } - void DestroyDataSource() { - StrictMock callback; - EXPECT_CALL(callback, OnFilterCallback()); - EXPECT_CALL(callback, OnCallbackDestroyed()); + void Redirect(const char* url) { + GURL redirectUrl(url); + WebKit::WebURLRequest newRequest(redirectUrl); + WebKit::WebURLResponse redirectResponse(gurl_); + + data_source_->willSendRequest(url_loader_, newRequest, redirectResponse); + + MessageLoop::current()->RunAllPending(); + } - data_source_->Stop(callback.NewCallback()); + void DestroyDataSource() { + data_source_->Stop(media::NewExpectedCallback()); MessageLoop::current()->RunAllPending(); data_source_ = NULL; @@ -150,7 +154,6 @@ class SimpleDataSourceTest : public testing::Test { NiceMock* url_loader_; scoped_refptr data_source_; StrictMock host_; - StrictMock callback_; scoped_ptr > frame_; char data_[kDataSize]; @@ -159,19 +162,19 @@ class SimpleDataSourceTest : public testing::Test { }; TEST_F(SimpleDataSourceTest, InitializeHTTP) { - InitializeDataSource(kHttpUrl); + InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); RequestSucceeded(false); DestroyDataSource(); } TEST_F(SimpleDataSourceTest, InitializeHTTPS) { - InitializeDataSource(kHttpsUrl); + InitializeDataSource(kHttpsUrl, media::NewExpectedCallback()); RequestSucceeded(false); DestroyDataSource(); } TEST_F(SimpleDataSourceTest, InitializeFile) { - InitializeDataSource(kFileUrl); + InitializeDataSource(kFileUrl, media::NewExpectedCallback()); RequestSucceeded(true); DestroyDataSource(); } @@ -191,34 +194,88 @@ TEST_F(SimpleDataSourceTest, InitializeData) { EXPECT_CALL(host_, SetLoaded(true)); EXPECT_CALL(host_, SetTotalBytes(sizeof(kDataUrlDecoded))); EXPECT_CALL(host_, SetBufferedBytes(sizeof(kDataUrlDecoded))); - EXPECT_CALL(callback_, OnFilterCallback()); - EXPECT_CALL(callback_, OnCallbackDestroyed()); - data_source_->Initialize(kDataUrl, callback_.NewCallback()); + data_source_->Initialize(kDataUrl, media::NewExpectedCallback()); MessageLoop::current()->RunAllPending(); DestroyDataSource(); } TEST_F(SimpleDataSourceTest, RequestFailed) { - InitializeDataSource(kHttpUrl); + InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); RequestFailed(); DestroyDataSource(); } TEST_F(SimpleDataSourceTest, StopWhenDownloading) { - InitializeDataSource(kHttpUrl); + // The callback should be deleted, but not executed. + // TODO(scherkus): should this really be the behaviour? Seems strange... + StrictMock* callback = + new StrictMock(); + EXPECT_CALL(*callback, Destructor()); + + InitializeDataSource(kHttpUrl, callback); EXPECT_CALL(*url_loader_, cancel()); - EXPECT_CALL(callback_, OnCallbackDestroyed()); DestroyDataSource(); } TEST_F(SimpleDataSourceTest, AsyncRead) { - InitializeDataSource(kFileUrl); + InitializeDataSource(kFileUrl, media::NewExpectedCallback()); RequestSucceeded(true); AsyncRead(); DestroyDataSource(); } +// NOTE: This test will need to be reworked a little once +// http://code.google.com/p/chromium/issues/detail?id=72578 +// is fixed. +TEST_F(SimpleDataSourceTest, HasSingleOrigin) { + // Make sure no redirect case works as expected. + InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); + RequestSucceeded(false); + EXPECT_TRUE(data_source_->HasSingleOrigin()); + DestroyDataSource(); + + // Test redirect to the same domain. + InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); + Redirect(kHttpRedirectToSameDomainUrl1); + RequestSucceeded(false); + EXPECT_TRUE(data_source_->HasSingleOrigin()); + DestroyDataSource(); + + // Test redirect twice to the same domain. + InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); + Redirect(kHttpRedirectToSameDomainUrl1); + Redirect(kHttpRedirectToSameDomainUrl2); + RequestSucceeded(false); + EXPECT_TRUE(data_source_->HasSingleOrigin()); + DestroyDataSource(); + + // Test redirect to a different domain. + InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); + Redirect(kHttpRedirectToDifferentDomainUrl1); + RequestSucceeded(false); + EXPECT_FALSE(data_source_->HasSingleOrigin()); + DestroyDataSource(); + + // Test redirect twice to a different domain. + InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); + Redirect(kHttpRedirectToDifferentDomainUrl1); + Redirect(kHttpRedirectToDifferentDomainUrl2); + RequestSucceeded(false); + EXPECT_FALSE(data_source_->HasSingleOrigin()); + DestroyDataSource(); + + // Test to a different domain and then back to the same domain. + // NOTE: A different origin was encountered at least once so that + // makes HasSingleOrigin() become false. + InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); + Redirect(kHttpRedirectToDifferentDomainUrl1); + Redirect(kHttpRedirectToSameDomainUrl1); + RequestSucceeded(false); + EXPECT_FALSE(data_source_->HasSingleOrigin()); + DestroyDataSource(); +} + } // namespace webkit_glue diff --git a/webkit/glue/media/video_renderer_impl.h b/webkit/glue/media/video_renderer_impl.h index 34c67d3..b73c099 100644 --- a/webkit/glue/media/video_renderer_impl.h +++ b/webkit/glue/media/video_renderer_impl.h @@ -10,13 +10,13 @@ #ifndef WEBKIT_GLUE_MEDIA_VIDEO_RENDERER_IMPL_H_ #define WEBKIT_GLUE_MEDIA_VIDEO_RENDERER_IMPL_H_ -#include "gfx/rect.h" -#include "gfx/size.h" #include "media/base/buffers.h" #include "media/base/filters.h" #include "media/filters/video_renderer_base.h" #include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayer.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" +#include "ui/gfx/rect.h" +#include "ui/gfx/size.h" #include "webkit/glue/media/web_video_renderer.h" #include "webkit/glue/webmediaplayer_impl.h" diff --git a/webkit/glue/mimetype_unittest.cc b/webkit/glue/mimetype_unittest.cc index 3f17e79..00be1a5 100644 --- a/webkit/glue/mimetype_unittest.cc +++ b/webkit/glue/mimetype_unittest.cc @@ -5,9 +5,9 @@ #include #include "base/string_util.h" -#include "net/url_request/url_request_unittest.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "net/url_request/url_request_test_util.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/glue/unittest_test_server.h" #include "webkit/glue/webkit_glue.h" #include "webkit/tools/test_shell/test_shell_test.h" diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc index b8c7758..d2c47d7 100644 --- a/webkit/glue/multipart_response_delegate.cc +++ b/webkit/glue/multipart_response_delegate.cc @@ -9,10 +9,10 @@ #include "base/string_util.h" #include "net/base/net_util.h" #include "net/http/http_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebHTTPHeaderVisitor.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebHTTPHeaderVisitor.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderClient.h" using WebKit::WebHTTPHeaderVisitor; using WebKit::WebString; @@ -291,9 +291,8 @@ bool MultipartResponseDelegate::ReadMultipartBoundary( response.httpHeaderField(WebString::fromUTF8("Content-Type")).utf8(); size_t boundary_start_offset = content_type.find("boundary="); - if (boundary_start_offset == std::wstring::npos) { + if (boundary_start_offset == std::string::npos) return false; - } boundary_start_offset += strlen("boundary="); diff --git a/webkit/glue/multipart_response_delegate.h b/webkit/glue/multipart_response_delegate.h index 0500983..d4583bb 100644 --- a/webkit/glue/multipart_response_delegate.h +++ b/webkit/glue/multipart_response_delegate.h @@ -52,7 +52,7 @@ #include #include "base/basictypes.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" namespace WebKit { class WebURLLoader; diff --git a/webkit/glue/multipart_response_delegate_unittest.cc b/webkit/glue/multipart_response_delegate_unittest.cc index 1837cb5..fbefaaa 100644 --- a/webkit/glue/multipart_response_delegate_unittest.cc +++ b/webkit/glue/multipart_response_delegate_unittest.cc @@ -5,10 +5,10 @@ #include #include "base/basictypes.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" #include "webkit/glue/multipart_response_delegate.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/webkit/glue/npruntime_util.cc b/webkit/glue/npruntime_util.cc index dfc3a2b..a408770 100644 --- a/webkit/glue/npruntime_util.cc +++ b/webkit/glue/npruntime_util.cc @@ -5,7 +5,7 @@ #include "webkit/glue/npruntime_util.h" #include "base/pickle.h" -#include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" using WebKit::WebBindings; diff --git a/webkit/glue/password_form.h b/webkit/glue/password_form.h index c2967a4..e48420c 100644 --- a/webkit/glue/password_form.h +++ b/webkit/glue/password_form.h @@ -10,7 +10,7 @@ #include "base/time.h" #include "googleurl/src/gurl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPasswordFormData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPasswordFormData.h" namespace webkit_glue { diff --git a/webkit/glue/password_form_dom_manager.cc b/webkit/glue/password_form_dom_manager.cc index 97f3eef..be4bc76 100644 --- a/webkit/glue/password_form_dom_manager.cc +++ b/webkit/glue/password_form_dom_manager.cc @@ -5,8 +5,8 @@ #include "webkit/glue/password_form_dom_manager.h" #include "base/logging.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPasswordFormData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPasswordFormData.h" #include "webkit/glue/form_field.h" using WebKit::WebFormElement; diff --git a/webkit/glue/plugins/plugin_list.h b/webkit/glue/plugins/plugin_list.h index 111e8fa..580d8dd 100644 --- a/webkit/glue/plugins/plugin_list.h +++ b/webkit/glue/plugins/plugin_list.h @@ -18,7 +18,6 @@ namespace NPAPI { typedef webkit::npapi::PluginEntryPoints PluginEntryPoints; -typedef webkit::npapi::PluginVersionInfo PluginVersionInfo; class PluginList { public: diff --git a/webkit/glue/regular_expression_unittest.cc b/webkit/glue/regular_expression_unittest.cc index 39741f8..9713c39 100644 --- a/webkit/glue/regular_expression_unittest.cc +++ b/webkit/glue/regular_expression_unittest.cc @@ -3,9 +3,9 @@ // found in the LICENSE file. #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRegularExpression.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebTextCaseSensitivity.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebRegularExpression.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCaseSensitivity.h" using namespace WebKit; diff --git a/webkit/glue/resource_fetcher.cc b/webkit/glue/resource_fetcher.cc index 9b00805..39cc59c 100644 --- a/webkit/glue/resource_fetcher.cc +++ b/webkit/glue/resource_fetcher.cc @@ -5,13 +5,13 @@ #include "webkit/glue/resource_fetcher.h" #include "base/logging.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLLoader.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoader.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" using base::TimeDelta; using WebKit::WebFrame; @@ -25,8 +25,8 @@ namespace webkit_glue { ResourceFetcher::ResourceFetcher(const GURL& url, WebFrame* frame, Callback* c) : url_(url), - callback_(c), - completed_(false) { + completed_(false), + callback_(c) { // Can't do anything without a frame. However, delegate can be NULL (so we // can do a http request and ignore the results). DCHECK(frame); @@ -53,6 +53,18 @@ void ResourceFetcher::Start(WebFrame* frame) { loader_->loadAsynchronously(request, this); } +void ResourceFetcher::RunCallback(const WebURLResponse& response, + const std::string& data) { + if (!callback_.get()) + return; + + // Take care to clear callback_ before running the callback as it may lead to + // our destruction. + scoped_ptr callback; + callback.swap(callback_); + callback->Run(response, data); +} + ///////////////////////////////////////////////////////////////////////////// // WebURLLoaderClient methods @@ -93,10 +105,7 @@ void ResourceFetcher::didFinishLoading( DCHECK(!completed_); completed_ = true; - if (callback_.get()) { - callback_->Run(response_, data_); - callback_.reset(); - } + RunCallback(response_, data_); } void ResourceFetcher::didFail(WebURLLoader* loader, const WebURLError& error) { @@ -104,10 +113,7 @@ void ResourceFetcher::didFail(WebURLLoader* loader, const WebURLError& error) { completed_ = true; // Go ahead and tell our delegate that we're done. - if (callback_.get()) { - callback_->Run(WebURLResponse(), std::string()); - callback_.reset(); - } + RunCallback(WebURLResponse(), std::string()); } ///////////////////////////////////////////////////////////////////////////// diff --git a/webkit/glue/resource_fetcher.h b/webkit/glue/resource_fetcher.h index ff00939..eb9411b 100644 --- a/webkit/glue/resource_fetcher.h +++ b/webkit/glue/resource_fetcher.h @@ -19,8 +19,8 @@ #include "base/scoped_ptr.h" #include "base/timer.h" #include "googleurl/src/gurl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" class GURL; @@ -75,9 +75,6 @@ class ResourceFetcher : public WebKit::WebURLLoaderClient { // URL we're fetching GURL url_; - // Callback when we're done - scoped_ptr callback_; - // A copy of the original resource response WebKit::WebURLResponse response_; @@ -88,6 +85,12 @@ class ResourceFetcher : public WebKit::WebURLLoaderClient { // Start the actual download. void Start(WebKit::WebFrame* frame); + void RunCallback(const WebKit::WebURLResponse& response, + const std::string& data); + + // Callback when we're done + scoped_ptr callback_; + // Buffer to hold the content from the server. std::string data_; diff --git a/webkit/glue/resource_fetcher_unittest.cc b/webkit/glue/resource_fetcher_unittest.cc index 3ac004e..965d285 100644 --- a/webkit/glue/resource_fetcher_unittest.cc +++ b/webkit/glue/resource_fetcher_unittest.cc @@ -6,17 +6,14 @@ #include "base/callback.h" #include "base/message_loop.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" -#include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "base/timer.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/glue/unittest_test_server.h" #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" #include "webkit/tools/test_shell/test_shell_test.h" -#if defined(TOOLKIT_USES_GTK) -#include -#endif - using WebKit::WebFrame; using WebKit::WebURLResponse; using webkit_glue::ResourceFetcher; @@ -30,35 +27,34 @@ class ResourceFetcherTests : public TestShellTest { }; static const int kMaxWaitTimeMs = 5000; -static const int kWaitIntervalMs = 100; class FetcherDelegate { public: FetcherDelegate() - : timer_id_(0), completed_(false), time_elapsed_ms_(0) { + : completed_(false), + timed_out_(false) { // Start a repeating timer waiting for the download to complete. The // callback has to be a static function, so we hold on to our instance. FetcherDelegate::instance_ = this; - CreateTimer(kWaitIntervalMs); + StartTimer(); } ResourceFetcher::Callback* NewCallback() { return ::NewCallback(this, &FetcherDelegate::OnURLFetchComplete); } - void OnURLFetchComplete(const WebURLResponse& response, - const std::string& data) { + virtual void OnURLFetchComplete(const WebURLResponse& response, + const std::string& data) { response_ = response; data_ = data; completed_ = true; - DestroyTimer(); + timer_.Stop(); MessageLoop::current()->Quit(); } bool completed() const { return completed_; } - bool timed_out() const { return time_elapsed_ms_ > kMaxWaitTimeMs; } + bool timed_out() const { return timed_out_; } - int time_elapsed_ms() const { return time_elapsed_ms_; } std::string data() const { return data_; } const WebURLResponse& response() const { return response_; } @@ -70,78 +66,26 @@ class FetcherDelegate { MessageLoop::current()->Run(); } - void CreateTimer(int interval) { -#if defined(OS_WIN) - timer_id_ = ::SetTimer(NULL, NULL, interval, - &FetcherDelegate::TimerCallback); -#elif defined(TOOLKIT_USES_GTK) - timer_id_ = g_timeout_add(interval, &FetcherDelegate::TimerCallback, NULL); -#elif defined(OS_MACOSX) - // CFAbsoluteTime is in seconds and |interval| is in ms, so make sure we - // keep the units correct. - CFTimeInterval interval_in_seconds = static_cast(interval) / 1000.0; - CFAbsoluteTime fire_date = - CFAbsoluteTimeGetCurrent() + interval_in_seconds; - timer_id_ = CFRunLoopTimerCreate(NULL, fire_date, interval_in_seconds, 0, - 0, FetcherDelegate::TimerCallback, NULL); - CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer_id_, kCFRunLoopCommonModes); -#endif - } - - void DestroyTimer() { -#if defined(OS_WIN) - ::KillTimer(NULL, timer_id_); -#elif defined(TOOLKIT_USES_GTK) - g_source_remove(timer_id_); -#elif defined(OS_MACOSX) - CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), timer_id_, - kCFRunLoopCommonModes); - CFRelease(timer_id_); -#endif - } - -#if defined(OS_WIN) - // Static timer callback, just passes through to instance version. - static VOID CALLBACK TimerCallback(HWND hwnd, UINT msg, UINT_PTR timer_id, - DWORD ms) { - instance_->TimerFired(); - } -#elif defined(TOOLKIT_USES_GTK) - static gboolean TimerCallback(gpointer data) { - instance_->TimerFired(); - return true; - } -#elif defined(OS_MACOSX) - static void TimerCallback(CFRunLoopTimerRef timer, void* info) { - instance_->TimerFired(); + void StartTimer() { + timer_.Start(base::TimeDelta::FromMilliseconds(kMaxWaitTimeMs), + this, + &FetcherDelegate::TimerFired); } -#endif void TimerFired() { ASSERT_FALSE(completed_); - if (timed_out()) { - DestroyTimer(); - MessageLoop::current()->Quit(); - FAIL() << "fetch timed out"; - return; - } - - time_elapsed_ms_ += kWaitIntervalMs; + timed_out_ = true; + MessageLoop::current()->Quit(); + FAIL() << "fetch timed out"; } static FetcherDelegate* instance_; private: -#if defined(OS_WIN) - UINT_PTR timer_id_; -#elif defined(TOOLKIT_USES_GTK) - guint timer_id_; -#elif defined(OS_MACOSX) - CFRunLoopTimerRef timer_id_; -#endif + base::OneShotTimer timer_; bool completed_; - int time_elapsed_ms_; + bool timed_out_; WebURLResponse response_; std::string data_; }; @@ -198,7 +142,7 @@ TEST_F(ResourceFetcherTests, FLAKY_ResourceFetcherDidFail) { EXPECT_TRUE(delegate->completed()); EXPECT_TRUE(delegate->response().isNull()); EXPECT_EQ(delegate->data(), std::string()); - EXPECT_TRUE(delegate->time_elapsed_ms() < kMaxWaitTimeMs); + EXPECT_FALSE(delegate->timed_out()); } TEST_F(ResourceFetcherTests, ResourceFetcherTimeout) { @@ -220,7 +164,42 @@ TEST_F(ResourceFetcherTests, ResourceFetcherTimeout) { EXPECT_TRUE(delegate->completed()); EXPECT_TRUE(delegate->response().isNull()); EXPECT_EQ(delegate->data(), std::string()); - EXPECT_TRUE(delegate->time_elapsed_ms() < kMaxWaitTimeMs); + EXPECT_FALSE(delegate->timed_out()); +} + +class EvilFetcherDelegate : public FetcherDelegate { + public: + void SetFetcher(ResourceFetcher* fetcher) { + fetcher_.reset(fetcher); + } + + void OnURLFetchComplete(const WebURLResponse& response, + const std::string& data) { + // Destroy the ResourceFetcher here. We are testing that upon returning + // to the ResourceFetcher that it does not crash. + fetcher_.reset(); + FetcherDelegate::OnURLFetchComplete(response, data); + } + + private: + scoped_ptr fetcher_; +}; + +TEST_F(ResourceFetcherTests, ResourceFetcherDeletedInCallback) { + ASSERT_TRUE(test_server_.Start()); + + WebFrame* frame = test_shell_->webView()->mainFrame(); + + // Grab a page that takes at least 1 sec to respond, but set the fetcher to + // timeout in 0 sec. + GURL url(test_server_.GetURL("slow?1")); + scoped_ptr delegate(new EvilFetcherDelegate); + scoped_ptr fetcher(new ResourceFetcherWithTimeout( + url, frame, 0, delegate->NewCallback())); + delegate->SetFetcher(fetcher.release()); + + delegate->WaitForResponse(); + EXPECT_FALSE(delegate->timed_out()); } } // namespace diff --git a/webkit/glue/resource_loader_bridge.h b/webkit/glue/resource_loader_bridge.h index 85facfa..23ebb35 100644 --- a/webkit/glue/resource_loader_bridge.h +++ b/webkit/glue/resource_loader_bridge.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -248,7 +248,7 @@ class ResourceLoaderBridge { ~SyncLoadResponse(); // The response status. - URLRequestStatus status; + net::URLRequestStatus status; // The final URL of the response. This may differ from the request URL in // the case of a server redirect. diff --git a/webkit/glue/resources/linux-checkbox-disabled-indeterminate.png b/webkit/glue/resources/linux-checkbox-disabled-indeterminate.png deleted file mode 100644 index 171d001..0000000 Binary files a/webkit/glue/resources/linux-checkbox-disabled-indeterminate.png and /dev/null differ diff --git a/webkit/glue/resources/linux-checkbox-disabled-off.png b/webkit/glue/resources/linux-checkbox-disabled-off.png deleted file mode 100644 index c916674..0000000 Binary files a/webkit/glue/resources/linux-checkbox-disabled-off.png and /dev/null differ diff --git a/webkit/glue/resources/linux-checkbox-disabled-on.png b/webkit/glue/resources/linux-checkbox-disabled-on.png deleted file mode 100644 index d9ff1c6..0000000 Binary files a/webkit/glue/resources/linux-checkbox-disabled-on.png and /dev/null differ diff --git a/webkit/glue/resources/linux-checkbox-indeterminate.png b/webkit/glue/resources/linux-checkbox-indeterminate.png deleted file mode 100644 index dcde3c1..0000000 Binary files a/webkit/glue/resources/linux-checkbox-indeterminate.png and /dev/null differ diff --git a/webkit/glue/resources/linux-checkbox-off.png b/webkit/glue/resources/linux-checkbox-off.png deleted file mode 100644 index 15cc949..0000000 Binary files a/webkit/glue/resources/linux-checkbox-off.png and /dev/null differ diff --git a/webkit/glue/resources/linux-checkbox-on.png b/webkit/glue/resources/linux-checkbox-on.png deleted file mode 100644 index 4c72e8a..0000000 Binary files a/webkit/glue/resources/linux-checkbox-on.png and /dev/null differ diff --git a/webkit/glue/resources/linux-progress-bar.png b/webkit/glue/resources/linux-progress-bar.png deleted file mode 100644 index 82a20f5..0000000 Binary files a/webkit/glue/resources/linux-progress-bar.png and /dev/null differ diff --git a/webkit/glue/resources/linux-progress-border-left.png b/webkit/glue/resources/linux-progress-border-left.png deleted file mode 100644 index 0dd0e50..0000000 Binary files a/webkit/glue/resources/linux-progress-border-left.png and /dev/null differ diff --git a/webkit/glue/resources/linux-progress-border-right.png b/webkit/glue/resources/linux-progress-border-right.png deleted file mode 100644 index d351b11..0000000 Binary files a/webkit/glue/resources/linux-progress-border-right.png and /dev/null differ diff --git a/webkit/glue/resources/linux-progress-value.png b/webkit/glue/resources/linux-progress-value.png deleted file mode 100644 index 251917b..0000000 Binary files a/webkit/glue/resources/linux-progress-value.png and /dev/null differ diff --git a/webkit/glue/resources/linux-radio-disabled-off.png b/webkit/glue/resources/linux-radio-disabled-off.png deleted file mode 100644 index 97aa6f9..0000000 Binary files a/webkit/glue/resources/linux-radio-disabled-off.png and /dev/null differ diff --git a/webkit/glue/resources/linux-radio-disabled-on.png b/webkit/glue/resources/linux-radio-disabled-on.png deleted file mode 100644 index 07aed36..0000000 Binary files a/webkit/glue/resources/linux-radio-disabled-on.png and /dev/null differ diff --git a/webkit/glue/resources/linux-radio-off.png b/webkit/glue/resources/linux-radio-off.png deleted file mode 100644 index 6a60a70..0000000 Binary files a/webkit/glue/resources/linux-radio-off.png and /dev/null differ diff --git a/webkit/glue/resources/linux-radio-on.png b/webkit/glue/resources/linux-radio-on.png deleted file mode 100644 index cb47411..0000000 Binary files a/webkit/glue/resources/linux-radio-on.png and /dev/null differ diff --git a/webkit/glue/scoped_clipboard_writer_glue.h b/webkit/glue/scoped_clipboard_writer_glue.h index 7460ddf..13b96a3 100644 --- a/webkit/glue/scoped_clipboard_writer_glue.h +++ b/webkit/glue/scoped_clipboard_writer_glue.h @@ -5,7 +5,7 @@ #ifndef SCOPED_CLIPBOARD_WRITER_GLUE_H_ #define SCOPED_CLIPBOARD_WRITER_GLUE_H_ -#include "app/clipboard/scoped_clipboard_writer.h" +#include "ui/base/clipboard/scoped_clipboard_writer.h" class SkBitmap; @@ -13,10 +13,10 @@ namespace base { class SharedMemory; } -class ScopedClipboardWriterGlue : public ScopedClipboardWriter { +class ScopedClipboardWriterGlue : public ui::ScopedClipboardWriter { public: - ScopedClipboardWriterGlue(Clipboard* clipboard) - : ScopedClipboardWriter(clipboard), + ScopedClipboardWriterGlue(ui::Clipboard* clipboard) + : ui::ScopedClipboardWriter(clipboard), shared_buf_(NULL) { } diff --git a/webkit/glue/simple_webmimeregistry_impl.cc b/webkit/glue/simple_webmimeregistry_impl.cc index d878867..b785be7 100644 --- a/webkit/glue/simple_webmimeregistry_impl.cc +++ b/webkit/glue/simple_webmimeregistry_impl.cc @@ -8,7 +8,7 @@ #include "base/sys_string_conversions.h" #include "base/utf_string_conversions.h" #include "net/base/mime_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" #include "webkit/glue/webkit_glue.h" using WebKit::WebString; diff --git a/webkit/glue/simple_webmimeregistry_impl.h b/webkit/glue/simple_webmimeregistry_impl.h index f4f4d74..9796894 100644 --- a/webkit/glue/simple_webmimeregistry_impl.h +++ b/webkit/glue/simple_webmimeregistry_impl.h @@ -5,7 +5,7 @@ #ifndef WEBMIMEREGISTRY_IMPL_H_ #define WEBMIMEREGISTRY_IMPL_H_ -#include "third_party/WebKit/WebKit/chromium/public/WebMimeRegistry.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebMimeRegistry.h" namespace webkit_glue { diff --git a/webkit/glue/site_isolation_metrics.cc b/webkit/glue/site_isolation_metrics.cc index ecc1464..0dca500 100644 --- a/webkit/glue/site_isolation_metrics.cc +++ b/webkit/glue/site_isolation_metrics.cc @@ -9,12 +9,12 @@ #include "base/hash_tables.h" #include "base/metrics/histogram.h" #include "net/base/mime_sniffer.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" using WebKit::WebFrame; using WebKit::WebSecurityOrigin; diff --git a/webkit/glue/site_isolation_metrics.h b/webkit/glue/site_isolation_metrics.h index 53f1630..c2bd275 100644 --- a/webkit/glue/site_isolation_metrics.h +++ b/webkit/glue/site_isolation_metrics.h @@ -5,7 +5,7 @@ #ifndef WEBKIT_GLUE_SITE_ISOLATION_METRICS_H_ #define WEBKIT_GLUE_SITE_ISOLATION_METRICS_H_ -#include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" namespace WebKit { class WebFrame; diff --git a/webkit/glue/user_agent.cc b/webkit/glue/user_agent.cc index 4867c27..afd1c83 100644 --- a/webkit/glue/user_agent.cc +++ b/webkit/glue/user_agent.cc @@ -22,8 +22,14 @@ namespace webkit_glue { std::string GetProductVersion(); std::string GetWebKitVersion() { - return base::StringPrintf("%d.%d", WEBKIT_VERSION_MAJOR, - WEBKIT_VERSION_MINOR); + return base::StringPrintf("%d.%d (%s)", + WEBKIT_VERSION_MAJOR, + WEBKIT_VERSION_MINOR, + WEBKIT_SVN_REVISION); +} + +std::string GetWebKitRevision() { + return WEBKIT_SVN_REVISION; } std::string BuildOSCpuInfo() { diff --git a/webkit/glue/user_agent.h b/webkit/glue/user_agent.h index 3d1f788..62c8324 100644 --- a/webkit/glue/user_agent.h +++ b/webkit/glue/user_agent.h @@ -19,7 +19,7 @@ void BuildUserAgent(bool mimic_windows, std::string* result); // Builds a User-agent compatible string that describes the OS and CPU type. std::string BuildOSCpuInfo(); -// Returns the WebKit version (major.minor). +// Returns the WebKit version, in the form "major.minor (branch@revision)". std::string GetWebKitVersion(); } // namespace webkit_glue diff --git a/webkit/glue/web_io_operators.cc b/webkit/glue/web_io_operators.cc index 9a53212..c053863 100644 --- a/webkit/glue/web_io_operators.cc +++ b/webkit/glue/web_io_operators.cc @@ -4,14 +4,14 @@ #include "webkit/glue/web_io_operators.h" -#include "gfx/point.h" -#include "gfx/rect.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" +#include "ui/gfx/point.h" +#include "ui/gfx/rect.h" #if defined(WCHAR_T_IS_UTF32) #include "base/string16.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" #endif // defined(WCHAR_T_IS_UTF32) namespace WebKit { diff --git a/webkit/glue/webaccessibility.cc b/webkit/glue/webaccessibility.cc index c3ef261..b96266b 100644 --- a/webkit/glue/webaccessibility.cc +++ b/webkit/glue/webaccessibility.cc @@ -7,20 +7,20 @@ #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityCache.h" -#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" -#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityRole.h" -#include "third_party/WebKit/WebKit/chromium/public/WebAttribute.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDocumentType.h" -#include "third_party/WebKit/WebKit/chromium/public/WebElement.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFormControlElement.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" -#include "third_party/WebKit/WebKit/chromium/public/WebNamedNodeMap.h" -#include "third_party/WebKit/WebKit/chromium/public/WebNode.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityCache.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObject.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityRole.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebAttribute.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocumentType.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNamedNodeMap.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" using WebKit::WebAccessibilityCache; using WebKit::WebAccessibilityRole; diff --git a/webkit/glue/webaccessibility.h b/webkit/glue/webaccessibility.h index c073502..081d156 100644 --- a/webkit/glue/webaccessibility.h +++ b/webkit/glue/webaccessibility.h @@ -9,7 +9,7 @@ #include #include "base/string16.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" namespace WebKit { class WebAccessibilityCache; diff --git a/webkit/glue/webclipboard_impl.cc b/webkit/glue/webclipboard_impl.cc index 8e3f87b..b917677 100644 --- a/webkit/glue/webclipboard_impl.cc +++ b/webkit/glue/webclipboard_impl.cc @@ -1,21 +1,21 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "webkit/glue/webclipboard_impl.h" -#include "app/clipboard/clipboard.h" #include "base/logging.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "googleurl/src/gurl.h" #include "net/base/escape.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "third_party/WebKit/WebKit/chromium/public/WebImage.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebVector.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" +#include "ui/base/clipboard/clipboard.h" #include "webkit/glue/scoped_clipboard_writer_glue.h" #include "webkit/glue/webkit_glue.h" @@ -62,19 +62,19 @@ WebClipboardImpl::~WebClipboardImpl() { } bool WebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) { - Clipboard::FormatType format_type; - Clipboard::Buffer buffer_type; + ui::Clipboard::FormatType format_type; + ui::Clipboard::Buffer buffer_type; switch (format) { case FormatHTML: - format_type = Clipboard::GetHtmlFormatType(); + format_type = ui::Clipboard::GetHtmlFormatType(); break; case FormatSmartPaste: - format_type = Clipboard::GetWebKitSmartPasteFormatType(); + format_type = ui::Clipboard::GetWebKitSmartPasteFormatType(); break; case FormatBookmark: #if defined(OS_WIN) || defined(OS_MACOSX) - format_type = Clipboard::GetUrlWFormatType(); + format_type = ui::Clipboard::GetUrlWFormatType(); break; #endif default: @@ -89,11 +89,11 @@ bool WebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) { } WebString WebClipboardImpl::readPlainText(Buffer buffer) { - Clipboard::Buffer buffer_type; + ui::Clipboard::Buffer buffer_type; if (!ConvertBufferType(buffer, &buffer_type)) return WebString(); - if (ClipboardIsFormatAvailable(Clipboard::GetPlainTextWFormatType(), + if (ClipboardIsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(), buffer_type)) { string16 text; ClipboardReadText(buffer_type, &text); @@ -101,7 +101,7 @@ WebString WebClipboardImpl::readPlainText(Buffer buffer) { return text; } - if (ClipboardIsFormatAvailable(Clipboard::GetPlainTextFormatType(), + if (ClipboardIsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(), buffer_type)) { std::string text; ClipboardReadAsciiText(buffer_type, &text); @@ -113,7 +113,7 @@ WebString WebClipboardImpl::readPlainText(Buffer buffer) { } WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url) { - Clipboard::Buffer buffer_type; + ui::Clipboard::Buffer buffer_type; if (!ConvertBufferType(buffer, &buffer_type)) return WebString(); @@ -145,7 +145,7 @@ void WebClipboardImpl::writeURL(const WebURL& url, const WebString& title) { scw.WriteBookmark(title, url.spec()); scw.WriteHTML(UTF8ToUTF16(URLToMarkup(url, title)), ""); - scw.WriteText(UTF8ToUTF16(url.spec())); + scw.WriteText(UTF8ToUTF16(std::string(url.spec()))); } void WebClipboardImpl::writeImage( @@ -172,13 +172,15 @@ void WebClipboardImpl::writeImage( } } -void WebClipboardImpl::writeData(const WebKit::WebDragData& data) { +void WebClipboardImpl::writeData(const WebString& type, + const WebString& data, + const WebString& metadata) { // TODO(dcheng): Implement this stub. } WebVector WebClipboardImpl::readAvailableTypes( Buffer buffer, bool* contains_filenames) { - Clipboard::Buffer buffer_type; + ui::Clipboard::Buffer buffer_type; std::vector types; if (ConvertBufferType(buffer, &buffer_type)) { ClipboardReadAvailableTypes(buffer_type, &types, contains_filenames); @@ -188,7 +190,7 @@ WebVector WebClipboardImpl::readAvailableTypes( bool WebClipboardImpl::readData(Buffer buffer, const WebString& type, WebString* data, WebString* metadata) { - Clipboard::Buffer buffer_type; + ui::Clipboard::Buffer buffer_type; if (!ConvertBufferType(buffer, &buffer_type)) return false; @@ -203,7 +205,7 @@ bool WebClipboardImpl::readData(Buffer buffer, const WebString& type, } WebVector WebClipboardImpl::readFilenames(Buffer buffer) { - Clipboard::Buffer buffer_type; + ui::Clipboard::Buffer buffer_type; std::vector filenames; if (ConvertBufferType(buffer, &buffer_type)) { ClipboardReadFilenames(buffer_type, &filenames); @@ -212,16 +214,16 @@ WebVector WebClipboardImpl::readFilenames(Buffer buffer) { } bool WebClipboardImpl::ConvertBufferType(Buffer buffer, - Clipboard::Buffer* result) { + ui::Clipboard::Buffer* result) { switch (buffer) { case BufferStandard: - *result = Clipboard::BUFFER_STANDARD; + *result = ui::Clipboard::BUFFER_STANDARD; break; case BufferDrag: - *result = Clipboard::BUFFER_DRAG; + *result = ui::Clipboard::BUFFER_DRAG; case BufferSelection: #if defined(USE_X11) - *result = Clipboard::BUFFER_SELECTION; + *result = ui::Clipboard::BUFFER_SELECTION; break; #endif default: diff --git a/webkit/glue/webclipboard_impl.h b/webkit/glue/webclipboard_impl.h index 6a83a6d..ba3e747 100644 --- a/webkit/glue/webclipboard_impl.h +++ b/webkit/glue/webclipboard_impl.h @@ -1,12 +1,12 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #ifndef WEBCLIPBOARD_IMPL_H_ #define WEBCLIPBOARD_IMPL_H_ -#include "app/clipboard/clipboard.h" -#include "third_party/WebKit/WebKit/chromium/public/WebClipboard.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebClipboard.h" +#include "ui/base/clipboard/clipboard.h" #include @@ -38,7 +38,10 @@ class WebClipboardImpl : public WebKit::WebClipboard { const WebKit::WebImage&, const WebKit::WebURL& source_url, const WebKit::WebString& title); - virtual void writeData(const WebKit::WebDragData&); + virtual void writeData( + const WebKit::WebString& type, + const WebKit::WebString& data, + const WebKit::WebString& metadata); virtual WebKit::WebVector readAvailableTypes( Buffer, bool* contains_filenames); @@ -47,7 +50,7 @@ class WebClipboardImpl : public WebKit::WebClipboard { virtual WebKit::WebVector readFilenames(Buffer); private: - bool ConvertBufferType(Buffer, Clipboard::Buffer*); + bool ConvertBufferType(Buffer, ui::Clipboard::Buffer*); }; } // namespace webkit_glue diff --git a/webkit/glue/webcursor.cc b/webkit/glue/webcursor.cc index fb67b6b..50a0bb6 100644 --- a/webkit/glue/webcursor.cc +++ b/webkit/glue/webcursor.cc @@ -6,8 +6,8 @@ #include "base/logging.h" #include "base/pickle.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" -#include "third_party/WebKit/WebKit/chromium/public/WebImage.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" using WebKit::WebCursorInfo; using WebKit::WebImage; diff --git a/webkit/glue/webcursor.h b/webkit/glue/webcursor.h index daad15f..8fb6b9f 100644 --- a/webkit/glue/webcursor.h +++ b/webkit/glue/webcursor.h @@ -6,9 +6,9 @@ #define WEBKIT_GLUE_WEBCURSOR_H_ #include "base/basictypes.h" -#include "gfx/native_widget_types.h" -#include "gfx/point.h" -#include "gfx/size.h" +#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/point.h" +#include "ui/gfx/size.h" #include diff --git a/webkit/glue/webcursor_gtk.cc b/webkit/glue/webcursor_gtk.cc index 1ff8316..ca3555a 100644 --- a/webkit/glue/webcursor_gtk.cc +++ b/webkit/glue/webcursor_gtk.cc @@ -8,8 +8,8 @@ #include #include "base/logging.h" -#include "gfx/gtk_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" +#include "ui/gfx/gtk_util.h" using WebKit::WebCursorInfo; diff --git a/webkit/glue/webcursor_mac.mm b/webkit/glue/webcursor_mac.mm index 4c3d69a..680521d 100644 --- a/webkit/glue/webcursor_mac.mm +++ b/webkit/glue/webcursor_mac.mm @@ -10,9 +10,9 @@ #include "app/mac/nsimage_cache.h" #include "base/logging.h" #include "base/mac/scoped_cftyperef.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" -#include "third_party/WebKit/WebKit/chromium/public/WebImage.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" using WebKit::WebCursorInfo; using WebKit::WebImage; diff --git a/webkit/glue/webcursor_unittest.cc b/webkit/glue/webcursor_unittest.cc index f449515..eea7926 100644 --- a/webkit/glue/webcursor_unittest.cc +++ b/webkit/glue/webcursor_unittest.cc @@ -4,7 +4,7 @@ #include "base/pickle.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" #include "webkit/glue/webcursor.h" #include "webkit/tools/test_shell/test_shell_test.h" diff --git a/webkit/glue/webcursor_win.cc b/webkit/glue/webcursor_win.cc index 2141969..3399c7c 100644 --- a/webkit/glue/webcursor_win.cc +++ b/webkit/glue/webcursor_win.cc @@ -4,10 +4,10 @@ #include "base/logging.h" #include "base/pickle.h" -#include "gfx/gdi_util.h" #include "grit/webkit_resources.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" +#include "ui/gfx/gdi_util.h" #include "webkit/glue/webcursor.h" using WebKit::WebCursorInfo; diff --git a/webkit/glue/webdropdata.cc b/webkit/glue/webdropdata.cc index cda887d..02c1a4c 100644 --- a/webkit/glue/webdropdata.cc +++ b/webkit/glue/webdropdata.cc @@ -4,11 +4,11 @@ #include "webkit/glue/webdropdata.h" -#include "third_party/WebKit/WebKit/chromium/public/WebData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebVector.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" using WebKit::WebData; using WebKit::WebDragData; diff --git a/webkit/glue/webdropdata_win.cc b/webkit/glue/webdropdata_win.cc index bd76090..b550eb9 100644 --- a/webkit/glue/webdropdata_win.cc +++ b/webkit/glue/webdropdata_win.cc @@ -8,26 +8,26 @@ #include #include -#include "app/clipboard/clipboard_util_win.h" #include "googleurl/src/gurl.h" +#include "ui/base/clipboard/clipboard_util_win.h" // static void WebDropData::PopulateWebDropData(IDataObject* data_object, WebDropData* drop_data) { std::wstring url_str; - if (ClipboardUtil::GetUrl(data_object, &url_str, &drop_data->url_title, - false)) { + if (ui::ClipboardUtil::GetUrl(data_object, &url_str, &drop_data->url_title, + false)) { GURL test_url(url_str); if (test_url.is_valid()) drop_data->url = test_url; } - ClipboardUtil::GetFilenames(data_object, &drop_data->filenames); - ClipboardUtil::GetPlainText(data_object, &drop_data->plain_text); + ui::ClipboardUtil::GetFilenames(data_object, &drop_data->filenames); + ui::ClipboardUtil::GetPlainText(data_object, &drop_data->plain_text); std::string base_url; - ClipboardUtil::GetHtml(data_object, &drop_data->text_html, &base_url); + ui::ClipboardUtil::GetHtml(data_object, &drop_data->text_html, &base_url); if (!base_url.empty()) { drop_data->html_base_url = GURL(base_url); } - ClipboardUtil::GetFileContents(data_object, + ui::ClipboardUtil::GetFileContents(data_object, &drop_data->file_description_filename, &drop_data->file_contents); } diff --git a/webkit/glue/webfileutilities_impl.cc b/webkit/glue/webfileutilities_impl.cc index 6cea225..5aeeb05 100644 --- a/webkit/glue/webfileutilities_impl.cc +++ b/webkit/glue/webfileutilities_impl.cc @@ -9,8 +9,8 @@ #include "base/logging.h" #include "net/base/file_stream.h" #include "net/base/net_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" #include "webkit/glue/webkit_glue.h" using WebKit::WebString; diff --git a/webkit/glue/webfileutilities_impl.h b/webkit/glue/webfileutilities_impl.h index c1ef986..14d7a42 100644 --- a/webkit/glue/webfileutilities_impl.h +++ b/webkit/glue/webfileutilities_impl.h @@ -6,7 +6,7 @@ #define WEBFILEUTILITIES_IMPL_H_ #include "base/platform_file.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFileUtilities.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileUtilities.h" namespace webkit_glue { diff --git a/webkit/glue/webframe_unittest.cc b/webkit/glue/webframe_unittest.cc index 6ffaf84..abe13c3 100644 --- a/webkit/glue/webframe_unittest.cc +++ b/webkit/glue/webframe_unittest.cc @@ -5,11 +5,11 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/WebKit/chromium/public/WebData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/tools/test_shell/test_shell_test.h" using WebKit::WebFrame; diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index fe3edd9..6d76c71 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -26,20 +26,20 @@ #include "skia/ext/skia_utils_mac.h" #endif #include "third_party/skia/include/core/SkBitmap.h" -#include "third_party/WebKit/WebKit/chromium/public/WebData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" -#include "third_party/WebKit/WebKit/chromium/public/WebElement.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebGlyphCache.h" -#include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h" -#include "third_party/WebKit/WebKit/chromium/public/WebImage.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebVector.h" -#include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebGlyphCache.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #if defined(OS_WIN) -#include "third_party/WebKit/WebKit/chromium/public/win/WebInputEventFactory.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/win/WebInputEventFactory.h" #endif #include "webkit/glue/glue_serialize.h" #include "webkit/glue/user_agent.h" @@ -240,21 +240,6 @@ string16 DumpHistoryState(const std::string& history_state, int indent, is_current)); } -void ResetBeforeTestRun(WebView* view) { - WebFrame* web_frame = view->mainFrame(); - - // Reset the main frame name since tests always expect it to be empty. It - // is normally not reset between page loads (even in IE and FF). - if (web_frame) - web_frame->setName(WebString()); - -#if defined(OS_WIN) - // Reset the last click information so the clicks generated from previous - // test aren't inherited (otherwise can mistake single/double/triple clicks) - WebKit::WebInputEventFactory::resetLastClickState(); -#endif -} - #ifndef NDEBUG // The log macro was having problems due to collisions with WTF, so we just // code here what that would have inlined. diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index e64f667..4a3d03f 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -6,7 +6,7 @@ 'variables': { 'conditions': [ ['inside_chromium_build==0', { - 'webkit_src_dir': '../../../..', + 'webkit_src_dir': '../../../../..', },{ 'webkit_src_dir': '../../third_party/WebKit', }], @@ -45,7 +45,7 @@ { 'action_name': 'webkit_chromium_resources', 'variables': { - 'input_path': '<(webkit_src_dir)/WebKit/chromium/WebKit.grd', + 'input_path': '<(webkit_src_dir)/Source/WebKit/chromium/WebKit.grd', }, 'inputs': [ ' #include -#include "app/clipboard/clipboard.h" #include "base/file_path.h" #include "base/platform_file.h" #include "base/string16.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFileError.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileError.h" +#include "ui/base/clipboard/clipboard.h" class GURL; class SkBitmap; @@ -90,9 +90,6 @@ string16 DumpFrameScrollPosition(WebKit::WebFrame* web_frame, bool recursive); string16 DumpHistoryState(const std::string& history_state, int indent, bool is_current); -// Cleans up state left over from the previous test run. -void ResetBeforeTestRun(WebKit::WebView* view); - // Returns the WebKit version (major.minor). std::string GetWebKitVersion(); @@ -189,32 +186,33 @@ HCURSOR LoadCursor(int cursor_id); // Glue to access the clipboard. // Get a clipboard that can be used to construct a ScopedClipboardWriterGlue. -Clipboard* ClipboardGetClipboard(); +ui::Clipboard* ClipboardGetClipboard(); // Tests whether the clipboard contains a certain format -bool ClipboardIsFormatAvailable(const Clipboard::FormatType& format, - Clipboard::Buffer buffer); +bool ClipboardIsFormatAvailable(const ui::Clipboard::FormatType& format, + ui::Clipboard::Buffer buffer); // Reads UNICODE text from the clipboard, if available. -void ClipboardReadText(Clipboard::Buffer buffer, string16* result); +void ClipboardReadText(ui::Clipboard::Buffer buffer, string16* result); // Reads ASCII text from the clipboard, if available. -void ClipboardReadAsciiText(Clipboard::Buffer buffer, std::string* result); +void ClipboardReadAsciiText(ui::Clipboard::Buffer buffer, std::string* result); // Reads HTML from the clipboard, if available. -void ClipboardReadHTML(Clipboard::Buffer buffer, string16* markup, GURL* url); +void ClipboardReadHTML(ui::Clipboard::Buffer buffer, string16* markup, + GURL* url); // Reads the available types from the clipboard, if available. -bool ClipboardReadAvailableTypes(Clipboard::Buffer buffer, +bool ClipboardReadAvailableTypes(ui::Clipboard::Buffer buffer, std::vector* types, bool* contains_filenames); // Reads one type of data from the clipboard, if available. -bool ClipboardReadData(Clipboard::Buffer buffer, const string16& type, +bool ClipboardReadData(ui::Clipboard::Buffer buffer, const string16& type, string16* data, string16* metadata); // Reads filenames from the clipboard, if available. -bool ClipboardReadFilenames(Clipboard::Buffer buffer, +bool ClipboardReadFilenames(ui::Clipboard::Buffer buffer, std::vector* filenames); // Gets the directory where the application data and libraries exist. This diff --git a/webkit/glue/webkit_resources.grd b/webkit/glue/webkit_resources.grd index 94d4286..a11dae9 100644 --- a/webkit/glue/webkit_resources.grd +++ b/webkit/glue/webkit_resources.grd @@ -64,7 +64,7 @@ - + @@ -76,23 +76,6 @@ - - - - - - - - - - - - - - - - - diff --git a/webkit/glue/webkit_strings.grd b/webkit/glue/webkit_strings.grd index 651acf0..ae88dc9 100644 --- a/webkit/glue/webkit_strings.grd +++ b/webkit/glue/webkit_strings.grd @@ -102,6 +102,9 @@ below: + + + @@ -114,10 +117,16 @@ below: + + + + + + @@ -126,8 +135,14 @@ below: + + + + + + @@ -150,6 +165,9 @@ below: + + + @@ -158,6 +176,7 @@ below: + @@ -169,10 +188,12 @@ below: + + @@ -184,6 +205,7 @@ below: + @@ -204,6 +226,7 @@ below: + diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc index faf2926..701d5c3 100644 --- a/webkit/glue/webkitclient_impl.cc +++ b/webkit/glue/webkitclient_impl.cc @@ -13,7 +13,6 @@ #include #include "base/debug/trace_event.h" -#include "base/lock.h" #include "base/message_loop.h" #include "base/metrics/stats_counters.h" #include "base/metrics/histogram.h" @@ -22,18 +21,20 @@ #include "base/singleton.h" #include "base/string_number_conversions.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "base/utf_string_conversions.h" +#include "grit/webkit_chromium_resources.h" #include "grit/webkit_resources.h" #include "grit/webkit_strings.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCookie.h" -#include "third_party/WebKit/WebKit/chromium/public/WebData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrameClient.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPluginListBuilder.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebVector.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCookie.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginListBuilder.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" #include "webkit/glue/media/audio_decoder.h" #include "webkit/plugins/npapi/plugin_instance.h" #include "webkit/plugins/npapi/webplugininfo.h" @@ -78,7 +79,7 @@ class MemoryUsageCache { // Returns true if the cached value is fresh. // Returns false if the cached value is stale, or if |cached_value| is NULL. bool IsCachedValueValid(size_t* cached_value) { - AutoLock scoped_lock(lock_); + base::AutoLock scoped_lock(lock_); if (!cached_value) return false; if (base::Time::Now() - last_updated_time_ > cache_valid_time_) @@ -89,7 +90,7 @@ class MemoryUsageCache { // Setter for |memory_value_|, refreshes |last_updated_time_|. void SetMemoryValue(const size_t value) { - AutoLock scoped_lock(lock_); + base::AutoLock scoped_lock(lock_); memory_value_ = value; last_updated_time_ = base::Time::Now(); } @@ -104,7 +105,7 @@ class MemoryUsageCache { // The last time the cached value was updated. base::Time last_updated_time_; - Lock lock_; + base::Lock lock_; }; } // anonymous namespace @@ -291,6 +292,59 @@ void WebKitClientImpl::traceEventEnd(const char* name, void* id, TRACE_EVENT_END(name, id, extra); } +namespace { + +WebData loadAudioSpatializationResource(const char* name) { +#ifdef IDR_AUDIO_SPATIALIZATION_T000_P000 + const size_t kExpectedSpatializationNameLength = 31; + if (strlen(name) != kExpectedSpatializationNameLength) { + return WebData(); + } + + // Extract the azimuth and elevation from the resource name. + int azimuth = 0; + int elevation = 0; + int values_parsed = + sscanf(name, "IRC_Composite_C_R0195_T%3d_P%3d", &azimuth, &elevation); + if (values_parsed != 2) { + return WebData(); + } + + // The resource index values go through the elevations first, then azimuths. + const int kAngleSpacing = 15; + + // 0 <= elevation <= 90 (or 315 <= elevation <= 345) + // in increments of 15 degrees. + int elevation_index = + elevation <= 90 ? elevation / kAngleSpacing : + 7 + (elevation - 315) / kAngleSpacing; + bool is_elevation_index_good = 0 <= elevation_index && elevation_index < 10; + + // 0 <= azimuth < 360 in increments of 15 degrees. + int azimuth_index = azimuth / kAngleSpacing; + bool is_azimuth_index_good = 0 <= azimuth_index && azimuth_index < 24; + + const int kNumberOfElevations = 10; + const int kNumberOfAudioResources = 240; + int resource_index = kNumberOfElevations * azimuth_index + elevation_index; + bool is_resource_index_good = 0 <= resource_index && + resource_index < kNumberOfAudioResources; + + if (is_azimuth_index_good && is_elevation_index_good && + is_resource_index_good) { + const int kFirstAudioResourceIndex = IDR_AUDIO_SPATIALIZATION_T000_P000; + base::StringPiece resource = + GetDataResource(kFirstAudioResourceIndex + resource_index); + return WebData(resource.data(), resource.size()); + } +#endif // IDR_AUDIO_SPATIALIZATION_T000_P000 + + NOTREACHED(); + return WebData(); +} + +} // namespace + WebData WebKitClientImpl::loadResource(const char* name) { struct { const char* name; @@ -323,29 +377,17 @@ WebData WebKitClientImpl::loadResource(const char* name) { { "masterCardCC", IDR_AUTOFILL_CC_MASTERCARD }, { "soloCC", IDR_AUTOFILL_CC_SOLO }, { "visaCC", IDR_AUTOFILL_CC_VISA }, -#if defined(OS_POSIX) && !defined(OS_MACOSX) - // TODO(port): rename these to "skia" instead of "Linux". - { "linuxCheckboxDisabledIndeterminate", - IDR_LINUX_CHECKBOX_DISABLED_INDETERMINATE }, - { "linuxCheckboxDisabledOff", IDR_LINUX_CHECKBOX_DISABLED_OFF }, - { "linuxCheckboxDisabledOn", IDR_LINUX_CHECKBOX_DISABLED_ON }, - { "linuxCheckboxIndeterminate", IDR_LINUX_CHECKBOX_INDETERMINATE }, - { "linuxCheckboxOff", IDR_LINUX_CHECKBOX_OFF }, - { "linuxCheckboxOn", IDR_LINUX_CHECKBOX_ON }, - { "linuxRadioDisabledOff", IDR_LINUX_RADIO_DISABLED_OFF }, - { "linuxRadioDisabledOn", IDR_LINUX_RADIO_DISABLED_ON }, - { "linuxRadioOff", IDR_LINUX_RADIO_OFF }, - { "linuxRadioOn", IDR_LINUX_RADIO_ON }, - { "linuxProgressBar", IDR_PROGRESS_BAR }, - { "linuxProgressBorderLeft", IDR_PROGRESS_BORDER_LEFT }, - { "linuxProgressBorderRight", IDR_PROGRESS_BORDER_RIGHT }, - { "linuxProgressValue", IDR_PROGRESS_VALUE }, -#endif }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(resources); ++i) { - if (!strcmp(name, resources[i].name)) { - base::StringPiece resource = GetDataResource(resources[i].id); - return WebData(resource.data(), resource.size()); + + // Check the name prefix to see if it's an audio resource. + if (StartsWithASCII(name, "IRC_Composite", true)) { + return loadAudioSpatializationResource(name); + } else { + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(resources); ++i) { + if (!strcmp(name, resources[i].name)) { + base::StringPiece resource = GetDataResource(resources[i].id); + return WebData(resource.data(), resource.size()); + } } } // TODO(jhawkins): Restore this NOTREACHED once WK stops sending in empty diff --git a/webkit/glue/webkitclient_impl.h b/webkit/glue/webkitclient_impl.h index 42b436d..302a99f 100644 --- a/webkit/glue/webkitclient_impl.h +++ b/webkit/glue/webkitclient_impl.h @@ -7,7 +7,7 @@ #include "base/platform_file.h" #include "base/timer.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" #if defined(OS_WIN) #include "webkit/glue/webthemeengine_impl_win.h" #elif defined(OS_LINUX) diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc index 005c7cf..9d51910 100644 --- a/webkit/glue/webmediaplayer_impl.cc +++ b/webkit/glue/webmediaplayer_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,10 +19,10 @@ #include "media/filters/ffmpeg_video_decoder.h" #include "media/filters/null_audio_renderer.h" #include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebVideoFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" #include "webkit/glue/media/buffered_data_source.h" #include "webkit/glue/media/simple_data_source.h" #include "webkit/glue/media/video_renderer_impl.h" @@ -59,6 +59,25 @@ const int kMaxOutstandingRepaints = 50; const float kMinRate = 0.0625f; const float kMaxRate = 16.0f; +// Platform independent method for converting and rounding floating point +// seconds to an int64 timestamp. +// +// Refer to https://bugs.webkit.org/show_bug.cgi?id=52697 for details. +base::TimeDelta ConvertSecondsToTimestamp(float seconds) { + float microseconds = seconds * base::Time::kMicrosecondsPerSecond; + float integer = ceilf(microseconds); + float difference = integer - microseconds; + + // Round down if difference is large enough. + if ((microseconds > 0 && difference > 0.5f) || + (microseconds <= 0 && difference >= 0.5f)) { + integer -= 1.0f; + } + + // Now we can safely cast to int64 microseconds. + return base::TimeDelta::FromMicroseconds(static_cast(integer)); +} + } // namespace namespace webkit_glue { @@ -80,7 +99,7 @@ WebMediaPlayerImpl::Proxy::~Proxy() { } void WebMediaPlayerImpl::Proxy::Repaint() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (outstanding_repaints_ < kMaxOutstandingRepaints) { ++outstanding_repaints_; @@ -164,7 +183,7 @@ void WebMediaPlayerImpl::Proxy::NetworkEventCallback() { void WebMediaPlayerImpl::Proxy::RepaintTask() { DCHECK(MessageLoop::current() == render_loop_); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); --outstanding_repaints_; DCHECK_GE(outstanding_repaints_, 0); } @@ -225,13 +244,14 @@ void WebMediaPlayerImpl::Proxy::PutCurrentFrame( WebMediaPlayerImpl::WebMediaPlayerImpl( WebKit::WebMediaPlayerClient* client, - media::FilterCollection* collection) + media::FilterCollection* collection, + media::MessageLoopFactory* message_loop_factory) : network_state_(WebKit::WebMediaPlayer::Empty), ready_state_(WebKit::WebMediaPlayer::HaveNothing), main_loop_(NULL), filter_collection_(collection), pipeline_(NULL), - pipeline_thread_("PipelineThread"), + message_loop_factory_(message_loop_factory), paused_(true), seeking_(false), playback_rate_(0.0f), @@ -247,13 +267,14 @@ bool WebMediaPlayerImpl::Initialize( WebKit::WebFrame* frame, bool use_simple_data_source, scoped_refptr web_video_renderer) { - // Create the pipeline and its thread. - if (!pipeline_thread_.Start()) { + MessageLoop* pipeline_message_loop = + message_loop_factory_->GetMessageLoop("PipelineThread"); + if (!pipeline_message_loop) { NOTREACHED() << "Could not start PipelineThread"; return false; } - pipeline_ = new media::PipelineImpl(pipeline_thread_.message_loop()); + pipeline_ = new media::PipelineImpl(pipeline_message_loop); // Also we want to be notified of |main_loop_| destruction. main_loop_->AddDestructionObserver(this); @@ -290,9 +311,12 @@ bool WebMediaPlayerImpl::Initialize( } // Add in the default filter factories. - filter_collection_->AddDemuxer(new media::FFmpegDemuxer()); - filter_collection_->AddAudioDecoder(new media::FFmpegAudioDecoder()); - filter_collection_->AddVideoDecoder(new media::FFmpegVideoDecoder(NULL)); + filter_collection_->AddDemuxer(new media::FFmpegDemuxer( + message_loop_factory_->GetMessageLoop("DemuxThread"))); + filter_collection_->AddAudioDecoder(new media::FFmpegAudioDecoder( + message_loop_factory_->GetMessageLoop("AudioDecoderThread"))); + filter_collection_->AddVideoDecoder(new media::FFmpegVideoDecoder( + message_loop_factory_->GetMessageLoop("VideoDecoderThread"), NULL)); filter_collection_->AddAudioRenderer(new media::NullAudioRenderer()); return true; @@ -369,10 +393,7 @@ void WebMediaPlayerImpl::seek(float seconds) { return; } - // Try to preserve as much accuracy as possible. - float microseconds = seconds * base::Time::kMicrosecondsPerSecond; - base::TimeDelta seek_time = - base::TimeDelta::FromMicroseconds(static_cast(microseconds)); + base::TimeDelta seek_time = ConvertSecondsToTimestamp(seconds); // Update our paused time. if (paused_) { @@ -794,9 +815,10 @@ void WebMediaPlayerImpl::Destroy() { pipeline_->Stop(NewCallback(this, &WebMediaPlayerImpl::PipelineStoppedCallback)); pipeline_stopped_.Wait(); - pipeline_thread_.Stop(); } + message_loop_factory_.reset(); + // And then detach the proxy, it may live on the render thread for a little // longer until all the tasks are finished. if (proxy_) { diff --git a/webkit/glue/webmediaplayer_impl.h b/webkit/glue/webmediaplayer_impl.h index abb1c60..cfc200f 100644 --- a/webkit/glue/webmediaplayer_impl.h +++ b/webkit/glue/webmediaplayer_impl.h @@ -53,19 +53,20 @@ #ifndef WEBKIT_GLUE_WEBMEDIAPLAYER_IMPL_H_ #define WEBKIT_GLUE_WEBMEDIAPLAYER_IMPL_H_ -#include "base/lock.h" #include "base/message_loop.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/threading/thread.h" +#include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" -#include "gfx/rect.h" -#include "gfx/size.h" #include "media/base/filters.h" +#include "media/base/message_loop_factory.h" #include "media/base/pipeline.h" #include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayer.h" -#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient.h" +#include "ui/gfx/rect.h" +#include "ui/gfx/size.h" class GURL; @@ -148,7 +149,7 @@ class WebMediaPlayerImpl : public WebKit::WebMediaPlayer, scoped_refptr data_source_; scoped_refptr video_renderer_; - Lock lock_; + base::Lock lock_; int outstanding_repaints_; }; @@ -175,7 +176,8 @@ class WebMediaPlayerImpl : public WebKit::WebMediaPlayer, // // Callers must call |Initialize()| before they can use the object. WebMediaPlayerImpl(WebKit::WebMediaPlayerClient* client, - media::FilterCollection* collection); + media::FilterCollection* collection, + media::MessageLoopFactory* message_loop_factory); virtual ~WebMediaPlayerImpl(); // Finalizes initialization of the object. @@ -288,7 +290,8 @@ class WebMediaPlayerImpl : public WebKit::WebMediaPlayer, // The actual pipeline and the thread it runs on. scoped_refptr pipeline_; - base::Thread pipeline_thread_; + + scoped_ptr message_loop_factory_; // Playback state. // diff --git a/webkit/glue/webmenuitem.h b/webkit/glue/webmenuitem.h index 4b0fdc3..685033e 100644 --- a/webkit/glue/webmenuitem.h +++ b/webkit/glue/webmenuitem.h @@ -1,12 +1,14 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef WEBMENUITEM_H_ #define WEBMENUITEM_H_ +#include + #include "base/string16.h" -#include "third_party/WebKit/WebKit/chromium/public/WebMenuItemInfo.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebMenuItemInfo.h" // Container for information about entries in an HTML select popup menu and // custom entries of the context menu. @@ -15,25 +17,23 @@ struct WebMenuItem { OPTION = WebKit::WebMenuItemInfo::Option, CHECKABLE_OPTION = WebKit::WebMenuItemInfo::CheckableOption, GROUP = WebKit::WebMenuItemInfo::Group, - SEPARATOR = WebKit::WebMenuItemInfo::Separator + SEPARATOR = WebKit::WebMenuItemInfo::Separator, + SUBMENU // This is currently only used by Pepper, not by WebKit. }; + WebMenuItem(); + WebMenuItem(const WebKit::WebMenuItemInfo& item); + WebMenuItem(const WebMenuItem& item); + ~WebMenuItem(); + string16 label; Type type; unsigned action; + bool rtl; + bool has_directional_override; bool enabled; bool checked; - - WebMenuItem() : type(OPTION), action(0), enabled(false), checked(false) { - } - - WebMenuItem(const WebKit::WebMenuItemInfo& item) - : label(item.label), - type(static_cast(item.type)), - action(item.action), - enabled(item.enabled), - checked(item.checked) { - } + std::vector submenu; }; #endif // WEBMENUITEM_H_ diff --git a/webkit/glue/webmenurunner_mac.h b/webkit/glue/webmenurunner_mac.h index c56eeeb..eccb1ef 100644 --- a/webkit/glue/webmenurunner_mac.h +++ b/webkit/glue/webmenurunner_mac.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,6 +33,9 @@ // The font size being used for the menu. CGFloat fontSize_; + + // Whether the menu should be displayed right-aligned. + BOOL rightAligned_; } // Initializes the MenuDelegate with a list of items sent from WebKit. diff --git a/webkit/glue/webmenurunner_mac.mm b/webkit/glue/webmenurunner_mac.mm index 3e1376a..7dce0a6 100644 --- a/webkit/glue/webmenurunner_mac.mm +++ b/webkit/glue/webmenurunner_mac.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,28 +6,31 @@ #include "base/sys_string_conversions.h" -namespace { - -const CGFloat kPopupXOffset = -10.0f; -BOOL gNewNSMenuAPI; - -} // namespace - #if !defined(MAC_OS_X_VERSION_10_6) || \ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 -@interface NSMenu (SnowLeopardSDKDeclarations) -- (BOOL)popUpMenuPositioningItem:(NSMenuItem *)item - atLocation:(NSPoint)location - inView:(NSView *)view; -- (void)setFont:(NSFont *)font; +enum { + NSUserInterfaceLayoutDirectionLeftToRight = 0, + NSUserInterfaceLayoutDirectionRightToLeft = 1 +}; +typedef NSInteger NSUserInterfaceLayoutDirection; + +@interface NSCell (SnowLeopardSDKDeclarations) +- (void)setUserInterfaceLayoutDirection: + (NSUserInterfaceLayoutDirection)layoutDirection; @end + +enum { + NSTextWritingDirectionEmbedding = (0 << 1), + NSTextWritingDirectionOverride = (1 << 1) +}; + +static NSString* NSWritingDirectionAttributeName = @"NSWritingDirection"; #endif @interface WebMenuRunner (PrivateAPI) // Worker function used during initialization. -- (void)addItem:(const WebMenuItem&)item - withAttributes:(NSDictionary*)attrs; +- (void)addItem:(const WebMenuItem&)item; // A callback for the menu controller object to call when an item is selected // from the menu. This is not called if the menu is dismissed without a @@ -41,39 +44,19 @@ BOOL gNewNSMenuAPI; - (id)initWithItems:(const std::vector&)items fontSize:(CGFloat)fontSize rightAligned:(BOOL)rightAligned { - static BOOL newNSMenuAPIInitialized = NO; - if (!newNSMenuAPIInitialized) { - newNSMenuAPIInitialized = YES; - gNewNSMenuAPI = [NSMenu instancesRespondToSelector: - @selector(popUpMenuPositioningItem:atLocation:inView:)] && - [NSMenu instancesRespondToSelector:@selector(setFont:)]; - } - if ((self = [super init])) { menu_.reset([[NSMenu alloc] initWithTitle:@""]); - if (gNewNSMenuAPI) - [menu_ setFont:[NSFont menuFontOfSize:fontSize]]; [menu_ setAutoenablesItems:NO]; index_ = -1; fontSize_ = fontSize; - scoped_nsobject attrs; - if (rightAligned) { - // NB: Right-aligning menu items in this manner is known to not work in - // Mac OS X 10.5. - scoped_nsobject paragraphStyle( - [[NSMutableParagraphStyle alloc] init]); - [paragraphStyle setAlignment:NSRightTextAlignment]; - attrs.reset([[NSDictionary alloc] initWithObjectsAndKeys: - paragraphStyle, NSParagraphStyleAttributeName, nil]); - } + rightAligned_ = rightAligned; for (size_t i = 0; i < items.size(); ++i) - [self addItem:items[i] withAttributes:attrs]; + [self addItem:items[i]]; } return self; } -- (void)addItem:(const WebMenuItem&)item - withAttributes:(NSDictionary*)attrs { +- (void)addItem:(const WebMenuItem&)item { if (item.type == WebMenuItem::SEPARATOR) { [menu_ addItem:[NSMenuItem separatorItem]]; return; @@ -85,12 +68,38 @@ BOOL gNewNSMenuAPI; keyEquivalent:@""]; [menuItem setEnabled:(item.enabled && item.type != WebMenuItem::GROUP)]; [menuItem setTarget:self]; - if (attrs) { - scoped_nsobject attrTitle( - [[NSAttributedString alloc] initWithString:title - attributes:attrs]); - [menuItem setAttributedTitle:attrTitle]; + + // Set various alignment/language attributes. Note that many (if not most) of + // these attributes are functional only on 10.6 and above. + scoped_nsobject attrs( + [[NSMutableDictionary alloc] initWithCapacity:3]); + scoped_nsobject paragraphStyle( + [[NSMutableParagraphStyle alloc] init]); + [paragraphStyle setAlignment:rightAligned_ ? NSRightTextAlignment + : NSLeftTextAlignment]; + NSWritingDirection writingDirection = + item.rtl ? NSWritingDirectionRightToLeft + : NSWritingDirectionLeftToRight; + [paragraphStyle setBaseWritingDirection:writingDirection]; + [attrs setObject:paragraphStyle forKey:NSParagraphStyleAttributeName]; + + if (item.has_directional_override) { + scoped_nsobject directionValue( + [[NSNumber alloc] initWithInteger: + writingDirection + NSTextWritingDirectionOverride]); + scoped_nsobject directionArray( + [[NSArray alloc] initWithObjects:directionValue.get(), nil]); + [attrs setObject:directionArray forKey:NSWritingDirectionAttributeName]; } + + [attrs setObject:[NSFont menuFontOfSize:fontSize_] + forKey:NSFontAttributeName]; + + scoped_nsobject attrTitle( + [[NSAttributedString alloc] initWithString:title + attributes:attrs]); + [menuItem setAttributedTitle:attrTitle]; + [menuItem setTag:[menu_ numberOfItems] - 1]; } @@ -104,53 +113,41 @@ BOOL gNewNSMenuAPI; - (void)menuItemSelected:(id)sender { menuItemWasChosen_ = YES; - if (gNewNSMenuAPI) - index_ = [sender tag]; } - (void)runMenuInView:(NSView*)view withBounds:(NSRect)bounds initialIndex:(int)index { - if (gNewNSMenuAPI) { - // index might be out of bounds, in which case we set no selection. - NSMenuItem* selectedItem = [menu_ itemWithTag:index]; - if (selectedItem) { - [selectedItem setState:NSOnState]; - } else { - selectedItem = [menu_ itemWithTag:0]; - } - NSPoint anchor = NSMakePoint(NSMinX(bounds) + kPopupXOffset, - NSMaxY(bounds)); - [menu_ popUpMenuPositioningItem:selectedItem - atLocation:anchor - inView:view]; - } else { - // Set up the button cell, converting to NSView coordinates. The menu is - // positioned such that the currently selected menu item appears over the - // popup button, which is the expected Mac popup menu behavior. - NSPopUpButtonCell* button = [[NSPopUpButtonCell alloc] initTextCell:@"" - pullsDown:NO]; - [button autorelease]; - [button setMenu:menu_]; - // We use selectItemWithTag below so if the index is out-of-bounds nothing - // bad happens. - [button selectItemWithTag:index]; - [button setFont:[NSFont menuFontOfSize:fontSize_]]; - - // Create a dummy view to associate the popup with, since the OS will use - // that view for positioning the menu. - NSView* dummyView = [[[NSView alloc] initWithFrame:bounds] autorelease]; - [view addSubview:dummyView]; - NSRect dummyBounds = [dummyView convertRect:bounds fromView:view]; - - // Display the menu, and set a flag if a menu item was chosen. - [button performClickWithFrame:dummyBounds inView:dummyView]; - - if ([self menuItemWasChosen]) - index_ = [button indexOfSelectedItem]; - - [dummyView removeFromSuperview]; + // Set up the button cell, converting to NSView coordinates. The menu is + // positioned such that the currently selected menu item appears over the + // popup button, which is the expected Mac popup menu behavior. + NSPopUpButtonCell* button = [[NSPopUpButtonCell alloc] initTextCell:@"" + pullsDown:NO]; + [button autorelease]; + [button setMenu:menu_]; + // We use selectItemWithTag below so if the index is out-of-bounds nothing + // bad happens. + [button selectItemWithTag:index]; + + if (rightAligned_ && + [button respondsToSelector:@selector(setUserInterfaceLayoutDirection:)]) { + [button setUserInterfaceLayoutDirection: + NSUserInterfaceLayoutDirectionRightToLeft]; } + + // Create a dummy view to associate the popup with, since the OS will use + // that view for positioning the menu. + NSView* dummyView = [[[NSView alloc] initWithFrame:bounds] autorelease]; + [view addSubview:dummyView]; + NSRect dummyBounds = [dummyView convertRect:bounds fromView:view]; + + // Display the menu, and set a flag if a menu item was chosen. + [button performClickWithFrame:dummyBounds inView:dummyView]; + + if ([self menuItemWasChosen]) + index_ = [button indexOfSelectedItem]; + + [dummyView removeFromSuperview]; } - (int)indexOfSelectedItem { diff --git a/webkit/glue/webpasswordautocompletelistener_impl.cc b/webkit/glue/webpasswordautocompletelistener_impl.cc index 280ce43..20ecf60 100644 --- a/webkit/glue/webpasswordautocompletelistener_impl.cc +++ b/webkit/glue/webpasswordautocompletelistener_impl.cc @@ -10,9 +10,9 @@ #include #include "base/string_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" using WebKit::WebFrame; using WebKit::WebView; diff --git a/webkit/glue/webpasswordautocompletelistener_impl.h b/webkit/glue/webpasswordautocompletelistener_impl.h index 6badcb7..067c6c2 100644 --- a/webkit/glue/webpasswordautocompletelistener_impl.h +++ b/webkit/glue/webpasswordautocompletelistener_impl.h @@ -10,8 +10,8 @@ #include "base/basictypes.h" #include "base/scoped_ptr.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPasswordAutocompleteListener.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPasswordAutocompleteListener.h" #include "webkit/glue/password_form_dom_manager.h" using WebKit::WebInputElement; diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc index 02092de..03c87bf 100644 --- a/webkit/glue/webpreferences.cc +++ b/webkit/glue/webpreferences.cc @@ -6,12 +6,12 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRuntimeFeatures.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSettings.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/glue/webkit_glue.h" using WebKit::WebRuntimeFeatures; @@ -60,13 +60,17 @@ WebPreferences::WebPreferences() frame_flattening_enabled(false), allow_universal_access_from_file_urls(false), allow_file_access_from_file_urls(false), + webaudio_enabled(false), experimental_webgl_enabled(false), + gl_multisampling_enabled(true), show_composited_layer_borders(false), accelerated_compositing_enabled(false), accelerated_layers_enabled(false), accelerated_video_enabled(false), accelerated_2d_canvas_enabled(false), - memory_info_enabled(false) { + accelerated_plugins_enabled(false), + memory_info_enabled(false), + interactive_form_validation_enabled(true) { } WebPreferences::~WebPreferences() { @@ -140,12 +144,18 @@ void WebPreferences::Apply(WebView* web_view) const { // but also because it cause a possible crash in Editor::hasBidiSelection(). settings->setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); + // Enable the web audio API if requested on the command line. + settings->setWebAudioEnabled(webaudio_enabled); + // Enable experimental WebGL support if requested on command line // and support is compiled in. bool enable_webgl = WebRuntimeFeatures::isWebGLEnabled() && experimental_webgl_enabled; settings->setExperimentalWebGLEnabled(enable_webgl); + // Disable GL multisampling if requested on command line. + settings->setOpenGLMultisamplingEnabled(gl_multisampling_enabled); + // Display colored borders around composited render layers if requested // on command line. settings->setShowDebugBorders(show_composited_layer_borders); @@ -157,16 +167,18 @@ void WebPreferences::Apply(WebView* web_view) const { settings->setAccelerated2dCanvasEnabled(accelerated_2d_canvas_enabled); // Enabling accelerated layers from the command line enabled accelerated - // 3D CSS, Video, Plugins, and Animations. + // 3D CSS, Video, and Animations. settings->setAcceleratedCompositingFor3DTransformsEnabled( accelerated_layers_enabled); settings->setAcceleratedCompositingForVideoEnabled( accelerated_video_enabled); - settings->setAcceleratedCompositingForPluginsEnabled( - accelerated_layers_enabled); settings->setAcceleratedCompositingForAnimationEnabled( accelerated_layers_enabled); + // Enabling accelerated plugins if specified from the command line. + settings->setAcceleratedCompositingForPluginsEnabled( + accelerated_plugins_enabled); + // WebGL and accelerated 2D canvas are always gpu composited. settings->setAcceleratedCompositingForCanvasEnabled( enable_webgl || accelerated_2d_canvas_enabled); @@ -182,4 +194,7 @@ void WebPreferences::Apply(WebView* web_view) const { // Tabs to link is not part of the settings. WebCore calls // ChromeClient::tabsToLinks which is part of the glue code. web_view->setTabsToLinks(tabs_to_links); + + settings->setInteractiveFormValidationEnabled( + interactive_form_validation_enabled); } diff --git a/webkit/glue/webpreferences.h b/webkit/glue/webpreferences.h index b14d323..468e9b4 100644 --- a/webkit/glue/webpreferences.h +++ b/webkit/glue/webpreferences.h @@ -5,8 +5,8 @@ // A struct for managing webkit's settings. // // Adding new values to this class probably involves updating -// WebKit::WebSettings, common/render_messages.h, and -// browser/profile.cc. +// WebKit::WebSettings, common/render_messages.cc, browser/tab_contents/ +// render_view_host_delegate_helper.cc, and browser/profiles/profile.cc. #ifndef WEBKIT_GLUE_WEBPREFERENCES_H__ #define WEBKIT_GLUE_WEBPREFERENCES_H__ @@ -66,13 +66,17 @@ struct WebPreferences { bool frame_flattening_enabled; bool allow_universal_access_from_file_urls; bool allow_file_access_from_file_urls; + bool webaudio_enabled; bool experimental_webgl_enabled; + bool gl_multisampling_enabled; bool show_composited_layer_borders; bool accelerated_compositing_enabled; bool accelerated_layers_enabled; bool accelerated_video_enabled; bool accelerated_2d_canvas_enabled; + bool accelerated_plugins_enabled; bool memory_info_enabled; + bool interactive_form_validation_enabled; // We try to keep the default values the same as the default values in // chrome, except for the cases where it would require lots of extra work for diff --git a/webkit/glue/websocketstreamhandle_impl.cc b/webkit/glue/websocketstreamhandle_impl.cc index 6a56393..d1c7ba0 100644 --- a/webkit/glue/websocketstreamhandle_impl.cc +++ b/webkit/glue/websocketstreamhandle_impl.cc @@ -12,9 +12,9 @@ #include "base/logging.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" -#include "third_party/WebKit/WebKit/chromium/public/WebData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSocketStreamHandleClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSocketStreamHandleClient.h" #include "webkit/glue/websocketstreamhandle_bridge.h" #include "webkit/glue/websocketstreamhandle_delegate.h" diff --git a/webkit/glue/websocketstreamhandle_impl.h b/webkit/glue/websocketstreamhandle_impl.h index f8a08f4..81ae68c 100644 --- a/webkit/glue/websocketstreamhandle_impl.h +++ b/webkit/glue/websocketstreamhandle_impl.h @@ -6,7 +6,7 @@ #define WEBKIT_GLUE_WEBSOCKETSTREAMHANDLE_IMPL_H_ #include "base/ref_counted.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSocketStreamHandle.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSocketStreamHandle.h" namespace webkit_glue { diff --git a/webkit/glue/webthemeengine_impl_linux.cc b/webkit/glue/webthemeengine_impl_linux.cc index d5cc9b4..6d9fc5b 100644 --- a/webkit/glue/webthemeengine_impl_linux.cc +++ b/webkit/glue/webthemeengine_impl_linux.cc @@ -4,10 +4,10 @@ #include "webkit/glue/webthemeengine_impl_linux.h" -#include "gfx/native_theme_linux.h" #include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" +#include "ui/gfx/native_theme_linux.h" using WebKit::WebCanvas; using WebKit::WebColor; @@ -34,10 +34,28 @@ static gfx::NativeThemeLinux::Part NativeThemePart( return gfx::NativeThemeLinux::kScrollbarHorizontalThumb; case WebKit::WebThemeEngine::PartScrollbarVerticalThumb: return gfx::NativeThemeLinux::kScrollbarVerticalThumb; - case WebKit::WebThemeEngine::PartScrollbarHoriztonalTrack: + case WebKit::WebThemeEngine::PartScrollbarHorizontalTrack: return gfx::NativeThemeLinux::kScrollbarHorizontalTrack; case WebKit::WebThemeEngine::PartScrollbarVerticalTrack: return gfx::NativeThemeLinux::kScrollbarVerticalTrack; + case WebKit::WebThemeEngine::PartCheckbox: + return gfx::NativeThemeLinux::kCheckbox; + case WebKit::WebThemeEngine::PartRadio: + return gfx::NativeThemeLinux::kRadio; + case WebKit::WebThemeEngine::PartButton: + return gfx::NativeThemeLinux::kPushButton; + case WebKit::WebThemeEngine::PartTextField: + return gfx::NativeThemeLinux::kTextField; + case WebKit::WebThemeEngine::PartMenuList: + return gfx::NativeThemeLinux::kMenuList; + case WebKit::WebThemeEngine::PartSliderTrack: + return gfx::NativeThemeLinux::kSliderTrack; + case WebKit::WebThemeEngine::PartSliderThumb: + return gfx::NativeThemeLinux::kSliderThumb; + case WebKit::WebThemeEngine::PartInnerSpinButton: + return gfx::NativeThemeLinux::kInnerSpinButton; + case WebKit::WebThemeEngine::PartProgressBar: + return gfx::NativeThemeLinux::kProgressBar; default: return gfx::NativeThemeLinux::kScrollbarDownArrow; } @@ -49,7 +67,7 @@ static gfx::NativeThemeLinux::State NativeThemeState( case WebKit::WebThemeEngine::StateDisabled: return gfx::NativeThemeLinux::kDisabled; case WebKit::WebThemeEngine::StateHover: - return gfx::NativeThemeLinux::kHover; + return gfx::NativeThemeLinux::kHovered; case WebKit::WebThemeEngine::StateNormal: return gfx::NativeThemeLinux::kNormal; case WebKit::WebThemeEngine::StatePressed: @@ -64,21 +82,79 @@ static void GetNativeThemeExtraParams( WebKit::WebThemeEngine::State state, const WebKit::WebThemeEngine::ExtraParams* extra_params, gfx::NativeThemeLinux::ExtraParams* native_theme_extra_params) { - if (part == WebKit::WebThemeEngine::PartScrollbarHoriztonalTrack || - part == WebKit::WebThemeEngine::PartScrollbarVerticalTrack) { - native_theme_extra_params->scrollbar_track.track_x = - extra_params->scrollbarTrack.trackX; - native_theme_extra_params->scrollbar_track.track_y = - extra_params->scrollbarTrack.trackY; - native_theme_extra_params->scrollbar_track.track_width = - extra_params->scrollbarTrack.trackWidth; - native_theme_extra_params->scrollbar_track.track_height = - extra_params->scrollbarTrack.trackHeight; + switch (part) { + case WebKit::WebThemeEngine::PartScrollbarHorizontalTrack: + case WebKit::WebThemeEngine::PartScrollbarVerticalTrack: + native_theme_extra_params->scrollbar_track.track_x = + extra_params->scrollbarTrack.trackX; + native_theme_extra_params->scrollbar_track.track_y = + extra_params->scrollbarTrack.trackY; + native_theme_extra_params->scrollbar_track.track_width = + extra_params->scrollbarTrack.trackWidth; + native_theme_extra_params->scrollbar_track.track_height = + extra_params->scrollbarTrack.trackHeight; + break; + case WebKit::WebThemeEngine::PartCheckbox: + native_theme_extra_params->button.checked = extra_params->button.checked; + native_theme_extra_params->button.indeterminate = + extra_params->button.indeterminate; + break; + case WebKit::WebThemeEngine::PartRadio: + native_theme_extra_params->button.checked = extra_params->button.checked; + break; + case WebKit::WebThemeEngine::PartButton: + native_theme_extra_params->button.is_default = + extra_params->button.isDefault; + native_theme_extra_params->button.background_color = + extra_params->button.backgroundColor; + break; + case WebKit::WebThemeEngine::PartTextField: + native_theme_extra_params->text_field.is_text_area = + extra_params->textField.isTextArea; + native_theme_extra_params->text_field.is_listbox = + extra_params->textField.isListbox; + native_theme_extra_params->text_field.background_color = + extra_params->textField.backgroundColor; + break; + case WebKit::WebThemeEngine::PartMenuList: + native_theme_extra_params->menu_list.arrow_x = + extra_params->menuList.arrowX; + native_theme_extra_params->menu_list.arrow_y = + extra_params->menuList.arrowY; + native_theme_extra_params->menu_list.background_color = + extra_params->menuList.backgroundColor; + break; + case WebKit::WebThemeEngine::PartSliderTrack: + case WebKit::WebThemeEngine::PartSliderThumb: + native_theme_extra_params->slider.vertical = + extra_params->slider.vertical; + native_theme_extra_params->slider.in_drag = extra_params->slider.inDrag; + break; + case WebKit::WebThemeEngine::PartInnerSpinButton: + native_theme_extra_params->inner_spin.spin_up = + extra_params->innerSpin.spinUp; + native_theme_extra_params->inner_spin.read_only = + extra_params->innerSpin.readOnly; + break; + case WebKit::WebThemeEngine::PartProgressBar: + native_theme_extra_params->progress_bar.determinate = + extra_params->progressBar.determinate; + native_theme_extra_params->progress_bar.value_rect_x = + extra_params->progressBar.valueRectX; + native_theme_extra_params->progress_bar.value_rect_y = + extra_params->progressBar.valueRectY; + native_theme_extra_params->progress_bar.value_rect_width = + extra_params->progressBar.valueRectWidth; + native_theme_extra_params->progress_bar.value_rect_height = + extra_params->progressBar.valueRectHeight; + break; + default: + break; // Parts that have no extra params get here. } } WebKit::WebSize WebThemeEngineImpl::getSize(WebKit::WebThemeEngine::Part part) { - return gfx::NativeThemeLinux::instance()->GetSize(NativeThemePart(part)); + return gfx::NativeThemeLinux::instance()->GetPartSize(NativeThemePart(part)); } void WebThemeEngineImpl::paint( diff --git a/webkit/glue/webthemeengine_impl_linux.h b/webkit/glue/webthemeengine_impl_linux.h index 265b80c..3dcba6d 100644 --- a/webkit/glue/webthemeengine_impl_linux.h +++ b/webkit/glue/webthemeengine_impl_linux.h @@ -5,7 +5,7 @@ #ifndef WEBTHEMEENGINE_IMPL_LINUX_H_ #define WEBTHEMEENGINE_IMPL_LINUX_H_ -#include "third_party/WebKit/WebKit/chromium/public/linux/WebThemeEngine.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebThemeEngine.h" namespace webkit_glue { diff --git a/webkit/glue/webthemeengine_impl_mac.cc b/webkit/glue/webthemeengine_impl_mac.cc index ac28334..cafc316 100644 --- a/webkit/glue/webthemeengine_impl_mac.cc +++ b/webkit/glue/webthemeengine_impl_mac.cc @@ -6,8 +6,8 @@ #include -#include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" using WebKit::WebCanvas; using WebKit::WebRect; diff --git a/webkit/glue/webthemeengine_impl_mac.h b/webkit/glue/webthemeengine_impl_mac.h index 788cba3..6b0415f 100644 --- a/webkit/glue/webthemeengine_impl_mac.h +++ b/webkit/glue/webthemeengine_impl_mac.h @@ -5,7 +5,7 @@ #ifndef WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_MAC_H_ #define WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_MAC_H_ -#include "third_party/WebKit/WebKit/chromium/public/mac/WebThemeEngine.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebThemeEngine.h" namespace webkit_glue { diff --git a/webkit/glue/webthemeengine_impl_win.cc b/webkit/glue/webthemeengine_impl_win.cc index 85dc113..a6344b6 100644 --- a/webkit/glue/webthemeengine_impl_win.cc +++ b/webkit/glue/webthemeengine_impl_win.cc @@ -4,10 +4,10 @@ #include "webkit/glue/webthemeengine_impl_win.h" -#include "gfx/native_theme_win.h" #include "skia/ext/platform_canvas.h" #include "skia/ext/skia_utils_win.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" +#include "ui/gfx/native_theme_win.h" using WebKit::WebCanvas; using WebKit::WebColor; diff --git a/webkit/glue/webthemeengine_impl_win.h b/webkit/glue/webthemeengine_impl_win.h index 6e749c4..ecdbec2 100644 --- a/webkit/glue/webthemeengine_impl_win.h +++ b/webkit/glue/webthemeengine_impl_win.h @@ -5,7 +5,7 @@ #ifndef WEBTHEMEENGINE_IMPL_WIN_H_ #define WEBTHEMEENGINE_IMPL_WIN_H_ -#include "third_party/WebKit/WebKit/chromium/public/win/WebThemeEngine.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/win/WebThemeEngine.h" namespace webkit_glue { diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc index 0372567..d4b5162 100644 --- a/webkit/glue/weburlloader_impl.cc +++ b/webkit/glue/weburlloader_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,15 +18,15 @@ #include "net/base/net_errors.h" #include "net/base/net_util.h" #include "net/http/http_response_headers.h" -#include "third_party/WebKit/WebKit/chromium/public/WebHTTPHeaderVisitor.h" -#include "third_party/WebKit/WebKit/chromium/public/WebHTTPLoadInfo.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLLoadTiming.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebHTTPHeaderVisitor.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebHTTPLoadInfo.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoadTiming.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" #include "webkit/glue/ftp_directory_listing_response_delegate.h" #include "webkit/glue/multipart_response_delegate.h" #include "webkit/glue/resource_loader_bridge.h" @@ -69,10 +69,8 @@ class HeaderFlattener : public WebHTTPHeaderVisitor { const std::string& value_utf8 = value.utf8(); // Skip over referrer headers found in the header map because we already - // pulled it out as a separate parameter. We likewise prune the UA since - // that will be added back by the network layer. - if (LowerCaseEqualsASCII(name_utf8, "referer") || - LowerCaseEqualsASCII(name_utf8, "user-agent")) + // pulled it out as a separate parameter. + if (LowerCaseEqualsASCII(name_utf8, "referer")) return; // Skip over "Cache-Control: max-age=0" header if the corresponding @@ -146,11 +144,12 @@ ResourceType::Type FromTargetType(WebURLRequest::TargetType type) { // Extracts the information from a data: url. bool GetInfoFromDataURL(const GURL& url, ResourceResponseInfo* info, - std::string* data, URLRequestStatus* status) { + std::string* data, + net::URLRequestStatus* status) { std::string mime_type; std::string charset; if (net::DataURL::Parse(url, &mime_type, &charset, data)) { - *status = URLRequestStatus(URLRequestStatus::SUCCESS, 0); + *status = net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0); info->request_time = Time::Now(); info->response_time = Time::Now(); info->headers = NULL; @@ -162,7 +161,8 @@ bool GetInfoFromDataURL(const GURL& url, return true; } - *status = URLRequestStatus(URLRequestStatus::FAILED, net::ERR_INVALID_URL); + *status = net::URLRequestStatus(net::URLRequestStatus::FAILED, + net::ERR_INVALID_URL); return false; } @@ -244,8 +244,8 @@ void PopulateURLResponse( // pass it to GetSuggestedFilename. std::string value; if (headers->EnumerateHeader(NULL, "content-disposition", &value)) { - response->setSuggestedFileName(FilePathToWebString( - net::GetSuggestedFilename(url, value, "", FilePath()))); + response->setSuggestedFileName( + net::GetSuggestedFilename(url, value, "", string16())); } Time time_val; @@ -294,10 +294,9 @@ class WebURLLoaderImpl::Context : public base::RefCounted, virtual void OnDownloadedData(int len); virtual void OnReceivedData(const char* data, int len); virtual void OnReceivedCachedMetadata(const char* data, int len); - virtual void OnCompletedRequest( - const URLRequestStatus& status, - const std::string& security_info, - const base::Time& completion_time); + virtual void OnCompletedRequest(const net::URLRequestStatus& status, + const std::string& security_info, + const base::Time& completion_time); private: friend class base::RefCounted; @@ -404,12 +403,6 @@ void WebURLLoaderImpl::Context::Start( if (!request.allowStoredCredentials()) load_flags |= net::LOAD_DO_NOT_SEND_AUTH_DATA; - // TODO(jcampan): in the non out-of-process plugin case the request does not - // have a requestor_pid. Find a better place to set this. - int requestor_pid = request.requestorProcessID(); - if (requestor_pid == 0) - requestor_pid = base::GetCurrentProcId(); - HeaderFlattener flattener(load_flags); request.visitHTTPHeaderFields(&flattener); @@ -430,7 +423,10 @@ void WebURLLoaderImpl::Context::Start( request_info.main_frame_origin = main_frame_origin; request_info.headers = flattener.GetBuffer(); request_info.load_flags = load_flags; - request_info.requestor_pid = requestor_pid; + // requestor_pid only needs to be non-zero if the request originates outside + // the render process, so we can use requestorProcessID even for requests + // from in-process plugins. + request_info.requestor_pid = request.requestorProcessID(); request_info.request_type = FromTargetType(request.targetType()); request_info.appcache_host_id = request.appCacheHostID(); request_info.routing_id = request.requestorID(); @@ -621,7 +617,7 @@ void WebURLLoaderImpl::Context::OnReceivedCachedMetadata( } void WebURLLoaderImpl::Context::OnCompletedRequest( - const URLRequestStatus& status, + const net::URLRequestStatus& status, const std::string& security_info, const base::Time& completion_time) { if (ftp_listing_delegate_.get()) { @@ -638,9 +634,9 @@ void WebURLLoaderImpl::Context::OnCompletedRequest( completed_bridge_.swap(bridge_); if (client_) { - if (status.status() != URLRequestStatus::SUCCESS) { + if (status.status() != net::URLRequestStatus::SUCCESS) { int error_code; - if (status.status() == URLRequestStatus::HANDLED_EXTERNALLY) { + if (status.status() == net::URLRequestStatus::HANDLED_EXTERNALLY) { // By marking this request as aborted we insure that we don't navigate // to an error page. error_code = net::ERR_ABORTED; @@ -691,7 +687,7 @@ bool WebURLLoaderImpl::Context::CanHandleDataURL(const GURL& url) const { void WebURLLoaderImpl::Context::HandleDataURL() { ResourceResponseInfo info; - URLRequestStatus status; + net::URLRequestStatus status; std::string data; if (GetInfoFromDataURL(request_.url(), &info, &data, &status)) { @@ -724,9 +720,10 @@ void WebURLLoaderImpl::loadSynchronously(const WebURLRequest& request, // TODO(tc): For file loads, we may want to include a more descriptive // status code or status text. - const URLRequestStatus::Status& status = sync_load_response.status.status(); - if (status != URLRequestStatus::SUCCESS && - status != URLRequestStatus::HANDLED_EXTERNALLY) { + const net::URLRequestStatus::Status& status = + sync_load_response.status.status(); + if (status != net::URLRequestStatus::SUCCESS && + status != net::URLRequestStatus::HANDLED_EXTERNALLY) { response.setURL(final_url); error.domain = WebString::fromUTF8(net::kErrorDomain); error.reason = sync_load_response.status.os_error(); diff --git a/webkit/glue/weburlloader_impl.h b/webkit/glue/weburlloader_impl.h index f9e5a0b..9a39911 100644 --- a/webkit/glue/weburlloader_impl.h +++ b/webkit/glue/weburlloader_impl.h @@ -6,7 +6,7 @@ #define WEBKIT_GLUE_WEBURLLOADER_IMPL_H_ #include "base/ref_counted.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURLLoader.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoader.h" namespace webkit_glue { diff --git a/webkit/glue/webvideoframe_impl.cc b/webkit/glue/webvideoframe_impl.cc index bfb1d53..c2e115d 100644 --- a/webkit/glue/webvideoframe_impl.cc +++ b/webkit/glue/webvideoframe_impl.cc @@ -5,7 +5,7 @@ #include "webkit/glue/webvideoframe_impl.h" #include "media/base/video_frame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebVideoFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" using namespace WebKit; diff --git a/webkit/glue/webvideoframe_impl.h b/webkit/glue/webvideoframe_impl.h index 5454089..0aca052 100644 --- a/webkit/glue/webvideoframe_impl.h +++ b/webkit/glue/webvideoframe_impl.h @@ -6,7 +6,7 @@ #define WEBKIT_GLUE_WEBVIDEOFRAME_IMPL_H_ #include "media/base/video_frame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebVideoFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebVideoFrame.h" using namespace WebKit; diff --git a/webkit/glue/webview_unittest.cc b/webkit/glue/webview_unittest.cc index 22c9cea..1d3d2ea 100644 --- a/webkit/glue/webview_unittest.cc +++ b/webkit/glue/webview_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/tools/test_shell/test_shell_test.h" using WebKit::WebView; diff --git a/webkit/glue/window_open_disposition.h b/webkit/glue/window_open_disposition.h index 24495f1..c9bfa0a 100644 --- a/webkit/glue/window_open_disposition.h +++ b/webkit/glue/window_open_disposition.h @@ -5,7 +5,7 @@ #ifndef WEBKIT_GLUE_WINDOW_OPEN_DISPOSITION_H_ #define WEBKIT_GLUE_WINDOW_OPEN_DISPOSITION_H_ -#include "third_party/WebKit/WebKit/chromium/public/WebNavigationPolicy.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationPolicy.h" enum WindowOpenDisposition { SUPPRESS_OPEN, -- cgit v1.1