| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_WEB_VIEW_WEB_VIEW_IMPL_H_ | 5 #ifndef COMPONENTS_WEB_VIEW_WEB_VIEW_IMPL_H_ |
| 6 #define COMPONENTS_WEB_VIEW_WEB_VIEW_IMPL_H_ | 6 #define COMPONENTS_WEB_VIEW_WEB_VIEW_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "components/mus/public/cpp/window_observer.h" | 15 #include "components/mus/public/cpp/window_observer.h" |
| 16 #include "components/mus/public/cpp/window_tree_delegate.h" | 16 #include "components/mus/public/cpp/window_tree_delegate.h" |
| 17 #include "components/web_view/find_controller.h" | 17 #include "components/web_view/find_controller.h" |
| 18 #include "components/web_view/find_controller_delegate.h" | 18 #include "components/web_view/find_controller_delegate.h" |
| 19 #include "components/web_view/frame_devtools_agent_delegate.h" | 19 #include "components/web_view/frame_devtools_agent_delegate.h" |
| 20 #include "components/web_view/frame_tree_delegate.h" | 20 #include "components/web_view/frame_tree_delegate.h" |
| 21 #include "components/web_view/navigation_controller.h" | 21 #include "components/web_view/navigation_controller.h" |
| 22 #include "components/web_view/navigation_controller_delegate.h" | 22 #include "components/web_view/navigation_controller_delegate.h" |
| 23 #include "components/web_view/public/interfaces/frame.mojom.h" | 23 #include "components/web_view/public/interfaces/frame.mojom.h" |
| 24 #include "components/web_view/public/interfaces/web_view.mojom.h" | 24 #include "components/web_view/public/interfaces/web_view.mojom.h" |
| 25 #include "mojo/public/cpp/bindings/strong_binding.h" | 25 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 26 | 26 |
| 27 namespace mojo { | 27 namespace mojo { |
| 28 class ApplicationImpl; | 28 class Shell; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace web_view { | 31 namespace web_view { |
| 32 | 32 |
| 33 class Frame; | 33 class Frame; |
| 34 class FrameDevToolsAgent; | 34 class FrameDevToolsAgent; |
| 35 class FrameTree; | 35 class FrameTree; |
| 36 class PendingWebViewLoad; | 36 class PendingWebViewLoad; |
| 37 class URLRequestCloneable; | 37 class URLRequestCloneable; |
| 38 | 38 |
| 39 namespace mojom { | 39 namespace mojom { |
| 40 class HTMLMessageEvent; | 40 class HTMLMessageEvent; |
| 41 } | 41 } |
| 42 | 42 |
| 43 class WebViewImpl : public mojom::WebView, | 43 class WebViewImpl : public mojom::WebView, |
| 44 public mus::WindowTreeDelegate, | 44 public mus::WindowTreeDelegate, |
| 45 public mus::WindowObserver, | 45 public mus::WindowObserver, |
| 46 public FrameTreeDelegate, | 46 public FrameTreeDelegate, |
| 47 public FrameDevToolsAgentDelegate, | 47 public FrameDevToolsAgentDelegate, |
| 48 public NavigationControllerDelegate, | 48 public NavigationControllerDelegate, |
| 49 public FindControllerDelegate { | 49 public FindControllerDelegate { |
| 50 public: | 50 public: |
| 51 WebViewImpl(mojo::ApplicationImpl* app, | 51 WebViewImpl(mojo::Shell* shell, |
| 52 mojom::WebViewClientPtr client, | 52 mojom::WebViewClientPtr client, |
| 53 mojo::InterfaceRequest<WebView> request); | 53 mojo::InterfaceRequest<WebView> request); |
| 54 ~WebViewImpl() override; | 54 ~WebViewImpl() override; |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 friend class PendingWebViewLoad; | 57 friend class PendingWebViewLoad; |
| 58 | 58 |
| 59 // See description above |pending_load_| for details. | 59 // See description above |pending_load_| for details. |
| 60 void OnLoad(const GURL& pending_url); | 60 void OnLoad(const GURL& pending_url); |
| 61 | 61 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 void HandlePageNavigateRequest(const GURL& url) override; | 109 void HandlePageNavigateRequest(const GURL& url) override; |
| 110 | 110 |
| 111 // Overridden from NavigationControllerDelegate: | 111 // Overridden from NavigationControllerDelegate: |
| 112 void OnNavigate(mojo::URLRequestPtr request) override; | 112 void OnNavigate(mojo::URLRequestPtr request) override; |
| 113 void OnDidNavigate() override; | 113 void OnDidNavigate() override; |
| 114 | 114 |
| 115 // Overridden from FindControllerDelegate: | 115 // Overridden from FindControllerDelegate: |
| 116 std::vector<Frame*> GetAllFrames() override; | 116 std::vector<Frame*> GetAllFrames() override; |
| 117 mojom::WebViewClient* GetWebViewClient() override; | 117 mojom::WebViewClient* GetWebViewClient() override; |
| 118 | 118 |
| 119 mojo::ApplicationImpl* app_; | 119 mojo::Shell* shell_; |
| 120 mojom::WebViewClientPtr client_; | 120 mojom::WebViewClientPtr client_; |
| 121 mojo::StrongBinding<WebView> binding_; | 121 mojo::StrongBinding<WebView> binding_; |
| 122 mus::Window* root_; | 122 mus::Window* root_; |
| 123 mus::Window* content_; | 123 mus::Window* content_; |
| 124 // |find_controller_| is referenced by frame_tree_'s frames at destruction. | 124 // |find_controller_| is referenced by frame_tree_'s frames at destruction. |
| 125 FindController find_controller_; | 125 FindController find_controller_; |
| 126 scoped_ptr<FrameTree> frame_tree_; | 126 scoped_ptr<FrameTree> frame_tree_; |
| 127 | 127 |
| 128 // When LoadRequest() is called a PendingWebViewLoad is created to wait for | 128 // When LoadRequest() is called a PendingWebViewLoad is created to wait for |
| 129 // state needed to process the request. When the state is obtained OnLoad() | 129 // state needed to process the request. When the state is obtained OnLoad() |
| 130 // is invoked. | 130 // is invoked. |
| 131 scoped_ptr<PendingWebViewLoad> pending_load_; | 131 scoped_ptr<PendingWebViewLoad> pending_load_; |
| 132 | 132 |
| 133 scoped_ptr<FrameDevToolsAgent> devtools_agent_; | 133 scoped_ptr<FrameDevToolsAgent> devtools_agent_; |
| 134 | 134 |
| 135 NavigationController navigation_controller_; | 135 NavigationController navigation_controller_; |
| 136 | 136 |
| 137 DISALLOW_COPY_AND_ASSIGN(WebViewImpl); | 137 DISALLOW_COPY_AND_ASSIGN(WebViewImpl); |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 } // namespace web_view | 140 } // namespace web_view |
| 141 | 141 |
| 142 #endif // COMPONENTS_WEB_VIEW_WEB_VIEW_IMPL_H_ | 142 #endif // COMPONENTS_WEB_VIEW_WEB_VIEW_IMPL_H_ |
| OLD | NEW |