aw_render_view_ext.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ANDROID_WEBVIEW_RENDERER_AW_RENDER_VIEW_EXT_H_
  5. #define ANDROID_WEBVIEW_RENDERER_AW_RENDER_VIEW_EXT_H_
  6. #include "base/timer/timer.h"
  7. #include "third_party/blink/public/web/web_view_observer.h"
  8. #include "ui/gfx/geometry/size.h"
  9. namespace android_webview {
  10. // NOTE: We should not add more things to RenderView and related classes.
  11. // RenderView is deprecated in content, since it is not compatible
  12. // with site isolation/out of process iframes.
  13. // Render process side of AwRenderViewHostExt, this provides cross-process
  14. // implementation of miscellaneous WebView functions that we need to poke
  15. // WebKit directly to implement (and that aren't needed in the chrome app).
  16. class AwRenderViewExt : public blink::WebViewObserver {
  17. public:
  18. AwRenderViewExt(const AwRenderViewExt&) = delete;
  19. AwRenderViewExt& operator=(const AwRenderViewExt&) = delete;
  20. static void WebViewCreated(blink::WebView* web_view,
  21. bool created_by_renderer);
  22. static AwRenderViewExt* FromWebView(blink::WebView* web_view);
  23. bool created_by_renderer() { return created_by_renderer_; }
  24. private:
  25. AwRenderViewExt(blink::WebView* web_view, bool created_by_renderer);
  26. ~AwRenderViewExt() override;
  27. // blink::WebViewObserver overrides.
  28. void DidCommitCompositorFrame() override;
  29. void DidUpdateMainFrameLayout() override;
  30. void OnDestruct() override;
  31. void UpdateContentsSize();
  32. gfx::Size last_sent_contents_size_;
  33. // Whether the contents size may have changed and |UpdateContentsSize| needs
  34. // to be called.
  35. bool needs_contents_size_update_ = true;
  36. bool created_by_renderer_;
  37. };
  38. } // namespace android_webview
  39. #endif // ANDROID_WEBVIEW_RENDERER_AW_RENDER_VIEW_EXT_H_