diff options
author | Torne (Richard Coles) <torne@google.com> | 2013-05-13 16:52:09 +0100 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2013-05-13 16:52:09 +0100 |
commit | b2df76ea8fec9e32f6f3718986dba0d95315b29c (patch) | |
tree | 0182623e854b794f7307829abf4be16435a0193a /android_webview | |
parent | 121d6d4bf5931d9b1dbc0b9a262f6c609440f6c7 (diff) | |
download | chromium_org-b2df76ea8fec9e32f6f3718986dba0d95315b29c.tar.gz |
Merge from Chromium at DEPS revision r199464
This commit was generated by merge_to_master.py.
Change-Id: Ic3d1f97a4fb4edd1e6ed66a70b5040da1622b5a9
Diffstat (limited to 'android_webview')
57 files changed, 1508 insertions, 608 deletions
diff --git a/android_webview/android_webview.gyp b/android_webview/android_webview.gyp index 6480f08864..bdf91bf495 100644 --- a/android_webview/android_webview.gyp +++ b/android_webview/android_webview.gyp @@ -110,6 +110,8 @@ 'browser/aw_devtools_delegate.h', 'browser/aw_download_manager_delegate.cc', 'browser/aw_download_manager_delegate.h', + 'browser/aw_form_database_service.cc', + 'browser/aw_form_database_service.h', 'browser/aw_http_auth_handler_base.cc', 'browser/aw_http_auth_handler_base.h', 'browser/aw_javascript_dialog_manager.cc', diff --git a/android_webview/android_webview_common.target.darwin-arm.mk b/android_webview/android_webview_common.target.darwin-arm.mk index 8a19b9ba51..acb88647b3 100644 --- a/android_webview/android_webview_common.target.darwin-arm.mk +++ b/android_webview/android_webview_common.target.darwin-arm.mk @@ -34,6 +34,7 @@ LOCAL_SRC_FILES := \ android_webview/browser/aw_cookie_access_policy.cc \ android_webview/browser/aw_devtools_delegate.cc \ android_webview/browser/aw_download_manager_delegate.cc \ + android_webview/browser/aw_form_database_service.cc \ android_webview/browser/aw_http_auth_handler_base.cc \ android_webview/browser/aw_javascript_dialog_manager.cc \ android_webview/browser/aw_login_delegate.cc \ diff --git a/android_webview/android_webview_common.target.darwin-x86.mk b/android_webview/android_webview_common.target.darwin-x86.mk index 877e26e326..42e9e305f3 100644 --- a/android_webview/android_webview_common.target.darwin-x86.mk +++ b/android_webview/android_webview_common.target.darwin-x86.mk @@ -34,6 +34,7 @@ LOCAL_SRC_FILES := \ android_webview/browser/aw_cookie_access_policy.cc \ android_webview/browser/aw_devtools_delegate.cc \ android_webview/browser/aw_download_manager_delegate.cc \ + android_webview/browser/aw_form_database_service.cc \ android_webview/browser/aw_http_auth_handler_base.cc \ android_webview/browser/aw_javascript_dialog_manager.cc \ android_webview/browser/aw_login_delegate.cc \ diff --git a/android_webview/android_webview_common.target.linux-arm.mk b/android_webview/android_webview_common.target.linux-arm.mk index 8a19b9ba51..acb88647b3 100644 --- a/android_webview/android_webview_common.target.linux-arm.mk +++ b/android_webview/android_webview_common.target.linux-arm.mk @@ -34,6 +34,7 @@ LOCAL_SRC_FILES := \ android_webview/browser/aw_cookie_access_policy.cc \ android_webview/browser/aw_devtools_delegate.cc \ android_webview/browser/aw_download_manager_delegate.cc \ + android_webview/browser/aw_form_database_service.cc \ android_webview/browser/aw_http_auth_handler_base.cc \ android_webview/browser/aw_javascript_dialog_manager.cc \ android_webview/browser/aw_login_delegate.cc \ diff --git a/android_webview/android_webview_common.target.linux-x86.mk b/android_webview/android_webview_common.target.linux-x86.mk index 877e26e326..42e9e305f3 100644 --- a/android_webview/android_webview_common.target.linux-x86.mk +++ b/android_webview/android_webview_common.target.linux-x86.mk @@ -34,6 +34,7 @@ LOCAL_SRC_FILES := \ android_webview/browser/aw_cookie_access_policy.cc \ android_webview/browser/aw_devtools_delegate.cc \ android_webview/browser/aw_download_manager_delegate.cc \ + android_webview/browser/aw_form_database_service.cc \ android_webview/browser/aw_http_auth_handler_base.cc \ android_webview/browser/aw_javascript_dialog_manager.cc \ android_webview/browser/aw_login_delegate.cc \ diff --git a/android_webview/android_webview_tests.gypi b/android_webview/android_webview_tests.gypi index 69cc234fdb..bb9cc0f195 100644 --- a/android_webview/android_webview_tests.gypi +++ b/android_webview/android_webview_tests.gypi @@ -67,10 +67,12 @@ 'type': '<(gtest_target_type)', 'dependencies': [ '../base/base.gyp:test_support_base', + '../content/content.gyp:test_support_content', '../net/net.gyp:net_test_support', '../testing/android/native_test.gyp:native_test_native_code', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', + '../ui/ui.gyp:ui_jni_headers', 'android_webview_common', ], 'include_dirs': [ @@ -79,6 +81,7 @@ '<(SHARED_INTERMEDIATE_DIR)/android_webview_unittests', ], 'sources': [ + 'browser/aw_form_database_service_unittest.cc', 'browser/net/android_stream_reader_url_request_job_unittest.cc', 'browser/net/input_stream_reader_unittest.cc', 'lib/main/webview_tests.cc', diff --git a/android_webview/browser/DEPS b/android_webview/browser/DEPS index cb5b561126..555efd1d6c 100644 --- a/android_webview/browser/DEPS +++ b/android_webview/browser/DEPS @@ -7,10 +7,14 @@ include_rules = [ "+cc", "+components/auto_login_parser", + "+components/autofill/browser", + "+components/autofill/common", "+components/navigation_interception", "+components/visitedlink/browser", + "+components/webdata/common", "+content/public/browser", + "+content/public/test", "+gpu/command_buffer/client", diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc index 983cd3efa2..1ecf9ec442 100644 --- a/android_webview/browser/aw_browser_context.cc +++ b/android_webview/browser/aw_browser_context.cc @@ -4,6 +4,7 @@ #include "android_webview/browser/aw_browser_context.h" +#include "android_webview/browser/aw_form_database_service.h" #include "android_webview/browser/aw_quota_manager_bridge.h" #include "android_webview/browser/jni_dependency_factory.h" #include "android_webview/browser/net/aw_url_request_context_getter.h" @@ -99,6 +100,16 @@ AwQuotaManagerBridge* AwBrowserContext::GetQuotaManagerBridge() { return quota_manager_bridge_.get(); } +// TODO(sgurun) we may need to do this at the constructor, depending on +// how the rest of the implementation to enable autocomplete unwraps itself. +AwFormDatabaseService* AwBrowserContext::GetFormDatabaseService() { + if (!form_database_service_) { + form_database_service_.reset( + new AwFormDatabaseService(context_storage_path_)); + } + return form_database_service_.get(); +} + base::FilePath AwBrowserContext::GetPath() { return context_storage_path_; } diff --git a/android_webview/browser/aw_browser_context.h b/android_webview/browser/aw_browser_context.h index 254a24775b..177c6122e9 100644 --- a/android_webview/browser/aw_browser_context.h +++ b/android_webview/browser/aw_browser_context.h @@ -32,8 +32,9 @@ class WebContents; namespace android_webview { -class AwURLRequestContextGetter; +class AwFormDatabaseService; class AwQuotaManagerBridge; +class AwURLRequestContextGetter; class JniDependencyFactory; class AwBrowserContext : public content::BrowserContext, @@ -67,6 +68,8 @@ class AwBrowserContext : public content::BrowserContext, AwQuotaManagerBridge* GetQuotaManagerBridge(); + AwFormDatabaseService* GetFormDatabaseService(); + // content::BrowserContext implementation. virtual base::FilePath GetPath() OVERRIDE; virtual bool IsOffTheRecord() const OVERRIDE; @@ -101,6 +104,7 @@ class AwBrowserContext : public content::BrowserContext, scoped_refptr<content::GeolocationPermissionContext> geolocation_permission_context_; scoped_ptr<AwQuotaManagerBridge> quota_manager_bridge_; + scoped_ptr<AwFormDatabaseService> form_database_service_; AwDownloadManagerDelegate download_manager_delegate_; diff --git a/android_webview/browser/aw_form_database_service.cc b/android_webview/browser/aw_form_database_service.cc new file mode 100644 index 0000000000..d08ed0e2da --- /dev/null +++ b/android_webview/browser/aw_form_database_service.cc @@ -0,0 +1,105 @@ +// Copyright (c) 2013 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 "android_webview/browser/aw_form_database_service.h" +#include "base/logging.h" +#include "components/autofill/browser/webdata/autofill_table.h" +#include "components/webdata/common/webdata_constants.h" +#include "content/public/browser/browser_thread.h" +#include "ui/base/l10n/l10n_util_android.h" + +using content::BrowserThread; + +namespace { + +// Callback to handle database error. It seems chrome uses this to +// display an error dialog box only. +void DatabaseErrorCallback(sql::InitStatus status) { + LOG(WARNING) << "initializing autocomplete database failed"; +} + +} // namespace + +namespace android_webview { + +AwFormDatabaseService::AwFormDatabaseService(const base::FilePath path) + : pending_query_handle_(0), + has_form_data_(false), + completion_(false, false) { + + web_database_ = new WebDatabaseService(path.Append(kWebDataFilename)); + web_database_->AddTable( + scoped_ptr<WebDatabaseTable>(new autofill::AutofillTable( + l10n_util::GetDefaultLocale()))); + web_database_->LoadDatabase(); + + autofill_data_ = new autofill::AutofillWebDataService( + web_database_, base::Bind(&DatabaseErrorCallback)); + autofill_data_->Init(); +} + +AwFormDatabaseService::~AwFormDatabaseService() { + CancelPendingQuery(); + Shutdown(); +} + +void AwFormDatabaseService::Shutdown() { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + autofill_data_->ShutdownOnUIThread(); + web_database_->ShutdownDatabase(); +} + +void AwFormDatabaseService::CancelPendingQuery() { + if (pending_query_handle_) { + if (autofill_data_) + autofill_data_->CancelRequest(pending_query_handle_); + pending_query_handle_ = 0; + } +} + +scoped_refptr<autofill::AutofillWebDataService> +AwFormDatabaseService::get_autofill_webdata_service() { + return autofill_data_; +} + +void AwFormDatabaseService::ClearFormData() { + base::Time begin; + base::Time end = base::Time::Max(); + autofill_data_->RemoveFormElementsAddedBetween(begin, end); + autofill_data_->RemoveAutofillDataModifiedBetween(begin, end); +} + +bool AwFormDatabaseService::HasFormData() { + BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, + base::Bind(&AwFormDatabaseService::HasFormDataImpl, + base::Unretained(this))); + completion_.Wait(); + return has_form_data_; +} + +void AwFormDatabaseService::HasFormDataImpl() { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); + pending_query_handle_ = autofill_data_->HasFormElements(this); +} + + +void AwFormDatabaseService::OnWebDataServiceRequestDone( + WebDataServiceBase::Handle h, + const WDTypedResult* result) { + + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); + DCHECK_EQ(pending_query_handle_, h); + pending_query_handle_ = 0; + has_form_data_ = false; + + if (result) { + DCHECK_EQ(AUTOFILL_VALUE_RESULT, result->GetType()); + const WDResult<bool>* autofill_result = + static_cast<const WDResult<bool>*>(result); + has_form_data_ = autofill_result->GetValue(); + } + completion_.Signal(); +} + +} // namespace android_webview diff --git a/android_webview/browser/aw_form_database_service.h b/android_webview/browser/aw_form_database_service.h new file mode 100644 index 0000000000..cb66d4e4dd --- /dev/null +++ b/android_webview/browser/aw_form_database_service.h @@ -0,0 +1,63 @@ +// Copyright (c) 2013 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 ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_ +#define ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_ + +#include "base/basictypes.h" +#include "base/files/file_path.h" +#include "base/synchronization/waitable_event.h" +#include "components/autofill/browser/webdata/autofill_webdata_service.h" +#include "components/webdata/common/web_data_service_consumer.h" +#include "components/webdata/common/web_database_service.h" + +namespace android_webview { + +// Handles the database operations necessary to implement the autocomplete +// functionality. This includes creating and initializing the components that +// handle the database backend, and providing a synchronous interface when +// needed (the chromium database components have an async. interface). +class AwFormDatabaseService : public WebDataServiceConsumer { + public: + AwFormDatabaseService(const base::FilePath path); + + virtual ~AwFormDatabaseService(); + + void Shutdown(); + + // Returns whether the database has any data stored. May do + // IO access and block. + bool HasFormData(); + + // Clear any saved form data. Executes asynchronously. + void ClearFormData(); + + scoped_refptr<autofill::AutofillWebDataService> + get_autofill_webdata_service(); + + // WebDataServiceConsumer implementation. + virtual void OnWebDataServiceRequestDone( + WebDataServiceBase::Handle h, + const WDTypedResult* result) OVERRIDE; + + private: + // Cancels the currently pending WebDataService query, if there is one. + void CancelPendingQuery(); + + void HasFormDataImpl(); + + // Stores the query handle when an async database query is executed. + WebDataServiceBase::Handle pending_query_handle_; + bool has_form_data_; + base::WaitableEvent completion_; + + scoped_refptr<autofill::AutofillWebDataService> autofill_data_; + scoped_refptr<WebDatabaseService> web_database_; + + DISALLOW_COPY_AND_ASSIGN(AwFormDatabaseService); +}; + +} // namespace android_webview + +#endif // ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_ diff --git a/android_webview/browser/aw_form_database_service_unittest.cc b/android_webview/browser/aw_form_database_service_unittest.cc new file mode 100644 index 0000000000..e269a625f5 --- /dev/null +++ b/android_webview/browser/aw_form_database_service_unittest.cc @@ -0,0 +1,73 @@ +// Copyright (c) 2013 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 <vector> + +#include "android_webview/browser/aw_form_database_service.h" +#include "base/android/jni_android.h" +#include "base/files/scoped_temp_dir.h" +#include "base/memory/scoped_ptr.h" +#include "base/message_loop.h" +#include "base/utf_string_conversions.h" +#include "components/autofill/browser/webdata/autofill_webdata_service.h" +#include "components/autofill/common/form_field_data.h" +#include "content/public/test/test_browser_thread.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/l10n/l10n_util_android.h" + +using autofill::AutofillWebDataService; +using autofill::FormFieldData; +using base::android::AttachCurrentThread; +using content::BrowserThread; +using testing::Test; + +namespace android_webview { + +class AwFormDatabaseServiceTest : public Test { + public: + AwFormDatabaseServiceTest() + : ui_thread_(BrowserThread::UI, &message_loop_), + db_thread_(BrowserThread::DB) { + db_thread_.Start(); + } + + protected: + virtual void SetUp() { + ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); + env_ = AttachCurrentThread(); + ASSERT_TRUE(env_ != NULL); + ASSERT_TRUE(l10n_util::RegisterLocalizationUtil(env_)); + + service_.reset(new AwFormDatabaseService(temp_dir_.path())); + } + + virtual void TearDown() { + service_->Shutdown(); + } + + // The path to the temporary directory used for the test operations. + base::ScopedTempDir temp_dir_; + // A message loop for UI thread. + MessageLoop message_loop_; + content::TestBrowserThread ui_thread_; + content::TestBrowserThread db_thread_; + JNIEnv* env_; + + scoped_ptr<AwFormDatabaseService> service_; +}; + +TEST_F(AwFormDatabaseServiceTest, HasAndClearFormData) { + EXPECT_FALSE(service_->HasFormData()); + std::vector<FormFieldData> fields; + FormFieldData field; + field.name = ASCIIToUTF16("foo"); + field.value = ASCIIToUTF16("bar"); + fields.push_back(field); + service_->get_autofill_webdata_service()->AddFormFields(fields); + EXPECT_TRUE(service_->HasFormData()); + service_->ClearFormData(); + EXPECT_FALSE(service_->HasFormData()); +} + +} // namespace android_webview diff --git a/android_webview/browser/browser_view_renderer.h b/android_webview/browser/browser_view_renderer.h index 5c485f09ee..b11a1fc9df 100644 --- a/android_webview/browser/browser_view_renderer.h +++ b/android_webview/browser/browser_view_renderer.h @@ -13,7 +13,6 @@ struct AwDrawGLInfo; namespace content { class ContentViewCore; -class WebContents; } namespace gfx { @@ -28,22 +27,22 @@ class BrowserViewRenderer { public: class Client { public: - // Called to trigger view invalidations. - virtual void Invalidate() = 0; + // Request DrawGL be called with AwDrawGLInfo::kModeProcess. The callback + // may never be made, and the mode may be promoted to kModeDraw. + virtual void RequestProcessMode() = 0; - // Called when a new Picture is available. Needs to be enabled - // via the EnableOnNewPicture method. - virtual void OnNewPicture( - const base::android::JavaRef<jobject>& picture) = 0; + // Called when a new Picture is available. Needs to be enabled + // via the EnableOnNewPicture method. + virtual void OnNewPicture() = 0; - // Called to get view's absolute location on the screen. - virtual gfx::Point GetLocationOnScreen() = 0; + // Called to trigger view invalidations. + virtual void Invalidate() = 0; - // Called when the RenderView page scale changes. - virtual void OnPageScaleFactorChanged(float page_scale_factor) = 0; + // Called to get view's absolute location on the screen. + virtual gfx::Point GetLocationOnScreen() = 0; protected: - virtual ~Client() {} + virtual ~Client() {} }; // Delegate to perform rendering actions involving Java objects. @@ -70,25 +69,19 @@ class BrowserViewRenderer { virtual ~JavaHelper() {} }; - enum OnNewPictureMode { - kOnNewPictureDisabled = 0, - kOnNewPictureEnabled, - kOnNewPictureInvalidationOnly, - }; - // Content control methods. virtual void SetContents(content::ContentViewCore* content_view_core) = 0; // Hardware rendering methods. + virtual bool PrepareDrawGL(int x, int y) = 0; virtual void DrawGL(AwDrawGLInfo* draw_info) = 0; - virtual void SetScrollForHWFrame(int x, int y) = 0; // Software rendering methods. virtual bool DrawSW(jobject java_canvas, const gfx::Rect& clip_bounds) = 0; // CapturePicture API methods. virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() = 0; - virtual void EnableOnNewPicture(OnNewPictureMode mode) = 0; + virtual void EnableOnNewPicture(bool enabled) = 0; // View update notifications. virtual void OnVisibilityChanged(bool view_visible, bool window_visible) = 0; diff --git a/android_webview/browser/browser_view_renderer_impl.cc b/android_webview/browser/browser_view_renderer_impl.cc index 94a59e18fb..b21541b979 100644 --- a/android_webview/browser/browser_view_renderer_impl.cc +++ b/android_webview/browser/browser_view_renderer_impl.cc @@ -118,15 +118,15 @@ class BrowserViewRendererImpl::UserData : public content::WebContents::Data { }; // static -BrowserViewRendererImpl* BrowserViewRendererImpl::Create( +BrowserViewRenderer* BrowserViewRendererImpl::Create( BrowserViewRenderer::Client* client, JavaHelper* java_helper) { if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kMergeUIAndRendererCompositorThreads)) { - return new InProcessViewRenderer(client, java_helper); + switches::kNoMergeUIAndRendererCompositorThreads)) { + return new BrowserViewRendererImpl(client, java_helper); } - return new BrowserViewRendererImpl(client, java_helper); + return new InProcessViewRenderer(client, java_helper); } // static @@ -135,15 +135,6 @@ BrowserViewRendererImpl* BrowserViewRendererImpl::FromWebContents( return UserData::GetInstance(contents); } -// static -BrowserViewRendererImpl* BrowserViewRendererImpl::FromId(int render_process_id, - int render_view_id) { - const content::RenderViewHost* rvh = - content::RenderViewHost::FromID(render_process_id, render_view_id); - if (!rvh) return NULL; - return FromWebContents(content::WebContents::FromRenderViewHost(rvh)); -} - BrowserViewRendererImpl::BrowserViewRendererImpl( BrowserViewRenderer::Client* client, JavaHelper* java_helper) @@ -160,7 +151,7 @@ BrowserViewRendererImpl::BrowserViewRendererImpl( is_composite_pending_(false), dpi_scale_(1.0f), page_scale_(1.0f), - on_new_picture_mode_(kOnNewPictureDisabled), + new_picture_enabled_(false), last_frame_context_(NULL), web_contents_(NULL), update_frame_info_callback_( @@ -182,11 +173,6 @@ BrowserViewRendererImpl::~BrowserViewRendererImpl() { SetContents(NULL); } -void BrowserViewRendererImpl::BindSynchronousCompositor( - content::SynchronousCompositor* compositor) { - NOTREACHED(); // Must be handled by the InProcessViewRenderer -} - // static void BrowserViewRendererImpl::SetAwDrawSWFunctionTable( AwDrawSWFunctionTable* table) { @@ -229,6 +215,11 @@ void BrowserViewRendererImpl::WebContentsGone() { web_contents_ = NULL; } +bool BrowserViewRendererImpl::PrepareDrawGL(int x, int y) { + hw_rendering_scroll_ = gfx::Point(x, y); + return true; +} + void BrowserViewRendererImpl::DrawGL(AwDrawGLInfo* draw_info) { TRACE_EVENT0("android_webview", "BrowserViewRendererImpl::DrawGL"); @@ -321,10 +312,6 @@ void BrowserViewRendererImpl::DrawGL(AwDrawGLInfo* draw_info) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } -void BrowserViewRendererImpl::SetScrollForHWFrame(int x, int y) { - hw_rendering_scroll_ = gfx::Point(x, y); -} - bool BrowserViewRendererImpl::DrawSW(jobject java_canvas, const gfx::Rect& clip) { TRACE_EVENT0("android_webview", "BrowserViewRendererImpl::DrawSW"); @@ -421,16 +408,14 @@ ScopedJavaLocalRef<jobject> BrowserViewRendererImpl::CapturePicture() { return java_helper_->RecordBitmapIntoPicture(env, jbitmap); } -void BrowserViewRendererImpl::EnableOnNewPicture(OnNewPictureMode mode) { - on_new_picture_mode_ = mode; +void BrowserViewRendererImpl::EnableOnNewPicture(bool enabled) { + new_picture_enabled_ = enabled; // TODO(leandrogracia): when SW rendering uses the compositor rather than // picture rasterization, send update the renderer side with the correct // listener state. (For now, we always leave render picture listener enabled). // render_view_host_ext_->EnableCapturePictureCallback(enabled); - //DCHECK(view_renderer_host_); - //view_renderer_host_->EnableCapturePictureCallback( - // on_new_picture_mode_ == kOnNewPictureEnabled); + // http://crbug.com/176945 } void BrowserViewRendererImpl::OnVisibilityChanged(bool view_visible, @@ -482,19 +467,15 @@ void BrowserViewRendererImpl::ScheduleComposite() { skia::RefPtr<SkPicture> BrowserViewRendererImpl::GetLastCapturedPicture() { // Use the latest available picture if the listener callback is enabled. - skia::RefPtr<SkPicture> picture; - if (on_new_picture_mode_ == kOnNewPictureEnabled) - picture = RendererPictureMap::GetInstance()->GetRendererPicture( - web_contents_->GetRoutingID()); - - // If not available or not in listener mode get it synchronously. - if (!picture) { - view_renderer_host_->CapturePictureSync(); - picture = RendererPictureMap::GetInstance()->GetRendererPicture( - web_contents_->GetRoutingID()); - } + skia::RefPtr<SkPicture> picture = + RendererPictureMap::GetInstance()->GetRendererPicture( + web_contents_->GetRoutingID()); + if (picture) return picture; - return picture; + // Get it synchronously. + view_renderer_host_->CapturePictureSync(); + return RendererPictureMap::GetInstance()->GetRendererPicture( + web_contents_->GetRoutingID()); } void BrowserViewRendererImpl::OnPictureUpdated(int process_id, @@ -503,27 +484,12 @@ void BrowserViewRendererImpl::OnPictureUpdated(int process_id, if (render_view_id != web_contents_->GetRoutingID()) return; - // TODO(leandrogracia): this can be made unconditional once software rendering - // uses Ubercompositor. Until then this path is required for SW invalidations. - if (on_new_picture_mode_ == kOnNewPictureEnabled) - client_->OnNewPicture(CapturePicture()); + client_->OnNewPicture(); - // TODO(leandrogracia): delete when sw rendering uses Ubercompositor. - // Invalidation should be provided by the compositor only. + // TODO(mkosiba): Remove when invalidation path is re-implemented. Invalidate(); } -void BrowserViewRendererImpl::OnPageScaleFactorChanged( - int process_id, - int render_view_id, - float page_scale_factor) { - CHECK_EQ(web_contents_->GetRenderProcessHost()->GetID(), process_id); - if (render_view_id != web_contents_->GetRoutingID()) - return; - - client_->OnPageScaleFactorChanged(page_scale_factor); -} - void BrowserViewRendererImpl::SetCompositorVisibility(bool visible) { if (compositor_visible_ != visible) { compositor_visible_ = visible; @@ -539,11 +505,6 @@ void BrowserViewRendererImpl::ResetCompositor() { void BrowserViewRendererImpl::Invalidate() { if (view_visible_) client_->Invalidate(); - - // When not in invalidation-only mode onNewPicture will be triggered - // from the OnPictureUpdated callback. - if (on_new_picture_mode_ == kOnNewPictureInvalidationOnly) - client_->OnNewPicture(ScopedJavaLocalRef<jobject>()); } bool BrowserViewRendererImpl::RenderSW(SkCanvas* canvas) { diff --git a/android_webview/browser/browser_view_renderer_impl.h b/android_webview/browser/browser_view_renderer_impl.h index 459c7a3112..53944b0cda 100644 --- a/android_webview/browser/browser_view_renderer_impl.h +++ b/android_webview/browser/browser_view_renderer_impl.h @@ -37,27 +37,22 @@ class BrowserViewRendererImpl public ViewRendererHost::Client, public content::Compositor::Client { public: - static BrowserViewRendererImpl* Create(BrowserViewRenderer::Client* client, + static BrowserViewRenderer* Create(BrowserViewRenderer::Client* client, JavaHelper* java_helper); static BrowserViewRendererImpl* FromWebContents( content::WebContents* contents); - static BrowserViewRendererImpl* FromId(int render_process_id, - int render_view_id); static void SetAwDrawSWFunctionTable(AwDrawSWFunctionTable* table); virtual ~BrowserViewRendererImpl(); - virtual void BindSynchronousCompositor( - content::SynchronousCompositor* compositor); - // BrowserViewRenderer implementation. virtual void SetContents( content::ContentViewCore* content_view_core) OVERRIDE; + virtual bool PrepareDrawGL(int x, int y) OVERRIDE; virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE; - virtual void SetScrollForHWFrame(int x, int y) OVERRIDE; virtual bool DrawSW(jobject java_canvas, const gfx::Rect& clip) OVERRIDE; virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() OVERRIDE; - virtual void EnableOnNewPicture(OnNewPictureMode mode) OVERRIDE; + virtual void EnableOnNewPicture(bool enabled) OVERRIDE; virtual void OnVisibilityChanged( bool view_visible, bool window_visible) OVERRIDE; virtual void OnSizeChanged(int width, int height) OVERRIDE; @@ -72,9 +67,6 @@ class BrowserViewRendererImpl // ViewRendererHost::Client implementation. virtual void OnPictureUpdated(int process_id, int render_view_id) OVERRIDE; - virtual void OnPageScaleFactorChanged(int process_id, - int render_view_id, - float page_scale_factor) OVERRIDE; protected: BrowserViewRendererImpl(BrowserViewRenderer::Client* client, @@ -131,7 +123,7 @@ class BrowserViewRendererImpl float page_scale_; gfx::Size view_size_; gfx::SizeF content_size_css_; - OnNewPictureMode on_new_picture_mode_; + bool new_picture_enabled_; // Used only for detecting Android View System context changes. // Not to be used between draw calls. diff --git a/android_webview/browser/in_process_renderer/in_process_renderer_client.cc b/android_webview/browser/in_process_renderer/in_process_renderer_client.cc index 5f16ae2e88..631a58c972 100644 --- a/android_webview/browser/in_process_renderer/in_process_renderer_client.cc +++ b/android_webview/browser/in_process_renderer/in_process_renderer_client.cc @@ -4,7 +4,7 @@ #include "android_webview/browser/in_process_renderer/in_process_renderer_client.h" -#include "android_webview/browser/browser_view_renderer_impl.h" +#include "android_webview/browser/in_process_renderer/in_process_view_renderer.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" @@ -39,8 +39,8 @@ MessageLoop* InProcessRendererClient::OverrideCompositorMessageLoop() const { void InProcessRendererClient::DidCreateSynchronousCompositor( int render_view_id, content::SynchronousCompositor* compositor) { - BrowserViewRendererImpl* view_renderer = - BrowserViewRendererImpl::FromId(GetInProcessRendererId(), render_view_id); + InProcessViewRenderer* view_renderer = + InProcessViewRenderer::FromId(GetInProcessRendererId(), render_view_id); if (view_renderer) view_renderer->BindSynchronousCompositor(compositor); } diff --git a/android_webview/browser/in_process_renderer/in_process_view_renderer.cc b/android_webview/browser/in_process_renderer/in_process_view_renderer.cc index 63ac223728..538f8f1f42 100644 --- a/android_webview/browser/in_process_renderer/in_process_view_renderer.cc +++ b/android_webview/browser/in_process_renderer/in_process_view_renderer.cc @@ -4,21 +4,78 @@ #include "android_webview/browser/in_process_renderer/in_process_view_renderer.h" +#include "android_webview/public/browser/draw_gl.h" #include "base/logging.h" +#include "content/public/browser/android/content_view_core.h" +#include "content/public/browser/render_view_host.h" +#include "content/public/browser/web_contents.h" #include "content/public/renderer/android/synchronous_compositor.h" +#include "ui/gfx/transform.h" +#include "ui/gl/gl_bindings.h" namespace android_webview { +namespace { +const void* kUserDataKey = &kUserDataKey; + +class UserData : public content::WebContents::Data { + public: + UserData(InProcessViewRenderer* ptr) : instance_(ptr) {} + virtual ~UserData() { + instance_->WebContentsGone(); + } + + static InProcessViewRenderer* GetInstance(content::WebContents* contents) { + if (!contents) + return NULL; + UserData* data = reinterpret_cast<UserData*>( + contents->GetUserData(kUserDataKey)); + return data ? data->instance_ : NULL; + } + + private: + InProcessViewRenderer* instance_; +}; + +} // namespace + InProcessViewRenderer::InProcessViewRenderer( BrowserViewRenderer::Client* client, JavaHelper* java_helper) - : BrowserViewRendererImpl(client, java_helper), - compositor_(NULL) { + : web_contents_(NULL), + compositor_(NULL), + client_(client), + view_visible_(false), + inside_draw_(false), + continuous_invalidate_(false), + width_(0), + height_(0), + attached_to_window_(false), + hardware_initialized_(false), + hardware_failed_(false), + egl_context_at_init_(NULL) { } InProcessViewRenderer::~InProcessViewRenderer() { if (compositor_) compositor_->SetClient(NULL); + SetContents(NULL); +} + +// static +InProcessViewRenderer* InProcessViewRenderer::FromWebContents( + content::WebContents* contents) { + return UserData::GetInstance(contents); +} + +// static +InProcessViewRenderer* InProcessViewRenderer::FromId(int render_process_id, + int render_view_id) { + const content::RenderViewHost* rvh = + content::RenderViewHost::FromID(render_process_id, render_view_id); + if (!rvh) return NULL; + return InProcessViewRenderer::FromWebContents( + content::WebContents::FromRenderViewHost(rvh)); } void InProcessViewRenderer::BindSynchronousCompositor( @@ -27,13 +84,146 @@ void InProcessViewRenderer::BindSynchronousCompositor( if (compositor_) compositor_->SetClient(NULL); compositor_ = compositor; + hardware_initialized_ = false; + hardware_failed_ = false; compositor_->SetClient(this); + + if (attached_to_window_) + client_->RequestProcessMode(); +} + +void InProcessViewRenderer::SetContents( + content::ContentViewCore* content_view_core) { + // First remove association from the prior ContentViewCore / WebContents. + if (web_contents_) { + web_contents_->SetUserData(kUserDataKey, NULL); + DCHECK(!web_contents_); // WebContentsGone should have been called. + } + + if (!content_view_core) + return; + + web_contents_ = content_view_core->GetWebContents(); + web_contents_->SetUserData(kUserDataKey, new UserData(this)); +} + +void InProcessViewRenderer::WebContentsGone() { + web_contents_ = NULL; } bool InProcessViewRenderer::RenderPicture(SkCanvas* canvas) { return compositor_ && compositor_->DemandDrawSw(canvas); } +bool InProcessViewRenderer::PrepareDrawGL(int x, int y) { + // No harm in updating |hw_rendering_scroll_| even if we return false. + hw_rendering_scroll_ = gfx::Point(x, y); + return attached_to_window_ && compositor_ && !hardware_failed_; +} + +void InProcessViewRenderer::DrawGL(AwDrawGLInfo* draw_info) { + DCHECK(view_visible_); + + // We need to watch if the current Android context has changed and enforce + // a clean-up in the compositor. + EGLContext current_context = eglGetCurrentContext(); + if (!current_context) { + LOG(WARNING) << "No current context attached. Skipping composite."; + return; + } + + if (attached_to_window_ && compositor_ && !hardware_initialized_) { + // TODO(boliu): Actually initialize the compositor GL path. + hardware_initialized_ = true; + egl_context_at_init_ = current_context; + } + + if (draw_info->mode == AwDrawGLInfo::kModeProcess) + return; + + if (egl_context_at_init_ != current_context) { + // TODO(boliu): Handle context lost + } + + // TODO(boliu): Make sure this is not called before compositor is initialized + // and GL is ready. Then make this a DCHECK. + if (!compositor_) + return; + + // TODO(boliu): Have a scoped var to unset this. + inside_draw_ = true; + + gfx::Transform transform; + transform.matrix().setColMajorf(draw_info->transform); + transform.Translate(hw_rendering_scroll_.x(), hw_rendering_scroll_.y()); + compositor_->DemandDrawHw( + gfx::Size(draw_info->width, draw_info->height), + transform, + gfx::Rect(draw_info->clip_left, + draw_info->clip_top, + draw_info->clip_right - draw_info->clip_left, + draw_info->clip_bottom - draw_info->clip_top)); + + inside_draw_ = false; + + // The GL functor must ensure these are set to zero before returning. + // Not setting them leads to graphical artifacts that can affect other apps. + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + + // TODO(boliu): Should post task to invalidate. + if (continuous_invalidate_) + Invalidate(); +} + +bool InProcessViewRenderer::DrawSW(jobject java_canvas, + const gfx::Rect& clip) { + return false; +} + +base::android::ScopedJavaLocalRef<jobject> +InProcessViewRenderer::CapturePicture() { + return base::android::ScopedJavaLocalRef<jobject>(); +} + +void InProcessViewRenderer::EnableOnNewPicture(bool enabled) { +} + +void InProcessViewRenderer::OnVisibilityChanged(bool view_visible, + bool window_visible) { + view_visible_ = window_visible && view_visible; +} + +void InProcessViewRenderer::OnSizeChanged(int width, int height) { + width_ = width; + height_ = height; +} + +void InProcessViewRenderer::OnAttachedToWindow(int width, int height) { + attached_to_window_ = true; + width_ = width; + height_ = height; + if (compositor_ && !hardware_initialized_) + client_->RequestProcessMode(); +} + +void InProcessViewRenderer::OnDetachedFromWindow() { + // TODO(joth): Release GL resources. crbug.com/231986. + attached_to_window_ = false; +} + +bool InProcessViewRenderer::IsAttachedToWindow() { + return attached_to_window_; +} + +bool InProcessViewRenderer::IsViewVisible() { + return view_visible_; +} + +gfx::Rect InProcessViewRenderer::GetScreenRect() { + return gfx::Rect(); +} + void InProcessViewRenderer::DidDestroyCompositor( content::SynchronousCompositor* compositor) { // Allow for transient hand-over when two compositors may reference @@ -42,4 +232,19 @@ void InProcessViewRenderer::DidDestroyCompositor( compositor_ = NULL; } +void InProcessViewRenderer::SetContinuousInvalidate(bool invalidate) { + if (continuous_invalidate_ == invalidate) + return; + + continuous_invalidate_ = invalidate; + // TODO(boliu): Handle if not attached to window case. + if (continuous_invalidate_ && !inside_draw_) + Invalidate(); +} + +void InProcessViewRenderer::Invalidate() { + DCHECK(view_visible_); + client_->Invalidate(); +} + } // namespace android_webview diff --git a/android_webview/browser/in_process_renderer/in_process_view_renderer.h b/android_webview/browser/in_process_renderer/in_process_view_renderer.h index d2c0c24d1a..5048875f7c 100644 --- a/android_webview/browser/in_process_renderer/in_process_view_renderer.h +++ b/android_webview/browser/in_process_renderer/in_process_view_renderer.h @@ -11,30 +11,81 @@ namespace content { class SynchronousCompositor; +class WebContents; } namespace android_webview { // Provides RenderViewHost wrapper functionality for sending WebView-specific // IPC messages to the renderer and from there to WebKit. -class InProcessViewRenderer : public BrowserViewRendererImpl, +class InProcessViewRenderer : public BrowserViewRenderer, public content::SynchronousCompositorClient { public: InProcessViewRenderer(BrowserViewRenderer::Client* client, JavaHelper* java_helper); virtual ~InProcessViewRenderer(); + static InProcessViewRenderer* FromWebContents( + content::WebContents* contents); + static InProcessViewRenderer* FromId( + int render_process_id, int render_view_id); + void BindSynchronousCompositor( + content::SynchronousCompositor* compositor); + // BrowserViewRenderer overrides - virtual void BindSynchronousCompositor( - content::SynchronousCompositor* compositor) OVERRIDE; - virtual bool RenderPicture(SkCanvas* canvas) OVERRIDE; + virtual void SetContents( + content::ContentViewCore* content_view_core) OVERRIDE; + virtual bool PrepareDrawGL(int x, int y) OVERRIDE; + virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE; + virtual bool DrawSW(jobject java_canvas, + const gfx::Rect& clip_bounds) OVERRIDE; + virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() OVERRIDE; + virtual void EnableOnNewPicture(bool enabled) OVERRIDE; + virtual void OnVisibilityChanged( + bool view_visible, bool window_visible) OVERRIDE; + virtual void OnSizeChanged(int width, int height) OVERRIDE; + virtual void OnAttachedToWindow(int width, int height) OVERRIDE; + virtual void OnDetachedFromWindow() OVERRIDE; + virtual bool IsAttachedToWindow() OVERRIDE; + virtual bool IsViewVisible() OVERRIDE; + virtual gfx::Rect GetScreenRect() OVERRIDE; // SynchronousCompositorClient overrides - virtual void DidDestroyCompositor( + virtual void DidDestroyCompositor( content::SynchronousCompositor* compositor) OVERRIDE; + virtual void SetContinuousInvalidate(bool invalidate) OVERRIDE; + + void WebContentsGone(); private: + void Invalidate(); + bool RenderPicture(SkCanvas* canvas); + + content::WebContents* web_contents_; content::SynchronousCompositor* compositor_; + BrowserViewRenderer::Client* client_; + + bool view_visible_; + + // Set while inside DrawGL right before vsync so that we do not unnecessarily + // trigger invalidates. + bool inside_draw_; + + // When true, we should continuously invalidate and keep drawing, for example + // to drive animation. + bool continuous_invalidate_; + int width_, height_; // TODO(boliu): Use these? + + bool attached_to_window_; + bool hardware_initialized_; + bool hardware_failed_; + + // Used only for detecting Android View System context changes. + // Not to be used between draw calls. + EGLContext egl_context_at_init_; + + // Last View scroll before hardware rendering is triggered. + gfx::Point hw_rendering_scroll_; DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); }; diff --git a/android_webview/browser/net/aw_url_request_context_getter.cc b/android_webview/browser/net/aw_url_request_context_getter.cc index d4481e820d..e84e2dac91 100644 --- a/android_webview/browser/net/aw_url_request_context_getter.cc +++ b/android_webview/browser/net/aw_url_request_context_getter.cc @@ -53,7 +53,9 @@ void AwURLRequestContextGetter::Init() { net::URLRequestContextBuilder builder; builder.set_user_agent(content::GetUserAgent(GURL())); builder.set_network_delegate(new AwNetworkDelegate()); +#if !defined(DISABLE_FTP_SUPPORT) builder.set_ftp_enabled(false); // Android WebView does not support ftp yet. +#endif builder.set_proxy_config_service(proxy_config_service_.release()); builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader( AwContentBrowserClient::GetAcceptLangsImpl())); diff --git a/android_webview/browser/net/aw_url_request_job_factory.cc b/android_webview/browser/net/aw_url_request_job_factory.cc index 3777a81b7b..2872d013fb 100644 --- a/android_webview/browser/net/aw_url_request_job_factory.cc +++ b/android_webview/browser/net/aw_url_request_job_factory.cc @@ -63,4 +63,8 @@ bool AwURLRequestJobFactory::SetProtocolHandler( return next_factory_->SetProtocolHandler(scheme, protocol_handler); } +bool AwURLRequestJobFactory::IsSafeRedirectTarget(const GURL& location) const { + return next_factory_->IsSafeRedirectTarget(location); +} + } // namespace android_webview diff --git a/android_webview/browser/net/aw_url_request_job_factory.h b/android_webview/browser/net/aw_url_request_job_factory.h index 8978df561c..b4745bd09d 100644 --- a/android_webview/browser/net/aw_url_request_job_factory.h +++ b/android_webview/browser/net/aw_url_request_job_factory.h @@ -35,6 +35,7 @@ class AwURLRequestJobFactory : public net::URLRequestJobFactory { net::NetworkDelegate* network_delegate) const OVERRIDE; virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; virtual bool IsHandledURL(const GURL& url) const OVERRIDE; + virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE; private: // By default calls are forwarded to this factory, to avoid having to diff --git a/android_webview/browser/renderer_host/aw_render_view_host_ext.cc b/android_webview/browser/renderer_host/aw_render_view_host_ext.cc index 09553087a5..7472599e66 100644 --- a/android_webview/browser/renderer_host/aw_render_view_host_ext.cc +++ b/android_webview/browser/renderer_host/aw_render_view_host_ext.cc @@ -6,21 +6,28 @@ #include "android_webview/browser/aw_browser_context.h" #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" +#include "android_webview/common/aw_switches.h" #include "android_webview/common/render_view_messages.h" #include "base/android/scoped_java_ref.h" #include "base/callback.h" +#include "base/command_line.h" #include "base/logging.h" +#include "content/public/browser/android/content_view_core.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/user_metrics.h" #include "content/public/browser/web_contents.h" #include "content/public/common/frame_navigate_params.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositorInputHandler.h" namespace android_webview { -AwRenderViewHostExt::AwRenderViewHostExt(content::WebContents* contents) +AwRenderViewHostExt::AwRenderViewHostExt( + AwRenderViewHostExtClient* client, content::WebContents* contents) : content::WebContentsObserver(contents), + client_(client), has_new_hit_test_data_(false) { + DCHECK(client_); } AwRenderViewHostExt::~AwRenderViewHostExt() {} @@ -105,6 +112,10 @@ bool AwRenderViewHostExt::OnMessageReceived(const IPC::Message& message) { OnDocumentHasImagesResponse) IPC_MESSAGE_HANDLER(AwViewHostMsg_UpdateHitTestData, OnUpdateHitTestData) + IPC_MESSAGE_HANDLER(AwViewHostMsg_DidActivateAcceleratedCompositing, + OnDidActivateAcceleratedCompositing) + IPC_MESSAGE_HANDLER(AwViewHostMsg_PageScaleFactorChanged, + OnPageScaleFactorChanged) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -131,4 +142,29 @@ void AwRenderViewHostExt::OnUpdateHitTestData( has_new_hit_test_data_ = true; } +void AwRenderViewHostExt::OnDidActivateAcceleratedCompositing( + int input_handler_id) { + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kNoMergeUIAndRendererCompositorThreads)) { + return; + } + + // This call is only meaningful and thread-safe when the UI and renderer + // compositor share the same thread. Any other case will likely yield + // terrible, terrible damage. + WebKit::WebCompositorInputHandler* input_handler = + WebKit::WebCompositorInputHandler::fromIdentifier(input_handler_id); + if (!input_handler) + return; + + content::ContentViewCore* content_view_core + = content::ContentViewCore::FromWebContents(web_contents()); + if (content_view_core) + content_view_core->SetInputHandler(input_handler); +} + +void AwRenderViewHostExt::OnPageScaleFactorChanged(float page_scale_factor) { + client_->OnPageScaleFactorChanged(page_scale_factor); +} + } // namespace android_webview diff --git a/android_webview/browser/renderer_host/aw_render_view_host_ext.h b/android_webview/browser/renderer_host/aw_render_view_host_ext.h index df7d1fe521..8894793d57 100644 --- a/android_webview/browser/renderer_host/aw_render_view_host_ext.h +++ b/android_webview/browser/renderer_host/aw_render_view_host_ext.h @@ -20,14 +20,25 @@ struct LoadCommittedDetails; namespace android_webview { +class AwRenderViewHostExtClient { + public: + // Called when the RenderView page scale changes. + virtual void OnPageScaleFactorChanged(float page_scale_factor) = 0; + + protected: + virtual ~AwRenderViewHostExtClient() {} +}; + // Provides RenderViewHost wrapper functionality for sending WebView-specific // IPC messages to the renderer and from there to WebKit. class AwRenderViewHostExt : public content::WebContentsObserver, public base::NonThreadSafe { public: + // To send receive messages to a RenderView we take the WebContents instance, // as it internally handles RenderViewHost instances changing underneath us. - AwRenderViewHostExt(content::WebContents* contents); + AwRenderViewHostExt( + AwRenderViewHostExtClient* client, content::WebContents* contents); virtual ~AwRenderViewHostExt(); // |result| will be invoked with the outcome of the request. @@ -70,10 +81,13 @@ class AwRenderViewHostExt : public content::WebContentsObserver, void OnDocumentHasImagesResponse(int msg_id, bool has_images); void OnUpdateHitTestData(const AwHitTestData& hit_test_data); - void OnPictureUpdated(); + void OnDidActivateAcceleratedCompositing(int input_handler_id); + void OnPageScaleFactorChanged(float page_scale_factor); bool IsRenderViewReady() const; + AwRenderViewHostExtClient* client_; + std::map<int, DocumentHasImagesResult> pending_document_has_images_requests_; // Master copy of hit test data on the browser side. This is updated diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc index 7ec9e847d2..4c73893a56 100644 --- a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc +++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc @@ -305,18 +305,14 @@ void AwResourceDispatcherHostDelegate::OnResponseStarted( if (request_info->GetResourceType() == ResourceType::MAIN_FRAME) { // Check for x-auto-login header. - components::auto_login::HeaderData header_data; - if (components::auto_login::ParserHeaderInResponse( - request, - components::auto_login::ALLOW_ANY_REALM, - &header_data)) { + auto_login_parser::HeaderData header_data; + if (auto_login_parser::ParserHeaderInResponse( + request, auto_login_parser::ALLOW_ANY_REALM, &header_data)) { scoped_ptr<AwContentsIoThreadClient> io_client = - AwContentsIoThreadClient::FromID( - request_info->GetChildID(), - request_info->GetRouteID()); - io_client->NewLoginRequest(header_data.realm, - header_data.account, - header_data.args); + AwContentsIoThreadClient::FromID(request_info->GetChildID(), + request_info->GetRouteID()); + io_client->NewLoginRequest( + header_data.realm, header_data.account, header_data.args); } } } diff --git a/android_webview/browser/renderer_host/view_renderer_host.cc b/android_webview/browser/renderer_host/view_renderer_host.cc index 1a21b04fd9..8dd9314fae 100644 --- a/android_webview/browser/renderer_host/view_renderer_host.cc +++ b/android_webview/browser/renderer_host/view_renderer_host.cc @@ -8,12 +8,9 @@ #include "android_webview/common/aw_switches.h" #include "android_webview/common/render_view_messages.h" #include "android_webview/common/renderer_picture_map.h" -#include "base/command_line.h" -#include "content/public/browser/android/content_view_core.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositorInputHandler.h" namespace android_webview { @@ -45,35 +42,6 @@ void ViewRendererHost::OnPictureUpdated() { routing_id()); } -void ViewRendererHost::OnDidActivateAcceleratedCompositing( - int input_handler_id) { - - if (!CommandLine::ForCurrentProcess()->HasSwitch( - switches::kMergeUIAndRendererCompositorThreads)) { - return; - } - - // This call is only meaningful and thread-safe when the UI and renderer - // compositor share the same thread. Any other case will likely yield - // terrible, terrible damage. - WebKit::WebCompositorInputHandler* input_handler = - WebKit::WebCompositorInputHandler::fromIdentifier(input_handler_id); - if (!input_handler) - return; - - content::ContentViewCore* content_view_core - = content::ContentViewCore::FromWebContents(web_contents()); - if (content_view_core) - content_view_core->SetInputHandler(input_handler); -} - -void ViewRendererHost::OnPageScaleFactorChanged(float page_scale_factor) { - client_->OnPageScaleFactorChanged( - web_contents()->GetRenderProcessHost()->GetID(), - routing_id(), - page_scale_factor); -} - void ViewRendererHost::RenderViewGone(base::TerminationStatus status) { DCHECK(CalledOnValidThread()); RendererPictureMap::GetInstance()->ClearRendererPicture( @@ -85,10 +53,6 @@ bool ViewRendererHost::OnMessageReceived(const IPC::Message& message) { IPC_BEGIN_MESSAGE_MAP(ViewRendererHost, message) IPC_MESSAGE_HANDLER(AwViewHostMsg_PictureUpdated, OnPictureUpdated) - IPC_MESSAGE_HANDLER(AwViewHostMsg_DidActivateAcceleratedCompositing, - OnDidActivateAcceleratedCompositing) - IPC_MESSAGE_HANDLER(AwViewHostMsg_PageScaleFactorChanged, - OnPageScaleFactorChanged) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() diff --git a/android_webview/browser/renderer_host/view_renderer_host.h b/android_webview/browser/renderer_host/view_renderer_host.h index 42b96079e9..9067fc3e7f 100644 --- a/android_webview/browser/renderer_host/view_renderer_host.h +++ b/android_webview/browser/renderer_host/view_renderer_host.h @@ -18,9 +18,6 @@ class ViewRendererHost : public content::WebContentsObserver, class Client { public: virtual void OnPictureUpdated(int process_id, int render_view_id) = 0; - virtual void OnPageScaleFactorChanged(int process_id, - int render_view_id, - float page_scale_factor) = 0; protected: virtual ~Client() {} @@ -45,8 +42,6 @@ class ViewRendererHost : public content::WebContentsObserver, virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; void OnPictureUpdated(); - void OnDidActivateAcceleratedCompositing(int input_handler_id); - void OnPageScaleFactorChanged(float page_scale_factor); bool IsRenderViewReady() const; diff --git a/android_webview/common/aw_switches.cc b/android_webview/common/aw_switches.cc index 2b8a332967..43d8503938 100644 --- a/android_webview/common/aw_switches.cc +++ b/android_webview/common/aw_switches.cc @@ -6,8 +6,8 @@ namespace switches { -const char kMergeUIAndRendererCompositorThreads[] = - "merge-ui-and-compositor-threads"; +const char kNoMergeUIAndRendererCompositorThreads[] = + "no-merge-ui-and-compositor-threads"; const char kUseZeroCopyBuffers[] = "use-zero-copy-buffers"; diff --git a/android_webview/common/aw_switches.h b/android_webview/common/aw_switches.h index a8df1ecdbd..0ac0b2c579 100644 --- a/android_webview/common/aw_switches.h +++ b/android_webview/common/aw_switches.h @@ -7,8 +7,8 @@ namespace switches { -// Merge the Browser UI and the renderer compositor threads. -extern const char kMergeUIAndRendererCompositorThreads[]; +// Do not merge the Browser UI and the renderer compositor threads. +extern const char kNoMergeUIAndRendererCompositorThreads[]; // Uses zero-copy buffers in graphics pipeline. extern const char kUseZeroCopyBuffers[]; diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index 4118f4915d..eb16165d62 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java @@ -21,6 +21,7 @@ import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.ViewTreeObserver; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.inputmethod.EditorInfo; @@ -35,6 +36,7 @@ import org.chromium.base.JNINamespace; import org.chromium.base.ThreadUtils; import org.chromium.content.browser.ContentSettings; import org.chromium.content.browser.ContentVideoView; +import org.chromium.content.browser.ContentViewClient; import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.ContentViewStatics; import org.chromium.content.browser.LoadUrlParams; @@ -115,6 +117,7 @@ public class AwContents { private InterceptNavigationDelegateImpl mInterceptNavigationDelegate; private InternalAccessDelegate mInternalAccessAdapter; private final AwLayoutSizer mLayoutSizer; + private AwZoomControls mZoomControls; // This can be accessed on any thread after construction. See AwContentsIoThreadClient. private final AwSettings mSettings; private boolean mIsPaused; @@ -128,6 +131,12 @@ public class AwContents { private DefaultVideoPosterRequestHandler mDefaultVideoPosterRequestHandler; + private boolean mNewPictureInvalidationOnly; + + private Rect mGlobalVisibleBounds; + private int mLastGlobalVisibleWidth; + private int mLastGlobalVisibleHeight; + private static final class DestroyRunnable implements Runnable { private int mNativeAwContents; private DestroyRunnable(int nativeAwContents) { @@ -283,6 +292,20 @@ public class AwContents { } } + //-------------------------------------------------------------------------------------------- + private class ScrollChangeListener implements ViewTreeObserver.OnScrollChangedListener { + @Override + public void onScrollChanged() { + // We do this to cover the case that when the view hierarchy is scrolled, + // more of the containing view becomes visible (i.e. a containing view + // with a width/height of "wrap_content" and dimensions greater than + // that of the screen). + AwContents.this.updatePhysicalBackingSizeIfNeeded(); + } + }; + + private ScrollChangeListener mScrollChangeListener; + /** * @param browserContext the browsing context to associate this view contents with. * @param containerView the view-hierarchy item this object will be bound to. @@ -299,6 +322,22 @@ public class AwContents { isAccessFromFileURLsGrantedByDefault, new AwLayoutSizer()); } + private static ContentViewCore createAndInitializeContentViewCore(ViewGroup containerView, + InternalAccessDelegate internalDispatcher, int nativeWebContents, + ContentViewCore.PinchGestureStateListener pinchGestureStateListener, + ContentViewClient contentViewClient, + ContentViewCore.ZoomControlsDelegate zoomControlsDelegate) { + ContentViewCore contentViewCore = new ContentViewCore(containerView.getContext()); + // Note INPUT_EVENTS_DELIVERED_IMMEDIATELY is passed to avoid triggering vsync in the + // compositor, not because input events are delivered immediately. + contentViewCore.initialize(containerView, internalDispatcher, nativeWebContents, null, + ContentViewCore.INPUT_EVENTS_DELIVERED_IMMEDIATELY); + contentViewCore.setPinchGestureStateListener(pinchGestureStateListener); + contentViewCore.setContentViewClient(contentViewClient); + contentViewCore.setZoomControlsDelegate(zoomControlsDelegate); + return contentViewCore; + } + /** * @param layoutSizer the AwLayoutSizer instance implementing the sizing policy for the view. * @@ -314,9 +353,6 @@ public class AwContents { mDIPScale = DeviceDisplayInfo.create(containerView.getContext()).getDIPScale(); // Note that ContentViewCore must be set up before AwContents, as ContentViewCore // setup performs process initialisation work needed by AwContents. - mContentViewCore = new ContentViewCore(containerView.getContext(), - ContentViewCore.PERSONALITY_VIEW); - mContentViewCore.setPinchGestureStateListener(new AwPinchGestureStateListener()); mContentsClientBridge = new AwContentsClientBridge(contentsClient); mLayoutSizer = layoutSizer; mLayoutSizer.setDelegate(new AwLayoutSizerDelegate()); @@ -328,12 +364,15 @@ public class AwContents { mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNativeAwContents)); int nativeWebContents = nativeGetWebContents(mNativeAwContents); - mContentViewCore.initialize(containerView, internalAccessAdapter, nativeWebContents, null); - mContentViewCore.setContentViewClient(mContentsClient.getContentViewClient()); + mZoomControls = new AwZoomControls(this); + mContentViewCore = createAndInitializeContentViewCore( + containerView, internalAccessAdapter, nativeWebContents, + new AwPinchGestureStateListener(), mContentsClient.getContentViewClient(), + mZoomControls); mContentsClient.installWebContentsObserver(mContentViewCore); mSettings = new AwSettings(mContentViewCore.getContext(), nativeWebContents, - isAccessFromFileURLsGrantedByDefault); + mContentViewCore, isAccessFromFileURLsGrantedByDefault); setIoThreadClient(new IoThreadClientImpl()); setInterceptNavigationDelegate(new InterceptNavigationDelegateImpl()); @@ -349,6 +388,23 @@ public class AwContents { ContentVideoView.registerContentVideoViewContextDelegate( new AwContentVideoViewDelegate(contentsClient, containerView.getContext())); + mGlobalVisibleBounds = new Rect(); + } + + private void updatePhysicalBackingSizeIfNeeded() { + // We musn't let the physical backing size get too big, otherwise we + // will try to allocate a SurfaceTexture beyond what the GL driver can + // cope with. In most cases, limiting the SurfaceTexture size to that + // of the visible bounds of the WebView will be good enough i.e. the maximum + // SurfaceTexture dimensions will match the screen dimensions). + mContainerView.getGlobalVisibleRect(mGlobalVisibleBounds); + int width = mGlobalVisibleBounds.width(); + int height = mGlobalVisibleBounds.height(); + if (width != mLastGlobalVisibleWidth || height != mLastGlobalVisibleHeight) { + mLastGlobalVisibleWidth = width; + mLastGlobalVisibleHeight = height; + mContentViewCore.onPhysicalBackingSizeChanged(width, height); + } } @VisibleForTesting @@ -401,19 +457,11 @@ public class AwContents { return nativeGetAwDrawGLViewContext(mNativeAwContents); } - // TODO(michaelbai) : Remove this method once it is not called. - public boolean onPrepareDrawGL(Canvas canvas) { - if (mNativeAwContents == 0) return false; - nativeSetScrollForHWFrame(mNativeAwContents, - mContainerView.getScrollX(), mContainerView.getScrollY()); - - // returning false will cause a fallback to SW path. - return true; - } - public void onDraw(Canvas canvas) { if (mNativeAwContents == 0) return; - if (canvas.isHardwareAccelerated() && onPrepareDrawGL(canvas) && + if (canvas.isHardwareAccelerated() && + nativePrepareDrawGL(mNativeAwContents, + mContainerView.getScrollX(), mContainerView.getScrollY()) && mInternalAccessAdapter.requestDrawGL(canvas)) { return; } @@ -448,7 +496,8 @@ public class AwContents { * @param invalidationOnly Flag to call back only on invalidation without providing a picture. */ public void enableOnNewPicture(boolean enabled, boolean invalidationOnly) { - nativeEnableOnNewPicture(mNativeAwContents, enabled, invalidationOnly); + mNewPictureInvalidationOnly = invalidationOnly; + nativeEnableOnNewPicture(mNativeAwContents, enabled); } // This is no longer synchronous and just calls the Async version and return 0. @@ -525,6 +574,10 @@ public class AwContents { params.setTransitionType(PageTransitionTypes.PAGE_TRANSITION_RELOAD); } + // For WebView, always use the user agent override, which is set + // every time the user agent in AwSettings is modified. + params.setOverrideUserAgent(LoadUrlParams.UA_OVERRIDE_TRUE); + mContentViewCore.loadUrl(params); suppressInterceptionForThisNavigation(); @@ -569,15 +622,12 @@ public class AwContents { private void setNewWebContents(int newWebContentsPtr) { // When setting a new WebContents, we new up a ContentViewCore that will // wrap it and then swap it. - ContentViewCore newCore = new ContentViewCore(mContainerView.getContext(), - ContentViewCore.PERSONALITY_VIEW); - newCore.initialize(mContainerView, mInternalAccessAdapter, newWebContentsPtr, null); - newCore.setContentViewClient(mContentsClient.getContentViewClient()); + ContentViewCore newCore = createAndInitializeContentViewCore( + mContainerView, mInternalAccessAdapter, newWebContentsPtr, + new AwPinchGestureStateListener(), mContentsClient.getContentViewClient(), + mZoomControls); mContentsClient.installWebContentsObserver(newCore); - ContentSettings oldSettings = mContentViewCore.getContentSettings(); - newCore.getContentSettings().initFrom(oldSettings); - // Now swap the Java side reference. mContentViewCore.destroy(); mContentViewCore = newCore; @@ -610,6 +660,14 @@ public class AwContents { } } + public boolean isMultiTouchZoomSupported() { + return mSettings.supportsMultiTouchZoom(); + } + + public View getZoomControlsForTest() { + return mZoomControls.getZoomControlsViewForTest(); + } + //-------------------------------------------------------------------------------------------- // WebView[Provider] method implementations (where not provided by ContentViewCore) //-------------------------------------------------------------------------------------------- @@ -1025,6 +1083,11 @@ public class AwContents { * @see android.view.View#onAttachedToWindow() */ public void onAttachedToWindow() { + if (mScrollChangeListener == null) { + mScrollChangeListener = new ScrollChangeListener(); + } + mContainerView.getViewTreeObserver().addOnScrollChangedListener(mScrollChangeListener); + mContentViewCore.onAttachedToWindow(); nativeOnAttachedToWindow(mNativeAwContents, mContainerView.getWidth(), mContainerView.getHeight()); @@ -1039,8 +1102,16 @@ public class AwContents { * @see android.view.View#onDetachedFromWindow() */ public void onDetachedFromWindow() { - if (mNativeAwContents == 0) return; - nativeOnDetachedFromWindow(mNativeAwContents); + if (mNativeAwContents != 0) { + nativeOnDetachedFromWindow(mNativeAwContents); + } + + if (mScrollChangeListener != null) { + mContainerView.getViewTreeObserver().removeOnScrollChangedListener( + mScrollChangeListener); + mScrollChangeListener = null; + } + mContentViewCore.onDetachedFromWindow(); } @@ -1062,8 +1133,7 @@ public class AwContents { */ public void onSizeChanged(int w, int h, int ow, int oh) { if (mNativeAwContents == 0) return; - - mContentViewCore.onPhysicalBackingSizeChanged(w, h); + updatePhysicalBackingSizeIfNeeded(); mContentViewCore.onSizeChanged(w, h, ow, oh); nativeOnSizeChanged(mNativeAwContents, w, h, ow, oh); } @@ -1257,8 +1327,8 @@ public class AwContents { } @CalledByNative - public void onNewPicture(Picture picture) { - mContentsClient.onNewPicture(picture); + public void onNewPicture() { + mContentsClient.onNewPicture(mNewPictureInvalidationOnly ? null : capturePicture()); } // Called as a result of nativeUpdateLastHitTestData. @@ -1273,6 +1343,11 @@ public class AwContents { } @CalledByNative + private void requestProcessMode() { + mInternalAccessAdapter.requestDrawGL(null); + } + + @CalledByNative private void invalidate() { mContainerView.invalidate(); } @@ -1372,7 +1447,7 @@ public class AwContents { private native void nativeAddVisitedLinks(int nativeAwContents, String[] visitedLinks); - private native void nativeSetScrollForHWFrame(int nativeAwContents, int scrollX, int scrollY); + private native boolean nativePrepareDrawGL(int nativeAwContents, int scrollX, int scrollY); private native void nativeFindAllAsync(int nativeAwContents, String searchString); private native void nativeFindNext(int nativeAwContents, boolean forward); private native void nativeClearMatches(int nativeAwContents); @@ -1403,8 +1478,7 @@ public class AwContents { int clipW, int clipH); private native int nativeGetAwDrawGLViewContext(int nativeAwContents); private native Picture nativeCapturePicture(int nativeAwContents); - private native void nativeEnableOnNewPicture(int nativeAwContents, boolean enabled, - boolean invalidationOnly); + private native void nativeEnableOnNewPicture(int nativeAwContents, boolean enabled); private native void nativeInvokeGeolocationCallback( int nativeAwContents, boolean value, String requestingFrame); diff --git a/android_webview/java/src/org/chromium/android_webview/AwFormDatabase.java b/android_webview/java/src/org/chromium/android_webview/AwFormDatabase.java index 368d6583dc..9687a1cb6a 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwFormDatabase.java +++ b/android_webview/java/src/org/chromium/android_webview/AwFormDatabase.java @@ -13,6 +13,10 @@ import org.chromium.base.JNINamespace; @JNINamespace("android_webview") public class AwFormDatabase { + public static boolean hasFormData() { + return nativeHasFormData(); + } + public static void clearFormData() { nativeClearFormData(); } @@ -20,5 +24,7 @@ public class AwFormDatabase { //-------------------------------------------------------------------------------------------- // Native methods //-------------------------------------------------------------------------------------------- + private static native boolean nativeHasFormData(); + private static native void nativeClearFormData(); } diff --git a/android_webview/java/src/org/chromium/android_webview/AwSettings.java b/android_webview/java/src/org/chromium/android_webview/AwSettings.java index 8d1c57c751..2cbaf530cf 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwSettings.java +++ b/android_webview/java/src/org/chromium/android_webview/AwSettings.java @@ -17,6 +17,7 @@ import android.webkit.WebView; import org.chromium.base.CalledByNative; import org.chromium.base.JNINamespace; import org.chromium.base.ThreadUtils; +import org.chromium.content.browser.ContentViewCore; /** * Stores Android WebView specific settings that does not need to be synced to WebKit. @@ -89,6 +90,9 @@ public class AwSettings { private int mCacheMode = WebSettings.LOAD_DEFAULT; private boolean mShouldFocusFirstNode = true; private boolean mGeolocationEnabled = true; + private boolean mSupportZoom = true; + private boolean mBuiltInZoomControls = false; + private boolean mDisplayZoomControls = true; static class LazyDefaultUserAgent{ // Lazy Holder pattern private static final String sInstance = nativeGetDefaultUserAgent(); @@ -104,6 +108,8 @@ public class AwSettings { // The native side of this object. private int mNativeAwSettings = 0; + private ContentViewCore mContentViewCore; + // A flag to avoid sending superfluous synchronization messages. private boolean mIsUpdateWebkitPrefsMessagePending = false; // Custom handler that queues messages to call native code on the UI thread. @@ -126,7 +132,7 @@ public class AwSettings { switch (msg.what) { case UPDATE_WEBKIT_PREFERENCES: synchronized (mAwSettingsLock) { - updateWebkitPreferencesOnUiThread(); + updateWebkitPreferencesOnUiThreadLocked(); mIsUpdateWebkitPrefsMessagePending = false; mAwSettingsLock.notifyAll(); } @@ -140,7 +146,7 @@ public class AwSettings { assert Thread.holdsLock(mAwSettingsLock); if (mNativeAwSettings == 0) return; if (Looper.myLooper() == mHandler.getLooper()) { - updateWebkitPreferencesOnUiThread(); + updateWebkitPreferencesOnUiThreadLocked(); } else { // We're being called on a background thread, so post a message. if (mIsUpdateWebkitPrefsMessagePending) { @@ -159,7 +165,9 @@ public class AwSettings { } } - public AwSettings(Context context, int nativeWebContents, + public AwSettings(Context context, + int nativeWebContents, + ContentViewCore contentViewCore, boolean isAccessFromFileURLsGrantedByDefault) { ThreadUtils.assertOnUiThread(); mContext = context; @@ -167,8 +175,8 @@ public class AwSettings { android.Manifest.permission.INTERNET, Process.myPid(), Process.myUid()) != PackageManager.PERMISSION_GRANTED; - mNativeAwSettings = nativeInit(nativeWebContents); - assert mNativeAwSettings != 0; + mContentViewCore = contentViewCore; + mContentViewCore.updateMultiTouchZoomSupport(supportsMultiTouchZoomLocked()); if (isAccessFromFileURLsGrantedByDefault) { mAllowUniversalAccessFromFileURLs = true; @@ -177,7 +185,11 @@ public class AwSettings { mEventHandler = new EventHandler(); mUserAgent = LazyDefaultUserAgent.sInstance; - nativeUpdateEverything(mNativeAwSettings); + + synchronized (mAwSettingsLock) { + mNativeAwSettings = nativeInit(nativeWebContents); + } + assert mNativeAwSettings != 0; } public void destroy() { @@ -191,9 +203,14 @@ public class AwSettings { } } + @CalledByNative + private double getDIPScaleLocked() { + return mDIPScale; + } + public void setWebContents(int nativeWebContents) { synchronized (mAwSettingsLock) { - nativeSetWebContents(mNativeAwSettings, nativeWebContents); + nativeSetWebContentsLocked(mNativeAwSettings, nativeWebContents); } } @@ -291,11 +308,6 @@ public class AwSettings { } } - @Deprecated - public void setEnableFixedLayoutMode(final boolean enable) { - // No-op. Will be removed. - } - /** * See {@link android.webkit.WebView#setInitialScale}. */ @@ -307,7 +319,7 @@ public class AwSettings { @Override public void run() { if (mNativeAwSettings != 0) { - nativeUpdateInitialPageScale(mNativeAwSettings); + nativeUpdateInitialPageScaleLocked(mNativeAwSettings); } } }); @@ -315,6 +327,11 @@ public class AwSettings { } } + @CalledByNative + private float getInitialPageScalePercentLocked() { + return mInitialPageScalePercent; + } + /** * See {@link android.webkit.WebSettings#setNeedInitialFocus}. */ @@ -368,7 +385,7 @@ public class AwSettings { @Override public void run() { if (mNativeAwSettings != 0) { - nativeUpdateUserAgent(mNativeAwSettings); + nativeUpdateUserAgentLocked(mNativeAwSettings); } } }); @@ -385,6 +402,11 @@ public class AwSettings { } } + @CalledByNative + private String getUserAgentLocked() { + return mUserAgent; + } + /** * See {@link android.webkit.WebSettings#setLoadWithOverviewMode}. */ @@ -414,6 +436,11 @@ public class AwSettings { } } + @CalledByNative + private boolean getLoadWithOverviewModeLocked() { + return mLoadWithOverviewMode; + } + /** * See {@link android.webkit.WebSettings#setTextZoom}. */ @@ -435,6 +462,11 @@ public class AwSettings { } } + @CalledByNative + private int getTextSizePercentLocked() { + return mTextSizePercent; + } + /** * See {@link android.webkit.WebSettings#setStandardFontFamily}. */ @@ -456,6 +488,11 @@ public class AwSettings { } } + @CalledByNative + private String getStandardFontFamilyLocked() { + return mStandardFontFamily; + } + /** * See {@link android.webkit.WebSettings#setFixedFontFamily}. */ @@ -477,6 +514,11 @@ public class AwSettings { } } + @CalledByNative + private String getFixedFontFamilyLocked() { + return mFixedFontFamily; + } + /** * See {@link android.webkit.WebSettings#setSansSerifFontFamily}. */ @@ -498,6 +540,11 @@ public class AwSettings { } } + @CalledByNative + private String getSansSerifFontFamilyLocked() { + return mSansSerifFontFamily; + } + /** * See {@link android.webkit.WebSettings#setSerifFontFamily}. */ @@ -519,6 +566,11 @@ public class AwSettings { } } + @CalledByNative + private String getSerifFontFamilyLocked() { + return mSerifFontFamily; + } + /** * See {@link android.webkit.WebSettings#setCursiveFontFamily}. */ @@ -540,6 +592,11 @@ public class AwSettings { } } + @CalledByNative + private String getCursiveFontFamilyLocked() { + return mCursiveFontFamily; + } + /** * See {@link android.webkit.WebSettings#setFantasyFontFamily}. */ @@ -561,6 +618,11 @@ public class AwSettings { } } + @CalledByNative + private String getFantasyFontFamilyLocked() { + return mFantasyFontFamily; + } + /** * See {@link android.webkit.WebSettings#setMinimumFontSize}. */ @@ -583,6 +645,11 @@ public class AwSettings { } } + @CalledByNative + private int getMinimumFontSizeLocked() { + return mMinimumFontSize; + } + /** * See {@link android.webkit.WebSettings#setMinimumLogicalFontSize}. */ @@ -605,6 +672,11 @@ public class AwSettings { } } + @CalledByNative + private int getMinimumLogicalFontSizeLocked() { + return mMinimumLogicalFontSize; + } + /** * See {@link android.webkit.WebSettings#setDefaultFontSize}. */ @@ -627,6 +699,11 @@ public class AwSettings { } } + @CalledByNative + private int getDefaultFontSizeLocked() { + return mDefaultFontSize; + } + /** * See {@link android.webkit.WebSettings#setDefaultFixedFontSize}. */ @@ -649,6 +726,11 @@ public class AwSettings { } } + @CalledByNative + private int getDefaultFixedFontSizeLocked() { + return mDefaultFixedFontSize; + } + /** * See {@link android.webkit.WebSettings#setJavaScriptEnabled}. */ @@ -706,6 +788,11 @@ public class AwSettings { } } + @CalledByNative + private boolean getLoadsImagesAutomaticallyLocked() { + return mLoadsImagesAutomatically; + } + /** * See {@link android.webkit.WebSettings#setImagesEnabled}. */ @@ -727,6 +814,11 @@ public class AwSettings { } } + @CalledByNative + private boolean getImagesEnabledLocked() { + return mImagesEnabled; + } + /** * See {@link android.webkit.WebSettings#getJavaScriptEnabled}. */ @@ -736,6 +828,11 @@ public class AwSettings { } } + @CalledByNative + private boolean getJavaScriptEnabledLocked() { + return mJavaScriptEnabled; + } + /** * See {@link android.webkit.WebSettings#getAllowUniversalAccessFromFileURLs}. */ @@ -745,6 +842,11 @@ public class AwSettings { } } + @CalledByNative + private boolean getAllowUniversalAccessFromFileURLsLocked() { + return mAllowUniversalAccessFromFileURLs; + } + /** * See {@link android.webkit.WebSettings#getAllowFileAccessFromFileURLs}. */ @@ -754,6 +856,11 @@ public class AwSettings { } } + @CalledByNative + private boolean getAllowFileAccessFromFileURLsLocked() { + return mAllowFileAccessFromFileURLs; + } + /** * See {@link android.webkit.WebSettings#setPluginsEnabled}. */ @@ -790,9 +897,7 @@ public class AwSettings { * @hide */ @CalledByNative - private boolean getPluginsDisabled() { - // This should only be called from UpdateWebkitPreferences, which is called - // either from the constructor, or with mAwSettingsLock being held. + private boolean getPluginsDisabledLocked() { return mPluginState == PluginState.OFF; } @@ -827,6 +932,11 @@ public class AwSettings { } } + @CalledByNative + private boolean getJavaScriptCanOpenWindowsAutomaticallyLocked() { + return mJavaScriptCanOpenWindowsAutomatically; + } + /** * See {@link android.webkit.WebSettings#setLayoutAlgorithm}. */ @@ -855,7 +965,7 @@ public class AwSettings { * @hide */ @CalledByNative - private boolean getTextAutosizingEnabled() { + private boolean getTextAutosizingEnabledLocked() { return mLayoutAlgorithm == LayoutAlgorithm.TEXT_AUTOSIZING; } @@ -880,6 +990,16 @@ public class AwSettings { } } + @CalledByNative + private boolean getSupportMultipleWindowsLocked() { + return mSupportMultipleWindows; + } + + @CalledByNative + private boolean getSupportDeprecatedTargetDensityDPILocked() { + return mSupportDeprecatedTargetDensityDPI; + } + /** * See {@link android.webkit.WebSettings#setUseWideViewPort}. */ @@ -901,6 +1021,11 @@ public class AwSettings { } } + @CalledByNative + private boolean getUseWideViewportLocked() { + return mUseWideViewport; + } + /** * See {@link android.webkit.WebSettings#setAppCacheEnabled}. */ @@ -942,9 +1067,7 @@ public class AwSettings { * @hide */ @CalledByNative - private boolean getAppCacheEnabled() { - // This should only be called from UpdateWebkitPreferences, which is called - // either from the constructor, or with mAwSettingsLock being held. + private boolean getAppCacheEnabledLocked() { if (!mAppCacheEnabled) { return false; } @@ -974,6 +1097,11 @@ public class AwSettings { } } + @CalledByNative + private boolean getDomStorageEnabledLocked() { + return mDomStorageEnabled; + } + /** * See {@link android.webkit.WebSettings#setDatabaseEnabled}. */ @@ -995,6 +1123,11 @@ public class AwSettings { } } + @CalledByNative + private boolean getDatabaseEnabledLocked() { + return mDatabaseEnabled; + } + /** * See {@link android.webkit.WebSettings#setDefaultTextEncodingName}. */ @@ -1016,6 +1149,11 @@ public class AwSettings { } } + @CalledByNative + private String getDefaultTextEncodingLocked() { + return mDefaultTextEncoding; + } + /** * See {@link android.webkit.WebSettings#setMediaPlaybackRequiresUserGesture}. */ @@ -1037,6 +1175,11 @@ public class AwSettings { } } + @CalledByNative + private boolean getMediaPlaybackRequiresUserGestureLocked() { + return mMediaPlaybackRequiresUserGesture; + } + /** * See {@link android.webkit.WebSettings#setDefaultVideoPosterURL}. */ @@ -1059,6 +1202,96 @@ public class AwSettings { } } + @CalledByNative + private String getDefaultVideoPosterURLLocked() { + return mDefaultVideoPosterURL; + } + + private void updateMultiTouchZoomSupport(final boolean supportsMultiTouchZoom) { + ThreadUtils.runOnUiThreadBlocking(new Runnable() { + @Override + public void run() { + mContentViewCore.updateMultiTouchZoomSupport(supportsMultiTouchZoom); + } + }); + } + + /** + * See {@link android.webkit.WebSettings#setSupportZoom}. + */ + public void setSupportZoom(boolean support) { + synchronized (mAwSettingsLock) { + if (mSupportZoom != support) { + mSupportZoom = support; + updateMultiTouchZoomSupport(supportsMultiTouchZoomLocked()); + } + } + } + + /** + * See {@link android.webkit.WebSettings#supportZoom}. + */ + public boolean supportZoom() { + synchronized (mAwSettingsLock) { + return mSupportZoom; + } + } + + /** + * See {@link android.webkit.WebSettings#setBuiltInZoomControls}. + */ + public void setBuiltInZoomControls(boolean enabled) { + synchronized (mAwSettingsLock) { + if (mBuiltInZoomControls != enabled) { + mBuiltInZoomControls = enabled; + updateMultiTouchZoomSupport(supportsMultiTouchZoomLocked()); + } + } + } + + /** + * See {@link android.webkit.WebSettings#getBuiltInZoomControls}. + */ + public boolean getBuiltInZoomControls() { + synchronized (mAwSettingsLock) { + return mBuiltInZoomControls; + } + } + + /** + * See {@link android.webkit.WebSettings#setDisplayZoomControls}. + */ + public void setDisplayZoomControls(boolean enabled) { + synchronized (mAwSettingsLock) { + mDisplayZoomControls = enabled; + } + } + + /** + * See {@link android.webkit.WebSettings#getDisplayZoomControls}. + */ + public boolean getDisplayZoomControls() { + synchronized (mAwSettingsLock) { + return mDisplayZoomControls; + } + } + + private boolean supportsMultiTouchZoomLocked() { + return mSupportZoom && mBuiltInZoomControls; + } + + boolean supportsMultiTouchZoom() { + synchronized (mAwSettingsLock) { + return supportsMultiTouchZoomLocked(); + } + } + + boolean shouldDisplayZoomControls() { + synchronized (mAwSettingsLock) { + return supportsMultiTouchZoomLocked() && mDisplayZoomControls; + } + } + private int clipFontSize(int size) { if (size < MINIMUM_FONT_SIZE) { return MINIMUM_FONT_SIZE; @@ -1068,10 +1301,17 @@ public class AwSettings { return size; } - private void updateWebkitPreferencesOnUiThread() { + @CalledByNative + private void updateEverything() { + synchronized (mAwSettingsLock) { + nativeUpdateEverythingLocked(mNativeAwSettings); + } + } + + private void updateWebkitPreferencesOnUiThreadLocked() { if (mNativeAwSettings != 0) { ThreadUtils.assertOnUiThread(); - nativeUpdateWebkitPreferences(mNativeAwSettings); + nativeUpdateWebkitPreferencesLocked(mNativeAwSettings); } } @@ -1081,15 +1321,15 @@ public class AwSettings { private native void nativeResetScrollAndScaleState(int nativeAwSettings); - private native void nativeSetWebContents(int nativeAwSettings, int nativeWebContents); + private native void nativeSetWebContentsLocked(int nativeAwSettings, int nativeWebContents); - private native void nativeUpdateEverything(int nativeAwSettings); + private native void nativeUpdateEverythingLocked(int nativeAwSettings); - private native void nativeUpdateInitialPageScale(int nativeAwSettings); + private native void nativeUpdateInitialPageScaleLocked(int nativeAwSettings); - private native void nativeUpdateUserAgent(int nativeAwSettings); + private native void nativeUpdateUserAgentLocked(int nativeAwSettings); - private native void nativeUpdateWebkitPreferences(int nativeAwSettings); + private native void nativeUpdateWebkitPreferencesLocked(int nativeAwSettings); private static native String nativeGetDefaultUserAgent(); } diff --git a/android_webview/java/src/org/chromium/android_webview/AwZoomControls.java b/android_webview/java/src/org/chromium/android_webview/AwZoomControls.java new file mode 100644 index 0000000000..0bcae18421 --- /dev/null +++ b/android_webview/java/src/org/chromium/android_webview/AwZoomControls.java @@ -0,0 +1,102 @@ +// Copyright (c) 2013 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. + +package org.chromium.android_webview; + +import android.view.Gravity; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; +import android.widget.ZoomButtonsController; +import org.chromium.content.browser.ContentViewCore.ZoomControlsDelegate; + +class AwZoomControls implements ZoomControlsDelegate { + + private AwContents mAwContents; + // It is advised to use getZoomController() where possible. + private ZoomButtonsController mZoomButtonsController; + + AwZoomControls(AwContents awContents) { + mAwContents = awContents; + } + + @Override + public void invokeZoomPicker() { + ZoomButtonsController zoomController = getZoomController(); + if (zoomController != null) { + zoomController.setVisible(true); + } + } + + @Override + public void dismissZoomPicker() { + ZoomButtonsController zoomController = getZoomController(); + if (zoomController != null) { + zoomController.setVisible(false); + } + } + + @Override + public void updateZoomControls() { + ZoomButtonsController zoomController = getZoomController(); + if (zoomController == null) { + return; + } + boolean canZoomIn = mAwContents.canZoomIn(); + boolean canZoomOut = mAwContents.canZoomOut(); + if (!canZoomIn && !canZoomOut) { + // Hide the zoom in and out buttons if the page cannot zoom + zoomController.getZoomControls().setVisibility(View.GONE); + } else { + // Set each one individually, as a page may be able to zoom in or out + zoomController.setZoomInEnabled(canZoomIn); + zoomController.setZoomOutEnabled(canZoomOut); + } + } + + // This method is used in tests. It doesn't modify the state of zoom controls. + View getZoomControlsViewForTest() { + return mZoomButtonsController != null ? mZoomButtonsController.getZoomControls() : null; + } + + private ZoomButtonsController getZoomController() { + if (mZoomButtonsController == null && + mAwContents.getSettings().shouldDisplayZoomControls()) { + mZoomButtonsController = new ZoomButtonsController( + mAwContents.getContentViewCore().getContainerView()); + mZoomButtonsController.setOnZoomListener(new ZoomListener()); + // ZoomButtonsController positions the buttons at the bottom, but in + // the middle. Change their layout parameters so they appear on the + // right. + View controls = mZoomButtonsController.getZoomControls(); + ViewGroup.LayoutParams params = controls.getLayoutParams(); + if (params instanceof FrameLayout.LayoutParams) { + ((FrameLayout.LayoutParams) params).gravity = Gravity.RIGHT; + } + } + return mZoomButtonsController; + } + + private class ZoomListener implements ZoomButtonsController.OnZoomListener { + @Override + public void onVisibilityChanged(boolean visible) { + if (visible) { + // Bring back the hidden zoom controls. + mZoomButtonsController.getZoomControls().setVisibility(View.VISIBLE); + updateZoomControls(); + } + } + + @Override + public void onZoom(boolean zoomIn) { + if (zoomIn) { + mAwContents.zoomIn(); + } else { + mAwContents.zoomOut(); + } + // ContentView will call updateZoomControls after its current page scale + // is got updated from the native code. + } + } +} diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java index 72e62a60a8..d71689afd8 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java @@ -15,6 +15,7 @@ import org.chromium.android_webview.AwContents; import org.chromium.android_webview.AwContentsClient; import org.chromium.android_webview.AwLayoutSizer; import org.chromium.android_webview.test.util.CommonResources; +import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.test.util.CallbackHelper; @@ -124,9 +125,12 @@ public class AndroidViewIntegrationTest extends AwTestBase { * view (since the user can't see it anyway) and only do so after the view's size is non-zero. * Such behavior is unacceptable for the WebView and this test is to ensure that such behavior * is not re-introduced. + * + * @SmallTest + * @Feature({"AndroidWebView"}) + * crbug.com/239439 */ - @SmallTest - @Feature({"AndroidWebView"}) + @DisabledTest public void testZeroByZeroViewLoadsContent() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = createCustomTestContainerViewOnMainSync( @@ -146,9 +150,12 @@ public class AndroidViewIntegrationTest extends AwTestBase { * * This makes sure that any optimizations related to the view's visibility don't inhibit * the ability to load pages. Many applications keep the WebView hidden when it's loading. + * + * @SmallTest + * @Feature({"AndroidWebView"}) + * crbug.com/239439 */ - @SmallTest - @Feature({"AndroidWebView"}) + @DisabledTest public void testInvisibleViewLoadsContent() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = createCustomTestContainerViewOnMainSync( diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java index bc632c5a86..b1f6ddd50e 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java @@ -8,6 +8,7 @@ import android.test.suitebuilder.annotation.SmallTest; import android.view.KeyEvent; import org.chromium.android_webview.test.util.VideoTestWebServer; +import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.content.browser.test.util.TouchCommon; @@ -16,8 +17,13 @@ import org.chromium.content.browser.test.util.TouchCommon; */ public class AwContentsClientFullScreenVideoTest extends AwTestBase { - @Feature({"AndroidWebView"}) - @SmallTest + /** + * @Feature({"AndroidWebView"}) + * @SmallTest + * + * http://crbug.com/238735 + */ + @DisabledTest public void testOnShowAndHideCustomView() throws Throwable { FullScreenVideoTestAwContentsClient contentsClient = new FullScreenVideoTestAwContentsClient(getActivity()); diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java index fe02c3944f..e0a1ead287 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java @@ -9,6 +9,7 @@ import android.view.View; import org.chromium.android_webview.AwContents; import org.chromium.android_webview.test.util.VideoTestWebServer; +import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.content.browser.test.util.CallbackHelper; import org.chromium.content.browser.test.util.TouchCommon; @@ -45,8 +46,13 @@ public class AwContentsClientGetVideoLoadingProgressViewTest extends AwTestBase } - @Feature({"AndroidWebView"}) - @SmallTest + /** + * @Feature({"AndroidWebView"}) + * @SmallTest + * + * http://crbug.com/238735 + */ + @DisabledTest public void testGetVideoLoadingProgressView() throws Throwable { TestAwContentsClient contentsClient = new FullScreenVideoTestAwContentsClient(getActivity()) { diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java index f912e188b2..2adaed8291 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java @@ -10,6 +10,7 @@ import android.test.suitebuilder.annotation.SmallTest; import org.apache.http.util.EncodingUtils; import org.chromium.android_webview.AwContents; +import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.test.util.TestCallbackHelperContainer; @@ -80,8 +81,11 @@ public class AwContentsClientOnFormResubmissionTest extends AwTestBase { super.tearDown(); } +/* @SmallTest @Feature({"AndroidWebView", "Navigation"}) +*/ + @DisabledTest public void testResend() throws Throwable { mContentsClient.setResubmit(true); doReload(); diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java index e3fc616639..22da117553 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java @@ -2354,8 +2354,12 @@ public class AwSettingsTest extends AwTestBase { assertEquals(viewportTagSpecifiedWidth, getTitleOnUiThread(awContents)); } + /* @MediumTest @Feature({"AndroidWebView", "Preferences"}) + http://crbug.com/239144 + */ + @DisabledTest public void testUseWideViewportControlsDoubleTabToZoom() throws Throwable { final TestAwContentsClient contentClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = @@ -2382,8 +2386,12 @@ public class AwSettingsTest extends AwTestBase { zoomedOutScale < initialScale); } + /* @SmallTest @Feature({"AndroidWebView", "Preferences"}) + http://crbug.com/239144 + */ + @DisabledTest public void testLoadWithOverviewModeWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( @@ -2393,8 +2401,12 @@ public class AwSettingsTest extends AwTestBase { views.getContents1(), views.getClient1(), false)); } - @SmallTest - @Feature({"AndroidWebView", "Preferences"}) + /* + @SmallTest + @Feature({"AndroidWebView", "Preferences"}) + http://crbug.com/239144 + */ + @DisabledTest public void testLoadWithOverviewModeViewportTagWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ContentViewZoomTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java index c50d6f5004..de51566343 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ContentViewZoomTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwZoomTest.java @@ -13,9 +13,8 @@ import android.view.ViewConfiguration; import org.chromium.android_webview.AwContents; import org.chromium.android_webview.AwSettings; import org.chromium.base.ThreadUtils; +import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; -import org.chromium.content.browser.ContentSettings; -import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.test.util.Criteria; import org.chromium.content.browser.test.util.CriteriaHelper; @@ -24,13 +23,12 @@ import java.util.concurrent.Callable; /** * A test suite for zooming-related methods and settings. */ -public class ContentViewZoomTest extends AwTestBase { +public class AwZoomTest extends AwTestBase { private static final long TEST_TIMEOUT_MS = 20000L; private static final int CHECK_INTERVAL_MS = 100; private TestAwContentsClient mContentsClient; private AwContents mAwContents; - private ContentViewCore mContentViewCore; @Override public void setUp() throws Exception { @@ -39,7 +37,6 @@ public class ContentViewZoomTest extends AwTestBase { final AwTestContainerView testContainerView = createAwTestContainerViewOnMainSync(mContentsClient); mAwContents = testContainerView.getAwContents(); - mContentViewCore = testContainerView.getContentViewCore(); } private String getZoomableHtml() { @@ -62,7 +59,7 @@ public class ContentViewZoomTest extends AwTestBase { return runTestOnUiThreadAndGetResult(new Callable<Boolean>() { @Override public Boolean call() throws Exception { - return mContentViewCore.isMultiTouchZoomSupported(); + return mAwContents.isMultiTouchZoomSupported(); } }); } @@ -80,7 +77,7 @@ public class ContentViewZoomTest extends AwTestBase { return runTestOnUiThreadAndGetResult(new Callable<Boolean>() { @Override public Boolean call() throws Exception { - return mContentViewCore.canZoomIn(); + return mAwContents.canZoomIn(); } }); } @@ -89,7 +86,7 @@ public class ContentViewZoomTest extends AwTestBase { return runTestOnUiThreadAndGetResult(new Callable<Boolean>() { @Override public Boolean call() throws Exception { - return mContentViewCore.canZoomOut(); + return mAwContents.canZoomOut(); } }); } @@ -98,7 +95,7 @@ public class ContentViewZoomTest extends AwTestBase { return runTestOnUiThreadAndGetResult(new Callable<Float>() { @Override public Float call() throws Exception { - return mContentViewCore.getScale(); + return mAwContents.getScale(); } }); } @@ -107,7 +104,7 @@ public class ContentViewZoomTest extends AwTestBase { return runTestOnUiThreadAndGetResult(new Callable<View>() { @Override public View call() throws Exception { - return mContentViewCore.getZoomControlsForTest(); + return mAwContents.getZoomControlsForTest(); } }); } @@ -116,7 +113,7 @@ public class ContentViewZoomTest extends AwTestBase { ThreadUtils.runOnUiThreadBlocking(new Runnable() { @Override public void run() { - mContentViewCore.invokeZoomPicker(); + mAwContents.invokeZoomPicker(); } }); } @@ -126,7 +123,7 @@ public class ContentViewZoomTest extends AwTestBase { if (!runTestOnUiThreadAndGetResult(new Callable<Boolean>() { @Override public Boolean call() throws Exception { - return mContentViewCore.zoomIn(); + return mAwContents.zoomIn(); } })) return false; @@ -139,7 +136,7 @@ public class ContentViewZoomTest extends AwTestBase { if (!runTestOnUiThreadAndGetResult(new Callable<Boolean>() { @Override public Boolean call() throws Exception { - return mContentViewCore.zoomOut(); + return mAwContents.zoomOut(); } })) return false; @@ -182,7 +179,7 @@ public class ContentViewZoomTest extends AwTestBase { loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), getZoomableHtml(), "text/html", false); mContentsClient.getOnScaleChangedHelper().waitForCallback(onScaleChangedCallCount); - getContentSettingsOnUiThread(mAwContents).setSupportZoom(supportZoom); + getAwSettingsOnUiThread(mAwContents).setSupportZoom(supportZoom); assertTrue("Should be able to zoom in", canZoomInOnUiThread()); assertFalse("Should not be able to zoom out", canZoomOutOnUiThread()); @@ -197,16 +194,24 @@ public class ContentViewZoomTest extends AwTestBase { assertTrue("Should be able to zoom in", canZoomInOnUiThread()); } + /* @SmallTest @Feature({"AndroidWebView"}) + http://crbug.com/239144 + */ + @DisabledTest public void testMagnification() throws Throwable { runMagnificationTest(true); } // According to Android CTS test, zoomIn/Out must work // even if supportZoom is turned off. + /* @SmallTest @Feature({"AndroidWebView"}) + http://crbug.com/239144 + */ + @DisabledTest public void testMagnificationWithZoomSupportOff() throws Throwable { runMagnificationTest(false); } @@ -218,19 +223,23 @@ public class ContentViewZoomTest extends AwTestBase { loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), getZoomableHtml(), "text/html", false); - assertTrue(getContentSettingsOnUiThread(mAwContents).supportZoom()); - assertFalse(getContentSettingsOnUiThread(mAwContents).getBuiltInZoomControls()); + assertTrue(webSettings.supportZoom()); + assertFalse(webSettings.getBuiltInZoomControls()); assertFalse(isMultiTouchZoomSupportedOnUiThread()); - getContentSettingsOnUiThread(mAwContents).setBuiltInZoomControls(true); + webSettings.setBuiltInZoomControls(true); assertTrue(isMultiTouchZoomSupportedOnUiThread()); - getContentSettingsOnUiThread(mAwContents).setSupportZoom(false); + webSettings.setSupportZoom(false); assertFalse(isMultiTouchZoomSupportedOnUiThread()); } + /* @SmallTest @Feature({"AndroidWebView"}) + http://crbug.com/239144 + */ + @DisabledTest public void testZoomControls() throws Throwable { AwSettings webSettings = getAwSettingsOnUiThread(mAwContents); int onScaleChangedCallCount = mContentsClient.getOnScaleChangedHelper().getCallCount(); @@ -240,9 +249,9 @@ public class ContentViewZoomTest extends AwTestBase { // It must be possible to zoom in (or zoom out) for zoom controls to be shown assertTrue("Should be able to zoom in", canZoomInOnUiThread()); - assertTrue(getContentSettingsOnUiThread(mAwContents).supportZoom()); - getContentSettingsOnUiThread(mAwContents).setBuiltInZoomControls(true); - getContentSettingsOnUiThread(mAwContents).setDisplayZoomControls(false); + assertTrue(webSettings.supportZoom()); + webSettings.setBuiltInZoomControls(true); + webSettings.setDisplayZoomControls(false); // With DisplayZoomControls set to false, attempts to display zoom // controls must be ignored. @@ -250,7 +259,7 @@ public class ContentViewZoomTest extends AwTestBase { invokeZoomPickerOnUiThread(); assertNull(getZoomControlsOnUiThread()); - getContentSettingsOnUiThread(mAwContents).setDisplayZoomControls(true); + webSettings.setDisplayZoomControls(true); assertNull(getZoomControlsOnUiThread()); invokeZoomPickerOnUiThread(); View zoomControls = getZoomControlsOnUiThread(); @@ -267,9 +276,9 @@ public class ContentViewZoomTest extends AwTestBase { // ContentView must update itself according to the viewport setup. waitUntilCanNotZoom(); - assertTrue(getContentSettingsOnUiThread(mAwContents).supportZoom()); - getContentSettingsOnUiThread(mAwContents).setBuiltInZoomControls(true); - getContentSettingsOnUiThread(mAwContents).setDisplayZoomControls(true); + assertTrue(webSettings.supportZoom()); + webSettings.setBuiltInZoomControls(true); + webSettings.setDisplayZoomControls(true); assertNull(getZoomControlsOnUiThread()); invokeZoomPickerOnUiThread(); View zoomControls = getZoomControlsOnUiThread(); @@ -283,9 +292,9 @@ public class ContentViewZoomTest extends AwTestBase { loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), getZoomableHtml(), "text/html", false); - assertTrue(getContentSettingsOnUiThread(mAwContents).supportZoom()); - getContentSettingsOnUiThread(mAwContents).setBuiltInZoomControls(true); - getContentSettingsOnUiThread(mAwContents).setDisplayZoomControls(true); + assertTrue(webSettings.supportZoom()); + webSettings.setBuiltInZoomControls(true); + webSettings.setDisplayZoomControls(true); invokeZoomPickerOnUiThread(); // Now force an orientation change, and try to display the zoom picker diff --git a/android_webview/lib/DEPS b/android_webview/lib/DEPS index b0da14fa50..8460d68679 100644 --- a/android_webview/lib/DEPS +++ b/android_webview/lib/DEPS @@ -1,5 +1,5 @@ include_rules = [ - "+cc/switches.h", + "+cc/base/switches.h", "+components", # For jni registers. "+content/public", ] diff --git a/android_webview/lib/main/aw_main_delegate.cc b/android_webview/lib/main/aw_main_delegate.cc index aba8ae3976..fae9f35fd0 100644 --- a/android_webview/lib/main/aw_main_delegate.cc +++ b/android_webview/lib/main/aw_main_delegate.cc @@ -6,6 +6,7 @@ #include "android_webview/browser/aw_content_browser_client.h" #include "android_webview/browser/in_process_renderer/in_process_renderer_client.h" +#include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" #include "android_webview/common/aw_switches.h" #include "android_webview/lib/aw_browser_dependency_factory_impl.h" #include "android_webview/native/aw_geolocation_permission_context.h" @@ -13,8 +14,10 @@ #include "android_webview/native/aw_web_contents_view_delegate.h" #include "android_webview/renderer/aw_content_renderer_client.h" #include "base/command_line.h" +#include "base/lazy_instance.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" +#include "base/threading/thread_restrictions.h" #include "content/public/browser/browser_main_runner.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" @@ -22,6 +25,23 @@ namespace android_webview { +namespace { + +// TODO(boliu): Remove these global Allows once the underlying issues +// are resolved. See AwMainDelegate::RunProcess below. + +base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> > + g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER; + +base::LazyInstance<scoped_ptr<base::ThreadRestrictions::ScopedAllowIO> > + g_allow_io_in_ui_thread = LAZY_INSTANCE_INITIALIZER; + +bool UIAndRendererCompositorThreadsNotMerged() { + return CommandLine::ForCurrentProcess()->HasSwitch( + switches::kNoMergeUIAndRendererCompositorThreads); +} +} + AwMainDelegate::AwMainDelegate() { } @@ -35,13 +55,19 @@ bool AwMainDelegate::BasicStartupComplete(int* exit_code) { ::EnableVirtualizedContext(); CommandLine* cl = CommandLine::ForCurrentProcess(); - // Set the command line to enable synchronous API compatibility. - if (cl->HasSwitch(switches::kMergeUIAndRendererCompositorThreads)) { - cl->AppendSwitch(switches::kEnableSynchronousRendererCompositor); - } else { + + // Temporarily disable merged thread mode until proper hardware init is done. + // Currently hardware draw with incomplete init is making invalid GL calls + // that is crashing in graphics driver on Nexus 7. + if (!cl->HasSwitch("merge-ui-and-compositor-threads")) + cl->AppendSwitch(switches::kNoMergeUIAndRendererCompositorThreads); + + if (UIAndRendererCompositorThreadsNotMerged()) { cl->AppendSwitch(switches::kEnableWebViewSynchronousAPIs); + } else { + // Set the command line to enable synchronous API compatibility. + cl->AppendSwitch(switches::kEnableSynchronousRendererCompositor); } - return false; } @@ -64,6 +90,18 @@ int AwMainDelegate::RunProcess( int exit_code = browser_runner_->Initialize(main_function_params); DCHECK(exit_code < 0); + if (!UIAndRendererCompositorThreadsNotMerged()) { + // This is temporary until we remove the browser compositor + g_allow_wait_in_ui_thread.Get().reset( + new ScopedAllowWaitForLegacyWebViewApi); + + // TODO(boliu): This is a HUGE hack to work around the fact that + // cc::WorkerPool joins on worker threads on the UI thread. + // See crbug.com/239423. + g_allow_io_in_ui_thread.Get().reset( + new base::ThreadRestrictions::ScopedAllowIO); + } + // Return 0 so that we do NOT trigger the default behavior. On Android, the // UI message loop is managed by the Java application. return 0; @@ -90,12 +128,10 @@ content::ContentRendererClient* DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)); // During transition period allow running in either threading mode; eventually // only the compositor/UI thread merge mode will be supported. - const bool merge_threads = - CommandLine::ForCurrentProcess()->HasSwitch( - switches::kMergeUIAndRendererCompositorThreads); + const bool no_merge_threads = UIAndRendererCompositorThreadsNotMerged(); content_renderer_client_.reset( - merge_threads ? new InProcessRendererClient() : - new AwContentRendererClient()); + no_merge_threads ? new AwContentRendererClient() : + new InProcessRendererClient()); return content_renderer_client_.get(); } diff --git a/android_webview/libwebviewchromium.target.darwin-arm.mk b/android_webview/libwebviewchromium.target.darwin-arm.mk index 5827a03a1c..31949016d4 100644 --- a/android_webview/libwebviewchromium.target.darwin-arm.mk +++ b/android_webview/libwebviewchromium.target.darwin-arm.mk @@ -15,7 +15,8 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,STATIC_LIBRARIES,android_webview_native_webview_native_gyp)/android_webview_native_webview_native_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_base_static_gyp)/base_base_static_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_third_party_dynamic_annotations_dynamic_annotations_gyp)/base_third_party_dynamic_annotations_dynamic_annotations_gyp.a \ - $(call intermediates-dir-for,STATIC_LIBRARIES,components_web_contents_delegate_android_gyp)/components_web_contents_delegate_android_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_autofill_browser_gyp)/components_autofill_browser_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_autofill_common_gyp)/components_autofill_common_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_base_gyp)/base_base_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_allocator_allocator_extension_thunks_gyp)/base_allocator_allocator_extension_thunks_gyp.a \ $(call intermediates-dir-for,GYP,testing_gtest_prod_gyp)/gtest_prod.stamp \ @@ -24,13 +25,12 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_symbolize_gyp)/base_symbolize_gyp.a \ $(call intermediates-dir-for,GYP,third_party_ashmem_ashmem_gyp)/ashmem.stamp \ $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_libevent_libevent_gyp)/third_party_libevent_libevent_gyp.a \ - $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_browser_gyp)/content_content_browser_gyp.a \ - $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_common_gyp)/content_content_common_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,build_temp_gyp_googleurl_gyp)/build_temp_gyp_googleurl_gyp.a \ $(call intermediates-dir-for,GYP,third_party_icu_icudata_gyp)/icudata.stamp \ $(call intermediates-dir-for,GYP,third_party_icu_system_icu_gyp)/system_icu.stamp \ $(call intermediates-dir-for,GYP,third_party_icu_icui18n_gyp)/icui18n.stamp \ $(call intermediates-dir-for,GYP,third_party_icu_icuuc_gyp)/icuuc.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_common_gyp)/content_content_common_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,components_tracing_gyp)/components_tracing_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,ipc_ipc_gyp)/ipc_ipc_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,media_media_gyp)/media_media_gyp.a \ @@ -104,10 +104,11 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_inspector_protocol_sources_gyp)/inspector_protocol_sources.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_generate_inspector_protocol_version_gyp)/generate_inspector_protocol_version.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_make_derived_sources_gyp)/make_derived_sources.stamp \ - $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_generate_settings_gyp)/generate_settings.stamp \ + $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_generate_test_support_idls_gyp)/generate_test_support_idls.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_bindings_bindings_derived_sources_gyp)/bindings_derived_sources.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_bindings_supplemental_dependencies_gyp)/supplemental_dependencies.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_config_gyp)/config.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_origin_origin_gyp)/third_party_WebKit_Source_origin_origin_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_c_lib_gyp)/gpu_gles2_c_lib_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_implementation_gyp)/gpu_gles2_implementation_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_iccjpeg_iccjpeg_gyp)/third_party_iccjpeg_iccjpeg_gyp.a \ @@ -161,6 +162,12 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,GYP,content_content_jni_headers_gyp)/content_jni_headers.stamp \ $(call intermediates-dir-for,GYP,content_java_set_jni_headers_gyp)/java_set_jni_headers.stamp \ $(call intermediates-dir-for,GYP,content_common_aidl_gyp)/common_aidl.stamp \ + $(call intermediates-dir-for,GYP,components_autofill_jni_headers_gyp)/autofill_jni_headers.stamp \ + $(call intermediates-dir-for,GYP,components_autofill_regexes_gyp)/autofill_regexes.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_autofill_risk_proto_gyp)/components_autofill_risk_proto_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_encryptor_gyp)/components_encryptor_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_webdata_common_gyp)/components_webdata_common_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_browser_gyp)/content_content_browser_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,content_browser_speech_proto_speech_proto_gyp)/content_browser_speech_proto_speech_proto_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,google_apis_google_apis_gyp)/google_apis_google_apis_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_zlib_zip_gyp)/third_party_zlib_zip_gyp.a \ @@ -196,6 +203,8 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,STATIC_LIBRARIES,sandbox_sandbox_services_gyp)/sandbox_sandbox_services_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,sandbox_seccomp_bpf_gyp)/sandbox_seccomp_bpf_gyp.a \ $(call intermediates-dir-for,GYP,sandbox_sandbox_services_headers_gyp)/sandbox_services_headers.stamp \ + $(call intermediates-dir-for,GYP,chrome_chrome_strings_gyp)/chrome_strings.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_web_contents_delegate_android_gyp)/components_web_contents_delegate_android_gyp.a \ $(call intermediates-dir-for,GYP,components_web_contents_delegate_android_jni_headers_gyp)/web_contents_delegate_android_jni_headers.stamp \ $(call intermediates-dir-for,GYP,android_webview_native_android_webview_native_jni_gyp)/android_webview_native_jni.stamp \ $(call intermediates-dir-for,GYP,android_webview_native_android_jar_jni_headers_gyp)/android_jar_jni_headers.stamp \ @@ -339,15 +348,15 @@ LOCAL_STATIC_LIBRARIES := \ android_webview_native_webview_native_gyp \ base_base_static_gyp \ base_third_party_dynamic_annotations_dynamic_annotations_gyp \ - components_web_contents_delegate_android_gyp \ + components_autofill_browser_gyp \ + components_autofill_common_gyp \ base_base_gyp \ base_allocator_allocator_extension_thunks_gyp \ third_party_modp_b64_modp_b64_gyp \ base_symbolize_gyp \ third_party_libevent_libevent_gyp \ - content_content_browser_gyp \ - content_content_common_gyp \ build_temp_gyp_googleurl_gyp \ + content_content_common_gyp \ components_tracing_gyp \ ipc_ipc_gyp \ media_media_gyp \ @@ -388,6 +397,7 @@ LOCAL_STATIC_LIBRARIES := \ third_party_WebKit_Source_WebKit_chromium_webkit_gyp \ third_party_WebKit_Source_wtf_wtf_gyp \ third_party_WebKit_Source_core_core_gyp_webcore_dom_gyp \ + third_party_WebKit_Source_origin_origin_gyp \ gpu_gles2_c_lib_gyp \ gpu_gles2_implementation_gyp \ third_party_iccjpeg_iccjpeg_gyp \ @@ -428,6 +438,10 @@ LOCAL_STATIC_LIBRARIES := \ webkit_support_webkit_media_gyp \ webkit_support_webkit_storage_gyp \ sql_sql_gyp \ + components_autofill_risk_proto_gyp \ + components_encryptor_gyp \ + components_webdata_common_gyp \ + content_content_browser_gyp \ content_browser_speech_proto_speech_proto_gyp \ google_apis_google_apis_gyp \ third_party_zlib_zip_gyp \ @@ -443,6 +457,7 @@ LOCAL_STATIC_LIBRARIES := \ net_http_server_gyp \ sandbox_sandbox_services_gyp \ sandbox_seccomp_bpf_gyp \ + components_web_contents_delegate_android_gyp \ components_auto_login_parser_gyp \ components_navigation_interception_gyp \ components_visitedlink_browser_gyp \ @@ -460,12 +475,12 @@ LOCAL_GROUP_STATIC_LIBRARIES := true LOCAL_SHARED_LIBRARIES := \ libcutils \ liblog \ - libjnigraphics \ - libandroid \ libicui18n \ libicuuc \ + libandroid \ libOpenSLES \ libexpat \ + libjnigraphics \ libjpeg \ libstlport \ libdl diff --git a/android_webview/libwebviewchromium.target.darwin-x86.mk b/android_webview/libwebviewchromium.target.darwin-x86.mk index d4bb4257dc..84897ac1ff 100644 --- a/android_webview/libwebviewchromium.target.darwin-x86.mk +++ b/android_webview/libwebviewchromium.target.darwin-x86.mk @@ -15,7 +15,8 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,STATIC_LIBRARIES,android_webview_native_webview_native_gyp)/android_webview_native_webview_native_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_base_static_gyp)/base_base_static_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_third_party_dynamic_annotations_dynamic_annotations_gyp)/base_third_party_dynamic_annotations_dynamic_annotations_gyp.a \ - $(call intermediates-dir-for,STATIC_LIBRARIES,components_web_contents_delegate_android_gyp)/components_web_contents_delegate_android_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_autofill_browser_gyp)/components_autofill_browser_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_autofill_common_gyp)/components_autofill_common_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_base_gyp)/base_base_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_allocator_allocator_extension_thunks_gyp)/base_allocator_allocator_extension_thunks_gyp.a \ $(call intermediates-dir-for,GYP,testing_gtest_prod_gyp)/gtest_prod.stamp \ @@ -24,13 +25,12 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_symbolize_gyp)/base_symbolize_gyp.a \ $(call intermediates-dir-for,GYP,third_party_ashmem_ashmem_gyp)/ashmem.stamp \ $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_libevent_libevent_gyp)/third_party_libevent_libevent_gyp.a \ - $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_browser_gyp)/content_content_browser_gyp.a \ - $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_common_gyp)/content_content_common_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,build_temp_gyp_googleurl_gyp)/build_temp_gyp_googleurl_gyp.a \ $(call intermediates-dir-for,GYP,third_party_icu_icudata_gyp)/icudata.stamp \ $(call intermediates-dir-for,GYP,third_party_icu_system_icu_gyp)/system_icu.stamp \ $(call intermediates-dir-for,GYP,third_party_icu_icui18n_gyp)/icui18n.stamp \ $(call intermediates-dir-for,GYP,third_party_icu_icuuc_gyp)/icuuc.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_common_gyp)/content_content_common_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,components_tracing_gyp)/components_tracing_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,ipc_ipc_gyp)/ipc_ipc_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,media_media_gyp)/media_media_gyp.a \ @@ -105,10 +105,11 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_inspector_protocol_sources_gyp)/inspector_protocol_sources.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_generate_inspector_protocol_version_gyp)/generate_inspector_protocol_version.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_make_derived_sources_gyp)/make_derived_sources.stamp \ - $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_generate_settings_gyp)/generate_settings.stamp \ + $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_generate_test_support_idls_gyp)/generate_test_support_idls.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_bindings_bindings_derived_sources_gyp)/bindings_derived_sources.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_bindings_supplemental_dependencies_gyp)/supplemental_dependencies.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_config_gyp)/config.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_origin_origin_gyp)/third_party_WebKit_Source_origin_origin_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_c_lib_gyp)/gpu_gles2_c_lib_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_implementation_gyp)/gpu_gles2_implementation_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_iccjpeg_iccjpeg_gyp)/third_party_iccjpeg_iccjpeg_gyp.a \ @@ -161,6 +162,12 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,GYP,content_content_jni_headers_gyp)/content_jni_headers.stamp \ $(call intermediates-dir-for,GYP,content_java_set_jni_headers_gyp)/java_set_jni_headers.stamp \ $(call intermediates-dir-for,GYP,content_common_aidl_gyp)/common_aidl.stamp \ + $(call intermediates-dir-for,GYP,components_autofill_jni_headers_gyp)/autofill_jni_headers.stamp \ + $(call intermediates-dir-for,GYP,components_autofill_regexes_gyp)/autofill_regexes.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_autofill_risk_proto_gyp)/components_autofill_risk_proto_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_encryptor_gyp)/components_encryptor_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_webdata_common_gyp)/components_webdata_common_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_browser_gyp)/content_content_browser_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,content_browser_speech_proto_speech_proto_gyp)/content_browser_speech_proto_speech_proto_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,google_apis_google_apis_gyp)/google_apis_google_apis_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_zlib_zip_gyp)/third_party_zlib_zip_gyp.a \ @@ -196,6 +203,8 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,STATIC_LIBRARIES,sandbox_sandbox_services_gyp)/sandbox_sandbox_services_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,sandbox_seccomp_bpf_gyp)/sandbox_seccomp_bpf_gyp.a \ $(call intermediates-dir-for,GYP,sandbox_sandbox_services_headers_gyp)/sandbox_services_headers.stamp \ + $(call intermediates-dir-for,GYP,chrome_chrome_strings_gyp)/chrome_strings.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_web_contents_delegate_android_gyp)/components_web_contents_delegate_android_gyp.a \ $(call intermediates-dir-for,GYP,components_web_contents_delegate_android_jni_headers_gyp)/web_contents_delegate_android_jni_headers.stamp \ $(call intermediates-dir-for,GYP,android_webview_native_android_webview_native_jni_gyp)/android_webview_native_jni.stamp \ $(call intermediates-dir-for,GYP,android_webview_native_android_jar_jni_headers_gyp)/android_jar_jni_headers.stamp \ @@ -338,15 +347,15 @@ LOCAL_STATIC_LIBRARIES := \ android_webview_native_webview_native_gyp \ base_base_static_gyp \ base_third_party_dynamic_annotations_dynamic_annotations_gyp \ - components_web_contents_delegate_android_gyp \ + components_autofill_browser_gyp \ + components_autofill_common_gyp \ base_base_gyp \ base_allocator_allocator_extension_thunks_gyp \ third_party_modp_b64_modp_b64_gyp \ base_symbolize_gyp \ third_party_libevent_libevent_gyp \ - content_content_browser_gyp \ - content_content_common_gyp \ build_temp_gyp_googleurl_gyp \ + content_content_common_gyp \ components_tracing_gyp \ ipc_ipc_gyp \ media_media_gyp \ @@ -388,6 +397,7 @@ LOCAL_STATIC_LIBRARIES := \ third_party_WebKit_Source_WebKit_chromium_webkit_gyp \ third_party_WebKit_Source_wtf_wtf_gyp \ third_party_WebKit_Source_core_core_gyp_webcore_dom_gyp \ + third_party_WebKit_Source_origin_origin_gyp \ gpu_gles2_c_lib_gyp \ gpu_gles2_implementation_gyp \ third_party_iccjpeg_iccjpeg_gyp \ @@ -426,6 +436,10 @@ LOCAL_STATIC_LIBRARIES := \ webkit_support_webkit_media_gyp \ webkit_support_webkit_storage_gyp \ sql_sql_gyp \ + components_autofill_risk_proto_gyp \ + components_encryptor_gyp \ + components_webdata_common_gyp \ + content_content_browser_gyp \ content_browser_speech_proto_speech_proto_gyp \ google_apis_google_apis_gyp \ third_party_zlib_zip_gyp \ @@ -441,6 +455,7 @@ LOCAL_STATIC_LIBRARIES := \ net_http_server_gyp \ sandbox_sandbox_services_gyp \ sandbox_seccomp_bpf_gyp \ + components_web_contents_delegate_android_gyp \ components_auto_login_parser_gyp \ components_navigation_interception_gyp \ components_visitedlink_browser_gyp \ @@ -458,12 +473,12 @@ LOCAL_GROUP_STATIC_LIBRARIES := true LOCAL_SHARED_LIBRARIES := \ libcutils \ liblog \ - libjnigraphics \ - libandroid \ libicui18n \ libicuuc \ + libandroid \ libOpenSLES \ libexpat \ + libjnigraphics \ libjpeg \ libstlport \ libdl diff --git a/android_webview/libwebviewchromium.target.linux-arm.mk b/android_webview/libwebviewchromium.target.linux-arm.mk index 5827a03a1c..31949016d4 100644 --- a/android_webview/libwebviewchromium.target.linux-arm.mk +++ b/android_webview/libwebviewchromium.target.linux-arm.mk @@ -15,7 +15,8 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,STATIC_LIBRARIES,android_webview_native_webview_native_gyp)/android_webview_native_webview_native_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_base_static_gyp)/base_base_static_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_third_party_dynamic_annotations_dynamic_annotations_gyp)/base_third_party_dynamic_annotations_dynamic_annotations_gyp.a \ - $(call intermediates-dir-for,STATIC_LIBRARIES,components_web_contents_delegate_android_gyp)/components_web_contents_delegate_android_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_autofill_browser_gyp)/components_autofill_browser_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_autofill_common_gyp)/components_autofill_common_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_base_gyp)/base_base_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_allocator_allocator_extension_thunks_gyp)/base_allocator_allocator_extension_thunks_gyp.a \ $(call intermediates-dir-for,GYP,testing_gtest_prod_gyp)/gtest_prod.stamp \ @@ -24,13 +25,12 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_symbolize_gyp)/base_symbolize_gyp.a \ $(call intermediates-dir-for,GYP,third_party_ashmem_ashmem_gyp)/ashmem.stamp \ $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_libevent_libevent_gyp)/third_party_libevent_libevent_gyp.a \ - $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_browser_gyp)/content_content_browser_gyp.a \ - $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_common_gyp)/content_content_common_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,build_temp_gyp_googleurl_gyp)/build_temp_gyp_googleurl_gyp.a \ $(call intermediates-dir-for,GYP,third_party_icu_icudata_gyp)/icudata.stamp \ $(call intermediates-dir-for,GYP,third_party_icu_system_icu_gyp)/system_icu.stamp \ $(call intermediates-dir-for,GYP,third_party_icu_icui18n_gyp)/icui18n.stamp \ $(call intermediates-dir-for,GYP,third_party_icu_icuuc_gyp)/icuuc.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_common_gyp)/content_content_common_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,components_tracing_gyp)/components_tracing_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,ipc_ipc_gyp)/ipc_ipc_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,media_media_gyp)/media_media_gyp.a \ @@ -104,10 +104,11 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_inspector_protocol_sources_gyp)/inspector_protocol_sources.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_generate_inspector_protocol_version_gyp)/generate_inspector_protocol_version.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_make_derived_sources_gyp)/make_derived_sources.stamp \ - $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_generate_settings_gyp)/generate_settings.stamp \ + $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_generate_test_support_idls_gyp)/generate_test_support_idls.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_bindings_bindings_derived_sources_gyp)/bindings_derived_sources.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_bindings_supplemental_dependencies_gyp)/supplemental_dependencies.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_config_gyp)/config.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_origin_origin_gyp)/third_party_WebKit_Source_origin_origin_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_c_lib_gyp)/gpu_gles2_c_lib_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_implementation_gyp)/gpu_gles2_implementation_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_iccjpeg_iccjpeg_gyp)/third_party_iccjpeg_iccjpeg_gyp.a \ @@ -161,6 +162,12 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,GYP,content_content_jni_headers_gyp)/content_jni_headers.stamp \ $(call intermediates-dir-for,GYP,content_java_set_jni_headers_gyp)/java_set_jni_headers.stamp \ $(call intermediates-dir-for,GYP,content_common_aidl_gyp)/common_aidl.stamp \ + $(call intermediates-dir-for,GYP,components_autofill_jni_headers_gyp)/autofill_jni_headers.stamp \ + $(call intermediates-dir-for,GYP,components_autofill_regexes_gyp)/autofill_regexes.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_autofill_risk_proto_gyp)/components_autofill_risk_proto_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_encryptor_gyp)/components_encryptor_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_webdata_common_gyp)/components_webdata_common_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_browser_gyp)/content_content_browser_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,content_browser_speech_proto_speech_proto_gyp)/content_browser_speech_proto_speech_proto_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,google_apis_google_apis_gyp)/google_apis_google_apis_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_zlib_zip_gyp)/third_party_zlib_zip_gyp.a \ @@ -196,6 +203,8 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,STATIC_LIBRARIES,sandbox_sandbox_services_gyp)/sandbox_sandbox_services_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,sandbox_seccomp_bpf_gyp)/sandbox_seccomp_bpf_gyp.a \ $(call intermediates-dir-for,GYP,sandbox_sandbox_services_headers_gyp)/sandbox_services_headers.stamp \ + $(call intermediates-dir-for,GYP,chrome_chrome_strings_gyp)/chrome_strings.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_web_contents_delegate_android_gyp)/components_web_contents_delegate_android_gyp.a \ $(call intermediates-dir-for,GYP,components_web_contents_delegate_android_jni_headers_gyp)/web_contents_delegate_android_jni_headers.stamp \ $(call intermediates-dir-for,GYP,android_webview_native_android_webview_native_jni_gyp)/android_webview_native_jni.stamp \ $(call intermediates-dir-for,GYP,android_webview_native_android_jar_jni_headers_gyp)/android_jar_jni_headers.stamp \ @@ -339,15 +348,15 @@ LOCAL_STATIC_LIBRARIES := \ android_webview_native_webview_native_gyp \ base_base_static_gyp \ base_third_party_dynamic_annotations_dynamic_annotations_gyp \ - components_web_contents_delegate_android_gyp \ + components_autofill_browser_gyp \ + components_autofill_common_gyp \ base_base_gyp \ base_allocator_allocator_extension_thunks_gyp \ third_party_modp_b64_modp_b64_gyp \ base_symbolize_gyp \ third_party_libevent_libevent_gyp \ - content_content_browser_gyp \ - content_content_common_gyp \ build_temp_gyp_googleurl_gyp \ + content_content_common_gyp \ components_tracing_gyp \ ipc_ipc_gyp \ media_media_gyp \ @@ -388,6 +397,7 @@ LOCAL_STATIC_LIBRARIES := \ third_party_WebKit_Source_WebKit_chromium_webkit_gyp \ third_party_WebKit_Source_wtf_wtf_gyp \ third_party_WebKit_Source_core_core_gyp_webcore_dom_gyp \ + third_party_WebKit_Source_origin_origin_gyp \ gpu_gles2_c_lib_gyp \ gpu_gles2_implementation_gyp \ third_party_iccjpeg_iccjpeg_gyp \ @@ -428,6 +438,10 @@ LOCAL_STATIC_LIBRARIES := \ webkit_support_webkit_media_gyp \ webkit_support_webkit_storage_gyp \ sql_sql_gyp \ + components_autofill_risk_proto_gyp \ + components_encryptor_gyp \ + components_webdata_common_gyp \ + content_content_browser_gyp \ content_browser_speech_proto_speech_proto_gyp \ google_apis_google_apis_gyp \ third_party_zlib_zip_gyp \ @@ -443,6 +457,7 @@ LOCAL_STATIC_LIBRARIES := \ net_http_server_gyp \ sandbox_sandbox_services_gyp \ sandbox_seccomp_bpf_gyp \ + components_web_contents_delegate_android_gyp \ components_auto_login_parser_gyp \ components_navigation_interception_gyp \ components_visitedlink_browser_gyp \ @@ -460,12 +475,12 @@ LOCAL_GROUP_STATIC_LIBRARIES := true LOCAL_SHARED_LIBRARIES := \ libcutils \ liblog \ - libjnigraphics \ - libandroid \ libicui18n \ libicuuc \ + libandroid \ libOpenSLES \ libexpat \ + libjnigraphics \ libjpeg \ libstlport \ libdl diff --git a/android_webview/libwebviewchromium.target.linux-x86.mk b/android_webview/libwebviewchromium.target.linux-x86.mk index d4bb4257dc..84897ac1ff 100644 --- a/android_webview/libwebviewchromium.target.linux-x86.mk +++ b/android_webview/libwebviewchromium.target.linux-x86.mk @@ -15,7 +15,8 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,STATIC_LIBRARIES,android_webview_native_webview_native_gyp)/android_webview_native_webview_native_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_base_static_gyp)/base_base_static_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_third_party_dynamic_annotations_dynamic_annotations_gyp)/base_third_party_dynamic_annotations_dynamic_annotations_gyp.a \ - $(call intermediates-dir-for,STATIC_LIBRARIES,components_web_contents_delegate_android_gyp)/components_web_contents_delegate_android_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_autofill_browser_gyp)/components_autofill_browser_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_autofill_common_gyp)/components_autofill_common_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_base_gyp)/base_base_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_allocator_allocator_extension_thunks_gyp)/base_allocator_allocator_extension_thunks_gyp.a \ $(call intermediates-dir-for,GYP,testing_gtest_prod_gyp)/gtest_prod.stamp \ @@ -24,13 +25,12 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,STATIC_LIBRARIES,base_symbolize_gyp)/base_symbolize_gyp.a \ $(call intermediates-dir-for,GYP,third_party_ashmem_ashmem_gyp)/ashmem.stamp \ $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_libevent_libevent_gyp)/third_party_libevent_libevent_gyp.a \ - $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_browser_gyp)/content_content_browser_gyp.a \ - $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_common_gyp)/content_content_common_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,build_temp_gyp_googleurl_gyp)/build_temp_gyp_googleurl_gyp.a \ $(call intermediates-dir-for,GYP,third_party_icu_icudata_gyp)/icudata.stamp \ $(call intermediates-dir-for,GYP,third_party_icu_system_icu_gyp)/system_icu.stamp \ $(call intermediates-dir-for,GYP,third_party_icu_icui18n_gyp)/icui18n.stamp \ $(call intermediates-dir-for,GYP,third_party_icu_icuuc_gyp)/icuuc.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_common_gyp)/content_content_common_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,components_tracing_gyp)/components_tracing_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,ipc_ipc_gyp)/ipc_ipc_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,media_media_gyp)/media_media_gyp.a \ @@ -105,10 +105,11 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_inspector_protocol_sources_gyp)/inspector_protocol_sources.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_generate_inspector_protocol_version_gyp)/generate_inspector_protocol_version.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_make_derived_sources_gyp)/make_derived_sources.stamp \ - $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_generate_settings_gyp)/generate_settings.stamp \ + $(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_core_gyp_generate_test_support_idls_gyp)/generate_test_support_idls.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_bindings_bindings_derived_sources_gyp)/bindings_derived_sources.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_bindings_supplemental_dependencies_gyp)/supplemental_dependencies.stamp \ $(call intermediates-dir-for,GYP,third_party_WebKit_Source_config_gyp)/config.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_origin_origin_gyp)/third_party_WebKit_Source_origin_origin_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_c_lib_gyp)/gpu_gles2_c_lib_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_implementation_gyp)/gpu_gles2_implementation_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_iccjpeg_iccjpeg_gyp)/third_party_iccjpeg_iccjpeg_gyp.a \ @@ -161,6 +162,12 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,GYP,content_content_jni_headers_gyp)/content_jni_headers.stamp \ $(call intermediates-dir-for,GYP,content_java_set_jni_headers_gyp)/java_set_jni_headers.stamp \ $(call intermediates-dir-for,GYP,content_common_aidl_gyp)/common_aidl.stamp \ + $(call intermediates-dir-for,GYP,components_autofill_jni_headers_gyp)/autofill_jni_headers.stamp \ + $(call intermediates-dir-for,GYP,components_autofill_regexes_gyp)/autofill_regexes.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_autofill_risk_proto_gyp)/components_autofill_risk_proto_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_encryptor_gyp)/components_encryptor_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_webdata_common_gyp)/components_webdata_common_gyp.a \ + $(call intermediates-dir-for,STATIC_LIBRARIES,content_content_browser_gyp)/content_content_browser_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,content_browser_speech_proto_speech_proto_gyp)/content_browser_speech_proto_speech_proto_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,google_apis_google_apis_gyp)/google_apis_google_apis_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,third_party_zlib_zip_gyp)/third_party_zlib_zip_gyp.a \ @@ -196,6 +203,8 @@ GYP_TARGET_DEPENDENCIES := \ $(call intermediates-dir-for,STATIC_LIBRARIES,sandbox_sandbox_services_gyp)/sandbox_sandbox_services_gyp.a \ $(call intermediates-dir-for,STATIC_LIBRARIES,sandbox_seccomp_bpf_gyp)/sandbox_seccomp_bpf_gyp.a \ $(call intermediates-dir-for,GYP,sandbox_sandbox_services_headers_gyp)/sandbox_services_headers.stamp \ + $(call intermediates-dir-for,GYP,chrome_chrome_strings_gyp)/chrome_strings.stamp \ + $(call intermediates-dir-for,STATIC_LIBRARIES,components_web_contents_delegate_android_gyp)/components_web_contents_delegate_android_gyp.a \ $(call intermediates-dir-for,GYP,components_web_contents_delegate_android_jni_headers_gyp)/web_contents_delegate_android_jni_headers.stamp \ $(call intermediates-dir-for,GYP,android_webview_native_android_webview_native_jni_gyp)/android_webview_native_jni.stamp \ $(call intermediates-dir-for,GYP,android_webview_native_android_jar_jni_headers_gyp)/android_jar_jni_headers.stamp \ @@ -338,15 +347,15 @@ LOCAL_STATIC_LIBRARIES := \ android_webview_native_webview_native_gyp \ base_base_static_gyp \ base_third_party_dynamic_annotations_dynamic_annotations_gyp \ - components_web_contents_delegate_android_gyp \ + components_autofill_browser_gyp \ + components_autofill_common_gyp \ base_base_gyp \ base_allocator_allocator_extension_thunks_gyp \ third_party_modp_b64_modp_b64_gyp \ base_symbolize_gyp \ third_party_libevent_libevent_gyp \ - content_content_browser_gyp \ - content_content_common_gyp \ build_temp_gyp_googleurl_gyp \ + content_content_common_gyp \ components_tracing_gyp \ ipc_ipc_gyp \ media_media_gyp \ @@ -388,6 +397,7 @@ LOCAL_STATIC_LIBRARIES := \ third_party_WebKit_Source_WebKit_chromium_webkit_gyp \ third_party_WebKit_Source_wtf_wtf_gyp \ third_party_WebKit_Source_core_core_gyp_webcore_dom_gyp \ + third_party_WebKit_Source_origin_origin_gyp \ gpu_gles2_c_lib_gyp \ gpu_gles2_implementation_gyp \ third_party_iccjpeg_iccjpeg_gyp \ @@ -426,6 +436,10 @@ LOCAL_STATIC_LIBRARIES := \ webkit_support_webkit_media_gyp \ webkit_support_webkit_storage_gyp \ sql_sql_gyp \ + components_autofill_risk_proto_gyp \ + components_encryptor_gyp \ + components_webdata_common_gyp \ + content_content_browser_gyp \ content_browser_speech_proto_speech_proto_gyp \ google_apis_google_apis_gyp \ third_party_zlib_zip_gyp \ @@ -441,6 +455,7 @@ LOCAL_STATIC_LIBRARIES := \ net_http_server_gyp \ sandbox_sandbox_services_gyp \ sandbox_seccomp_bpf_gyp \ + components_web_contents_delegate_android_gyp \ components_auto_login_parser_gyp \ components_navigation_interception_gyp \ components_visitedlink_browser_gyp \ @@ -458,12 +473,12 @@ LOCAL_GROUP_STATIC_LIBRARIES := true LOCAL_SHARED_LIBRARIES := \ libcutils \ liblog \ - libjnigraphics \ - libandroid \ libicui18n \ libicuuc \ + libandroid \ libOpenSLES \ libexpat \ + libjnigraphics \ libjpeg \ libstlport \ libdl diff --git a/android_webview/native/android_webview_jni_registrar.cc b/android_webview/native/android_webview_jni_registrar.cc index 993ca7dbe5..05f43888e0 100644 --- a/android_webview/native/android_webview_jni_registrar.cc +++ b/android_webview/native/android_webview_jni_registrar.cc @@ -8,6 +8,7 @@ #include "android_webview/native/aw_contents.h" #include "android_webview/native/aw_contents_client_bridge.h" #include "android_webview/native/aw_contents_io_thread_client_impl.h" +#include "android_webview/native/aw_form_database.h" #include "android_webview/native/aw_http_auth_handler.h" #include "android_webview/native/aw_quota_manager_bridge_impl.h" #include "android_webview/native/aw_resource.h" @@ -29,6 +30,7 @@ static base::android::RegistrationMethod kWebViewRegisteredMethods[] = { { "AwContents", RegisterAwContents }, { "AwContentsClientBridge", RegisterAwContentsClientBridge }, { "AwContentsIoThreadClientImpl", RegisterAwContentsIoThreadClientImpl}, + { "AwFormDatabase", RegisterAwFormDatabase}, { "AwSettings", RegisterAwSettings }, { "AwHttpAuthHandler", RegisterAwHttpAuthHandler }, { "AwQuotaManagerBridge", RegisterAwQuotaManagerBridge }, diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc index 58a89c2b1b..4f532c6ae1 100644 --- a/android_webview/native/aw_contents.cc +++ b/android_webview/native/aw_contents.cc @@ -9,7 +9,6 @@ #include "android_webview/browser/browser_view_renderer_impl.h" #include "android_webview/browser/gpu_memory_buffer_impl.h" #include "android_webview/browser/net_disk_cache_remover.h" -#include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h" #include "android_webview/common/aw_hit_test_data.h" #include "android_webview/native/aw_browser_dependency_factory.h" @@ -145,7 +144,8 @@ void AwContents::SetWebContents(content::WebContents* web_contents) { AwContentsClientBridgeBase::Associate(web_contents_.get(), contents_client_bridge_.get()); web_contents_->SetDelegate(web_contents_delegate_.get()); - render_view_host_ext_.reset(new AwRenderViewHostExt(web_contents_.get())); + render_view_host_ext_.reset( + new AwRenderViewHostExt(this, web_contents_.get())); } void AwContents::SetWebContents(JNIEnv* env, jobject obj, jint new_wc) { @@ -467,6 +467,13 @@ void AwContents::OnReceivedTouchIconUrl(const std::string& url, env, obj.obj(), ConvertUTF8ToJavaString(env, url).obj(), precomposed); } +void AwContents::RequestProcessMode() { + JNIEnv* env = AttachCurrentThread(); + ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); + if (!obj.is_null()) + Java_AwContents_requestProcessMode(env, obj.obj()); +} + void AwContents::Invalidate() { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); @@ -474,11 +481,11 @@ void AwContents::Invalidate() { Java_AwContents_invalidate(env, obj.obj()); } -void AwContents::OnNewPicture(const JavaRef<jobject>& picture) { +void AwContents::OnNewPicture() { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); if (!obj.is_null()) - Java_AwContents_onNewPicture(env, obj.obj(), picture.obj()); + Java_AwContents_onNewPicture(env, obj.obj()); } base::android::ScopedJavaLocalRef<jbyteArray> @@ -600,9 +607,9 @@ bool AwContents::DrawSW(JNIEnv* env, canvas, gfx::Rect(clip_x, clip_y, clip_w, clip_h)); } -void AwContents::SetScrollForHWFrame(JNIEnv* env, jobject obj, - int scroll_x, int scroll_y) { - browser_view_renderer_->SetScrollForHWFrame(scroll_x, scroll_y); +bool AwContents::PrepareDrawGL(JNIEnv* env, jobject obj, + int scroll_x, int scroll_y) { + return browser_view_renderer_->PrepareDrawGL(scroll_x, scroll_y); } void AwContents::SetPendingWebContentsForPopup( @@ -653,17 +660,8 @@ ScopedJavaLocalRef<jobject> AwContents::CapturePicture(JNIEnv* env, void AwContents::EnableOnNewPicture(JNIEnv* env, jobject obj, - jboolean enabled, - jboolean invalidation_only) { - BrowserViewRenderer::OnNewPictureMode mode = - BrowserViewRenderer::kOnNewPictureDisabled; - if (enabled) { - mode = invalidation_only ? - BrowserViewRenderer::kOnNewPictureInvalidationOnly : - BrowserViewRenderer::kOnNewPictureEnabled; - } - - browser_view_renderer_->EnableOnNewPicture(mode); + jboolean enabled) { + browser_view_renderer_->EnableOnNewPicture(enabled); } } // namespace android_webview diff --git a/android_webview/native/aw_contents.h b/android_webview/native/aw_contents.h index 5466c6f377..3dbc640789 100644 --- a/android_webview/native/aw_contents.h +++ b/android_webview/native/aw_contents.h @@ -38,14 +38,9 @@ class AwWebContentsDelegate; // level of indirection provided by the AwContentsContainer abstraction. class AwContents : public FindHelper::Listener, public IconHelper::Listener, + public AwRenderViewHostExtClient, public BrowserViewRenderer::Client { public: - enum OnNewPictureMode { - kOnNewPictureDisabled = 0, - kOnNewPictureEnabled, - kOnNewPictureInvalidationOnly, - }; - // Returns the AwContents instance associated with |web_contents|, or NULL. static AwContents* FromWebContents(content::WebContents* web_contents); @@ -106,15 +101,14 @@ class AwContents : public FindHelper::Listener, jint clip_y, jint clip_w, jint clip_h); - void SetScrollForHWFrame(JNIEnv* env, jobject obj, - int scroll_x, int scroll_y); + bool PrepareDrawGL(JNIEnv* env, jobject obj, + int scroll_x, int scroll_y); jint GetAwDrawGLViewContext(JNIEnv* env, jobject obj); base::android::ScopedJavaLocalRef<jobject> CapturePicture(JNIEnv* env, jobject obj); void EnableOnNewPicture(JNIEnv* env, jobject obj, - jboolean enabled, - jboolean invalidation_only); + jboolean enabled); // Geolocation API support void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); @@ -139,12 +133,14 @@ class AwContents : public FindHelper::Listener, virtual void OnReceivedTouchIconUrl(const std::string& url, const bool precomposed) OVERRIDE; + // AwRenderViewHostExtClient implementation. + virtual void OnPageScaleFactorChanged(float page_scale_factor) OVERRIDE; + // BrowserViewRenderer::Client implementation. + virtual void RequestProcessMode() OVERRIDE; virtual void Invalidate() OVERRIDE; - virtual void OnNewPicture( - const base::android::JavaRef<jobject>& picture) OVERRIDE; + virtual void OnNewPicture() OVERRIDE; virtual gfx::Point GetLocationOnScreen() OVERRIDE; - virtual void OnPageScaleFactorChanged(float page_scale_factor) OVERRIDE; void ClearCache(JNIEnv* env, jobject obj, jboolean include_disk_files); void SetPendingWebContentsForPopup(scoped_ptr<content::WebContents> pending); diff --git a/android_webview/native/aw_form_database.cc b/android_webview/native/aw_form_database.cc index f0d42fdc7c..5ebdf1223f 100644 --- a/android_webview/native/aw_form_database.cc +++ b/android_webview/native/aw_form_database.cc @@ -6,33 +6,51 @@ #include "android_webview/browser/aw_browser_context.h" #include "android_webview/browser/aw_content_browser_client.h" +#include "android_webview/browser/aw_form_database_service.h" #include "base/android/jni_android.h" #include "base/logging.h" #include "base/time.h" #include "components/autofill/browser/webdata/autofill_webdata_service.h" #include "jni/AwFormDatabase_jni.h" +// static +scoped_refptr<autofill::AutofillWebDataService> +autofill::AutofillWebDataService::FromBrowserContext( + content::BrowserContext* context) { + + DCHECK(context); + android_webview::AwFormDatabaseService* service = + static_cast<android_webview::AwBrowserContext*>( + context)->GetFormDatabaseService(); + DCHECK(service); + return service->get_autofill_webdata_service(); +} + namespace android_webview { -// static -void ClearFormData(JNIEnv*, jclass) { +namespace { + +AwFormDatabaseService* GetFormDatabaseService() { + AwBrowserContext* context = AwContentBrowserClient::GetAwBrowserContext(); - DCHECK(context); + AwFormDatabaseService* service = context->GetFormDatabaseService(); + return service; +} + +} // anonymous namespace - autofill::AutofillWebDataService* service = - autofill::AutofillWebDataService::FromBrowserContext(context).get(); - if (service == NULL) { - LOG(WARNING) << "No webdata service found, ignoring ClearFormData"; - return; - } - - base::Time begin; - base::Time end = base::Time::Max(); - service->RemoveFormElementsAddedBetween(begin, end); - service->RemoveAutofillDataModifiedBetween(begin, end); + +// static +jboolean HasFormData(JNIEnv*, jclass) { + return GetFormDatabaseService()->HasFormData(); +} + +// static +void ClearFormData(JNIEnv*, jclass) { + GetFormDatabaseService()->ClearFormData(); } -bool RegisterFormDatabase(JNIEnv* env) { +bool RegisterAwFormDatabase(JNIEnv* env) { return RegisterNativesImpl(env) >= 0; } diff --git a/android_webview/native/aw_form_database.h b/android_webview/native/aw_form_database.h index 9f6ebaeed7..ae1ceb0eb0 100644 --- a/android_webview/native/aw_form_database.h +++ b/android_webview/native/aw_form_database.h @@ -9,7 +9,7 @@ namespace android_webview { -bool RegisterFormDatabase(JNIEnv* env); +bool RegisterAwFormDatabase(JNIEnv* env); } // namespace android_webview diff --git a/android_webview/native/aw_settings.cc b/android_webview/native/aw_settings.cc index 8dd383ea2c..21b99689d1 100644 --- a/android_webview/native/aw_settings.cc +++ b/android_webview/native/aw_settings.cc @@ -18,119 +18,12 @@ #include "webkit/glue/webpreferences.h" #include "webkit/user_agent/user_agent.h" -using base::android::CheckException; using base::android::ConvertJavaStringToUTF16; -using base::android::ConvertUTF16ToJavaString; using base::android::ConvertUTF8ToJavaString; -using base::android::GetClass; -using base::android::GetFieldID; -using base::android::GetMethodIDFromClassName; using base::android::ScopedJavaLocalRef; namespace android_webview { -struct AwSettings::FieldIds { - // Note on speed. One may think that an approach that reads field values via - // JNI is ineffective and should not be used. Please keep in mind that in the - // legacy WebView the whole Sync method took <1ms on Xoom, and no one is - // expected to modify settings in performance-critical code. - FieldIds() { } - - FieldIds(JNIEnv* env) { - const char* kStringClassName = "Ljava/lang/String;"; - - // FIXME: we should be using a new GetFieldIDFromClassName() with caching. - ScopedJavaLocalRef<jclass> clazz( - GetClass(env, "org/chromium/android_webview/AwSettings")); - text_size_percent = GetFieldID(env, clazz, "mTextSizePercent", "I"); - standard_fond_family = - GetFieldID(env, clazz, "mStandardFontFamily", kStringClassName); - fixed_font_family = - GetFieldID(env, clazz, "mFixedFontFamily", kStringClassName); - sans_serif_font_family = - GetFieldID(env, clazz, "mSansSerifFontFamily", kStringClassName); - serif_font_family = - GetFieldID(env, clazz, "mSerifFontFamily", kStringClassName); - cursive_font_family = - GetFieldID(env, clazz, "mCursiveFontFamily", kStringClassName); - fantasy_font_family = - GetFieldID(env, clazz, "mFantasyFontFamily", kStringClassName); - default_text_encoding = - GetFieldID(env, clazz, "mDefaultTextEncoding", kStringClassName); - user_agent = - GetFieldID(env, clazz, "mUserAgent", kStringClassName); - minimum_font_size = GetFieldID(env, clazz, "mMinimumFontSize", "I"); - minimum_logical_font_size = - GetFieldID(env, clazz, "mMinimumLogicalFontSize", "I"); - default_font_size = GetFieldID(env, clazz, "mDefaultFontSize", "I"); - default_fixed_font_size = - GetFieldID(env, clazz, "mDefaultFixedFontSize", "I"); - load_images_automatically = - GetFieldID(env, clazz, "mLoadsImagesAutomatically", "Z"); - images_enabled = - GetFieldID(env, clazz, "mImagesEnabled", "Z"); - java_script_enabled = - GetFieldID(env, clazz, "mJavaScriptEnabled", "Z"); - allow_universal_access_from_file_urls = - GetFieldID(env, clazz, "mAllowUniversalAccessFromFileURLs", "Z"); - allow_file_access_from_file_urls = - GetFieldID(env, clazz, "mAllowFileAccessFromFileURLs", "Z"); - java_script_can_open_windows_automatically = - GetFieldID(env, clazz, "mJavaScriptCanOpenWindowsAutomatically", "Z"); - support_multiple_windows = - GetFieldID(env, clazz, "mSupportMultipleWindows", "Z"); - dom_storage_enabled = - GetFieldID(env, clazz, "mDomStorageEnabled", "Z"); - database_enabled = - GetFieldID(env, clazz, "mDatabaseEnabled", "Z"); - use_wide_viewport = - GetFieldID(env, clazz, "mUseWideViewport", "Z"); - load_with_overview_mode = - GetFieldID(env, clazz, "mLoadWithOverviewMode", "Z"); - media_playback_requires_user_gesture = - GetFieldID(env, clazz, "mMediaPlaybackRequiresUserGesture", "Z"); - default_video_poster_url = - GetFieldID(env, clazz, "mDefaultVideoPosterURL", kStringClassName); - support_deprecated_target_density_dpi = - GetFieldID(env, clazz, "mSupportDeprecatedTargetDensityDPI", "Z"); - dip_scale = - GetFieldID(env, clazz, "mDIPScale", "D"); - initial_page_scale_percent = - GetFieldID(env, clazz, "mInitialPageScalePercent", "F"); - } - - // Field ids - jfieldID text_size_percent; - jfieldID standard_fond_family; - jfieldID fixed_font_family; - jfieldID sans_serif_font_family; - jfieldID serif_font_family; - jfieldID cursive_font_family; - jfieldID fantasy_font_family; - jfieldID default_text_encoding; - jfieldID user_agent; - jfieldID minimum_font_size; - jfieldID minimum_logical_font_size; - jfieldID default_font_size; - jfieldID default_fixed_font_size; - jfieldID load_images_automatically; - jfieldID images_enabled; - jfieldID java_script_enabled; - jfieldID allow_universal_access_from_file_urls; - jfieldID allow_file_access_from_file_urls; - jfieldID java_script_can_open_windows_automatically; - jfieldID support_multiple_windows; - jfieldID dom_storage_enabled; - jfieldID database_enabled; - jfieldID use_wide_viewport; - jfieldID load_with_overview_mode; - jfieldID media_playback_requires_user_gesture; - jfieldID default_video_poster_url; - jfieldID support_deprecated_target_density_dpi; - jfieldID dip_scale; - jfieldID initial_page_scale_percent; -}; - AwSettings::AwSettings(JNIEnv* env, jobject obj) : aw_settings_(env, obj) { } @@ -155,12 +48,13 @@ void AwSettings::ResetScrollAndScaleState(JNIEnv* env, jobject obj) { rvhe->ResetScrollAndScaleState(); } -void AwSettings::SetWebContents(JNIEnv* env, jobject obj, jint jweb_contents) { +void AwSettings::SetWebContentsLocked( + JNIEnv* env, jobject obj, jint jweb_contents) { content::WebContents* web_contents = reinterpret_cast<content::WebContents*>(jweb_contents); Observe(web_contents); - UpdateEverything(env, obj); + UpdateEverythingLocked(env, obj); } void AwSettings::UpdateEverything() { @@ -169,25 +63,23 @@ void AwSettings::UpdateEverything() { ScopedJavaLocalRef<jobject> scoped_obj = aw_settings_.get(env); jobject obj = scoped_obj.obj(); if (!obj) return; - UpdateEverything(env, obj); + // Grab the lock and call UpdateEverythingLocked. + Java_AwSettings_updateEverything(env, obj); } -void AwSettings::UpdateEverything(JNIEnv* env, jobject obj) { - UpdateInitialPageScale(env, obj); - UpdateWebkitPreferences(env, obj); - UpdateUserAgent(env, obj); +void AwSettings::UpdateEverythingLocked(JNIEnv* env, jobject obj) { + UpdateInitialPageScaleLocked(env, obj); + UpdateWebkitPreferencesLocked(env, obj); + UpdateUserAgentLocked(env, obj); ResetScrollAndScaleState(env, obj); UpdatePreferredSizeMode(); } -void AwSettings::UpdateUserAgent(JNIEnv* env, jobject obj) { +void AwSettings::UpdateUserAgentLocked(JNIEnv* env, jobject obj) { if (!web_contents()) return; - if (!field_ids_) - field_ids_.reset(new FieldIds(env)); - - ScopedJavaLocalRef<jstring> str(env, static_cast<jstring>( - env->GetObjectField(obj, field_ids_->user_agent))); + ScopedJavaLocalRef<jstring> str = + Java_AwSettings_getUserAgentLocked(env, obj); bool ua_overidden = str.obj() != NULL; if (ua_overidden) { @@ -201,23 +93,20 @@ void AwSettings::UpdateUserAgent(JNIEnv* env, jobject obj) { controller.GetEntryAtIndex(i)->SetIsOverridingUserAgent(ua_overidden); } -void AwSettings::UpdateWebkitPreferences(JNIEnv* env, jobject obj) { +void AwSettings::UpdateWebkitPreferencesLocked(JNIEnv* env, jobject obj) { if (!web_contents()) return; AwRenderViewHostExt* render_view_host_ext = GetAwRenderViewHostExt(); if (!render_view_host_ext) return; - if (!field_ids_) - field_ids_.reset(new FieldIds(env)); - content::RenderViewHost* render_view_host = web_contents()->GetRenderViewHost(); if (!render_view_host) return; WebPreferences prefs = render_view_host->GetWebkitPreferences(); prefs.text_autosizing_enabled = - Java_AwSettings_getTextAutosizingEnabled(env, obj); + Java_AwSettings_getTextAutosizingEnabledLocked(env, obj); - int text_size_percent = env->GetIntField(obj, field_ids_->text_size_percent); + int text_size_percent = Java_AwSettings_getTextSizePercentLocked(env, obj); if (prefs.text_autosizing_enabled) { prefs.font_scale_factor = text_size_percent / 100.0f; prefs.force_enable_zoom = text_size_percent >= 130; @@ -229,126 +118,104 @@ void AwSettings::UpdateWebkitPreferences(JNIEnv* env, jobject obj) { text_size_percent / 100.0f)); } - ScopedJavaLocalRef<jstring> str( - env, static_cast<jstring>( - env->GetObjectField(obj, field_ids_->standard_fond_family))); prefs.standard_font_family_map[webkit_glue::kCommonScript] = - ConvertJavaStringToUTF16(str); + ConvertJavaStringToUTF16( + Java_AwSettings_getStandardFontFamilyLocked(env, obj)); - str.Reset( - env, static_cast<jstring>( - env->GetObjectField(obj, field_ids_->fixed_font_family))); prefs.fixed_font_family_map[webkit_glue::kCommonScript] = - ConvertJavaStringToUTF16(str); + ConvertJavaStringToUTF16( + Java_AwSettings_getFixedFontFamilyLocked(env, obj)); - str.Reset( - env, static_cast<jstring>( - env->GetObjectField(obj, field_ids_->sans_serif_font_family))); prefs.sans_serif_font_family_map[webkit_glue::kCommonScript] = - ConvertJavaStringToUTF16(str); + ConvertJavaStringToUTF16( + Java_AwSettings_getSansSerifFontFamilyLocked(env, obj)); - str.Reset( - env, static_cast<jstring>( - env->GetObjectField(obj, field_ids_->serif_font_family))); prefs.serif_font_family_map[webkit_glue::kCommonScript] = - ConvertJavaStringToUTF16(str); + ConvertJavaStringToUTF16( + Java_AwSettings_getSerifFontFamilyLocked(env, obj)); - str.Reset( - env, static_cast<jstring>( - env->GetObjectField(obj, field_ids_->cursive_font_family))); prefs.cursive_font_family_map[webkit_glue::kCommonScript] = - ConvertJavaStringToUTF16(str); + ConvertJavaStringToUTF16( + Java_AwSettings_getCursiveFontFamilyLocked(env, obj)); - str.Reset( - env, static_cast<jstring>( - env->GetObjectField(obj, field_ids_->fantasy_font_family))); prefs.fantasy_font_family_map[webkit_glue::kCommonScript] = - ConvertJavaStringToUTF16(str); + ConvertJavaStringToUTF16( + Java_AwSettings_getFantasyFontFamilyLocked(env, obj)); - str.Reset( - env, static_cast<jstring>( - env->GetObjectField(obj, field_ids_->default_text_encoding))); - prefs.default_encoding = ConvertJavaStringToUTF8(str); + prefs.default_encoding = ConvertJavaStringToUTF8( + Java_AwSettings_getDefaultTextEncodingLocked(env, obj)); - prefs.minimum_font_size = - env->GetIntField(obj, field_ids_->minimum_font_size); + prefs.minimum_font_size = Java_AwSettings_getMinimumFontSizeLocked(env, obj); prefs.minimum_logical_font_size = - env->GetIntField(obj, field_ids_->minimum_logical_font_size); + Java_AwSettings_getMinimumLogicalFontSizeLocked(env, obj); - prefs.default_font_size = - env->GetIntField(obj, field_ids_->default_font_size); + prefs.default_font_size = Java_AwSettings_getDefaultFontSizeLocked(env, obj); prefs.default_fixed_font_size = - env->GetIntField(obj, field_ids_->default_fixed_font_size); + Java_AwSettings_getDefaultFixedFontSizeLocked(env, obj); prefs.loads_images_automatically = - env->GetBooleanField(obj, field_ids_->load_images_automatically); + Java_AwSettings_getLoadsImagesAutomaticallyLocked(env, obj); - prefs.images_enabled = - env->GetBooleanField(obj, field_ids_->images_enabled); + prefs.images_enabled = Java_AwSettings_getImagesEnabledLocked(env, obj); prefs.javascript_enabled = - env->GetBooleanField(obj, field_ids_->java_script_enabled); + Java_AwSettings_getJavaScriptEnabledLocked(env, obj); - prefs.allow_universal_access_from_file_urls = env->GetBooleanField( - obj, field_ids_->allow_universal_access_from_file_urls); + prefs.allow_universal_access_from_file_urls = + Java_AwSettings_getAllowUniversalAccessFromFileURLsLocked(env, obj); - prefs.allow_file_access_from_file_urls = env->GetBooleanField( - obj, field_ids_->allow_file_access_from_file_urls); + prefs.allow_file_access_from_file_urls = + Java_AwSettings_getAllowFileAccessFromFileURLsLocked(env, obj); - prefs.javascript_can_open_windows_automatically = env->GetBooleanField( - obj, field_ids_->java_script_can_open_windows_automatically); + prefs.javascript_can_open_windows_automatically = + Java_AwSettings_getJavaScriptCanOpenWindowsAutomaticallyLocked(env, obj); - prefs.supports_multiple_windows = env->GetBooleanField( - obj, field_ids_->support_multiple_windows); + prefs.supports_multiple_windows = + Java_AwSettings_getSupportMultipleWindowsLocked(env, obj); - prefs.plugins_enabled = !Java_AwSettings_getPluginsDisabled(env, obj); + prefs.plugins_enabled = !Java_AwSettings_getPluginsDisabledLocked(env, obj); prefs.application_cache_enabled = - Java_AwSettings_getAppCacheEnabled(env, obj); + Java_AwSettings_getAppCacheEnabledLocked(env, obj); - prefs.local_storage_enabled = env->GetBooleanField( - obj, field_ids_->dom_storage_enabled); + prefs.local_storage_enabled = + Java_AwSettings_getDomStorageEnabledLocked(env, obj); - prefs.databases_enabled = env->GetBooleanField( - obj, field_ids_->database_enabled); + prefs.databases_enabled = Java_AwSettings_getDatabaseEnabledLocked(env, obj); prefs.double_tap_to_zoom_enabled = prefs.use_wide_viewport = - env->GetBooleanField(obj, field_ids_->use_wide_viewport); + Java_AwSettings_getUseWideViewportLocked(env, obj); - prefs.initialize_at_minimum_page_scale = env->GetBooleanField( - obj, field_ids_->load_with_overview_mode); + prefs.initialize_at_minimum_page_scale = + Java_AwSettings_getLoadWithOverviewModeLocked(env, obj); - prefs.user_gesture_required_for_media_playback = env->GetBooleanField( - obj, field_ids_->media_playback_requires_user_gesture); + prefs.user_gesture_required_for_media_playback = + Java_AwSettings_getMediaPlaybackRequiresUserGestureLocked(env, obj); - str.Reset( - env, static_cast<jstring>( - env->GetObjectField(obj, field_ids_->default_video_poster_url))); - prefs.default_video_poster_url = str.obj() ? - GURL(ConvertJavaStringToUTF8(str)) : GURL(); + ScopedJavaLocalRef<jstring> url = + Java_AwSettings_getDefaultVideoPosterURLLocked(env, obj); + prefs.default_video_poster_url = url.obj() ? + GURL(ConvertJavaStringToUTF8(url)) : GURL(); - prefs.support_deprecated_target_density_dpi = env->GetBooleanField( - obj, field_ids_->support_deprecated_target_density_dpi); + prefs.support_deprecated_target_density_dpi = + Java_AwSettings_getSupportDeprecatedTargetDensityDPILocked(env, obj); render_view_host->UpdateWebkitPreferences(prefs); } -void AwSettings::UpdateInitialPageScale(JNIEnv* env, jobject obj) { +void AwSettings::UpdateInitialPageScaleLocked(JNIEnv* env, jobject obj) { AwRenderViewHostExt* rvhe = GetAwRenderViewHostExt(); if (!rvhe) return; - if (!field_ids_) - field_ids_.reset(new FieldIds(env)); - float initial_page_scale_percent = - env->GetFloatField(obj, field_ids_->initial_page_scale_percent); + Java_AwSettings_getInitialPageScalePercentLocked(env, obj); if (initial_page_scale_percent == 0) { rvhe->SetInitialPageScale(-1); } else { float dip_scale = static_cast<float>( - env->GetDoubleField(obj, field_ids_->dip_scale)); + Java_AwSettings_getDIPScaleLocked(env, obj)); rvhe->SetInitialPageScale(initial_page_scale_percent / dip_scale / 100.0f); } } @@ -374,11 +241,12 @@ void AwSettings::RenderViewCreated(content::RenderViewHost* render_view_host) { UpdateEverything(); } +// Assumed to be called from the Java object's constructor, thus is "Locked". static jint Init(JNIEnv* env, jobject obj, jint web_contents) { AwSettings* settings = new AwSettings(env, obj); - settings->SetWebContents(env, obj, web_contents); + settings->SetWebContentsLocked(env, obj, web_contents); return reinterpret_cast<jint>(settings); } diff --git a/android_webview/native/aw_settings.h b/android_webview/native/aw_settings.h index d24df562b8..42df647677 100644 --- a/android_webview/native/aw_settings.h +++ b/android_webview/native/aw_settings.h @@ -21,18 +21,17 @@ class AwSettings : public content::WebContentsObserver { AwSettings(JNIEnv* env, jobject obj); virtual ~AwSettings(); - // Called from Java. + // Called from Java. Methods with "Locked" suffix require that the settings + // access lock is held during their execution. void Destroy(JNIEnv* env, jobject obj); void ResetScrollAndScaleState(JNIEnv* env, jobject obj); - void SetWebContents(JNIEnv* env, jobject obj, jint web_contents); - void UpdateEverything(JNIEnv* env, jobject obj); - void UpdateInitialPageScale(JNIEnv* env, jobject obj); - void UpdateUserAgent(JNIEnv* env, jobject obj); - void UpdateWebkitPreferences(JNIEnv* env, jobject obj); + void SetWebContentsLocked(JNIEnv* env, jobject obj, jint web_contents); + void UpdateEverythingLocked(JNIEnv* env, jobject obj); + void UpdateInitialPageScaleLocked(JNIEnv* env, jobject obj); + void UpdateUserAgentLocked(JNIEnv* env, jobject obj); + void UpdateWebkitPreferencesLocked(JNIEnv* env, jobject obj); private: - struct FieldIds; - AwRenderViewHostExt* GetAwRenderViewHostExt(); void UpdateEverything(); void UpdatePreferredSizeMode(); @@ -41,9 +40,6 @@ class AwSettings : public content::WebContentsObserver { virtual void RenderViewCreated( content::RenderViewHost* render_view_host) OVERRIDE; - // Java field references for accessing the values in the Java object. - scoped_ptr<FieldIds> field_ids_; - JavaObjectWeakGlobalRef aw_settings_; }; diff --git a/android_webview/native/webview_native.gyp b/android_webview/native/webview_native.gyp index cdd2f7198d..2ac370d29b 100644 --- a/android_webview/native/webview_native.gyp +++ b/android_webview/native/webview_native.gyp @@ -12,6 +12,7 @@ 'dependencies': [ '../../base/base.gyp:base_static', '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', + '../../components/components.gyp:autofill_browser', '../../components/components.gyp:web_contents_delegate_android', '../../cc/cc.gyp:cc', '../../net/net.gyp:net', diff --git a/android_webview/renderer/aw_render_view_ext.cc b/android_webview/renderer/aw_render_view_ext.cc index 27a72420bd..c72db2e897 100644 --- a/android_webview/renderer/aw_render_view_ext.cc +++ b/android_webview/renderer/aw_render_view_ext.cc @@ -192,6 +192,11 @@ void AwRenderViewExt::DidCommitProvisionalLoad(WebKit::WebFrame* frame, } } +void AwRenderViewExt::DidActivateCompositor(int input_handler_identifier) { + Send(new AwViewHostMsg_DidActivateAcceleratedCompositing( + routing_id(), input_handler_identifier)); +} + void AwRenderViewExt::DidCommitCompositorFrame() { UpdatePageScaleFactor(); } diff --git a/android_webview/renderer/aw_render_view_ext.h b/android_webview/renderer/aw_render_view_ext.h index 1379913459..448c8007d3 100644 --- a/android_webview/renderer/aw_render_view_ext.h +++ b/android_webview/renderer/aw_render_view_ext.h @@ -36,6 +36,7 @@ class AwRenderViewExt : public content::RenderViewObserver, virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame, bool is_new_navigation) OVERRIDE; virtual void FocusedNodeChanged(const WebKit::WebNode& node) OVERRIDE; + virtual void DidActivateCompositor(int input_handler_identifier) OVERRIDE; virtual void DidCommitCompositorFrame() OVERRIDE; void OnDocumentHasImagesRequest(int id); diff --git a/android_webview/renderer/view_renderer.cc b/android_webview/renderer/view_renderer.cc index ab48906cfe..d44ea12e5f 100644 --- a/android_webview/renderer/view_renderer.cc +++ b/android_webview/renderer/view_renderer.cc @@ -4,8 +4,10 @@ #include "android_webview/renderer/view_renderer.h" +#include "android_webview/common/aw_switches.h" #include "android_webview/common/render_view_messages.h" #include "android_webview/common/renderer_picture_map.h" +#include "base/command_line.h" #include "content/public/renderer/render_view.h" #include "skia/ext/refptr.h" @@ -13,7 +15,10 @@ namespace android_webview { // static void ViewRenderer::RenderViewCreated(content::RenderView* render_view) { - new ViewRenderer(render_view); // |render_view| takes ownership. + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kNoMergeUIAndRendererCompositorThreads)) { + new ViewRenderer(render_view); // |render_view| takes ownership. + } } ViewRenderer::ViewRenderer(content::RenderView* render_view) @@ -40,11 +45,6 @@ bool ViewRenderer::OnMessageReceived(const IPC::Message& message) { return handled; } -void ViewRenderer::DidActivateCompositor(int input_handler_identifier) { - Send(new AwViewHostMsg_DidActivateAcceleratedCompositing( - routing_id(), input_handler_identifier)); -} - void ViewRenderer::DidCommitCompositorFrame() { if (!capture_picture_enabled_) return; diff --git a/android_webview/renderer/view_renderer.h b/android_webview/renderer/view_renderer.h index 39fd75538e..8c4ba8fc5c 100644 --- a/android_webview/renderer/view_renderer.h +++ b/android_webview/renderer/view_renderer.h @@ -24,7 +24,6 @@ class ViewRenderer : public content::RenderViewObserver { // content::RenderViewObserver implementation. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void DidActivateCompositor(int input_handler_identifier) OVERRIDE; virtual void DidCommitCompositorFrame() OVERRIDE; void OnEnableCapturePictureCallback(bool enable); diff --git a/android_webview/tools/third_party_files_whitelist.txt b/android_webview/tools/third_party_files_whitelist.txt index 1f452e0ca2..ba4ed91e4e 100644 --- a/android_webview/tools/third_party_files_whitelist.txt +++ b/android_webview/tools/third_party_files_whitelist.txt @@ -86,6 +86,9 @@ content/browser/renderer_host/web_input_event_aurax11.cc # Copyright Google Inc, no license. Not used on Android. google_update/google_update_idl.idl # String '(c)' used in certificates organization names +net/quic/crypto/common_cert_set_1_50.inc +net/quic/crypto/common_cert_set_51_100.inc +# String '(c)' used in certificates organization names net/test/test_certificate_data.h # Copyright The Chromium Authors and Netscape Communications Corporation; BSD # and (MPL, GPL v2 or LGPL v2) licenses. This third-party code is taken from @@ -171,42 +174,10 @@ ui/gfx/codec/jpeg_codec.cc # This third-party code is taken from Mozilla, but is copyright Google and has # been re-licensed under the Chromium license. ui/gfx/codec/png_codec.cc -# This stuff is the new location for GoogleURL. It is not currently used. -url/gurl.cc -url/gurl.h -url/gurl_test_main.cc -url/url_canon.h -url/url_canon_etc.cc -url/url_canon_filesystemurl.cc -url/url_canon_fileurl.cc -url/url_canon_host.cc -url/url_canon_icu.cc -url/url_canon_icu.h -url/url_canon_internal.cc -url/url_canon_internal.h -url/url_canon_internal_file.h -url/url_canon_ip.cc -url/url_canon_ip.h -url/url_canon_mailtourl.cc -url/url_canon_path.cc -url/url_canon_pathurl.cc -url/url_canon_query.cc -url/url_canon_relative.cc -url/url_canon_stdstring.h -url/url_canon_stdurl.cc -url/url_canon_unittest.cc -url/url_common.h -url/url_file.h +# Copyright Netscape Communications Corporation; MPL, GPL v2 or LGPL v2 +# license. This third-party code is taken from Mozilla, the license for which +# we already pick up from third_party/npapi/. url/url_parse.cc -url/url_parse.h -url/url_parse_file.cc -url/url_parse_internal.h -url/url_parse_unittest.cc -url/url_test_utils.h -url/url_util.cc -url/url_util.h -url/url_util_internal.h -url/url_util_unittest.cc # Copyright The Chromium Authors and Apple Inc; BSD license. This third-party # code is taken from WebKit, the license for which we already pick up from # webkit/. |