| Index: ios/web/web_state/web_state_impl.mm
|
| diff --git a/ios/web/web_state/web_state_impl.mm b/ios/web/web_state/web_state_impl.mm
|
| index d97350851810f6889e1ba88ab226ba6a2bf222e3..15ff908506fcb4b21db88f150f92bea82c4d8cfa 100644
|
| --- a/ios/web/web_state/web_state_impl.mm
|
| +++ b/ios/web/web_state/web_state_impl.mm
|
| @@ -7,10 +7,12 @@
|
| #include <stddef.h>
|
| #include <stdint.h>
|
|
|
| +#include "base/bind.h"
|
| #include "base/logging.h"
|
| #include "base/memory/ptr_util.h"
|
| #include "base/metrics/histogram_macros.h"
|
| #include "base/strings/sys_string_conversions.h"
|
| +#include "base/threading/sequenced_task_runner_handle.h"
|
| #import "ios/web/interstitials/web_interstitial_impl.h"
|
| #import "ios/web/navigation/crw_session_controller.h"
|
| #import "ios/web/navigation/legacy_navigation_manager_impl.h"
|
| @@ -38,6 +40,7 @@
|
| #include "ios/web/webui/web_ui_ios_controller_factory_registry.h"
|
| #include "ios/web/webui/web_ui_ios_impl.h"
|
| #include "net/http/http_response_headers.h"
|
| +#include "ui/gfx/image/image.h"
|
|
|
| namespace web {
|
|
|
| @@ -672,6 +675,19 @@ bool WebStateImpl::HasOpener() const {
|
| return created_with_opener_;
|
| }
|
|
|
| +void WebStateImpl::TakeSnapshot(const SnapshotCallback& callback) const {
|
| + UIView* view = [web_controller_ view];
|
| + UIImage* snapshot = nil;
|
| + if (view && !CGRectIsEmpty(view.bounds)) {
|
| + UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, 0);
|
| + [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO];
|
| + snapshot = UIGraphicsGetImageFromCurrentImageContext();
|
| + UIGraphicsEndImageContext();
|
| + }
|
| + base::SequencedTaskRunnerHandle::Get()->PostTask(
|
| + FROM_HERE, base::Bind(callback, gfx::Image(snapshot)));
|
| +}
|
| +
|
| void WebStateImpl::OnNavigationStarted(web::NavigationContext* context) {
|
| for (auto& observer : observers_)
|
| observer.DidStartNavigation(context);
|
|
|