| 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_FRAME_CONNECTION_H_ | 5 #ifndef COMPONENTS_WEB_VIEW_FRAME_CONNECTION_H_ |
| 6 #define COMPONENTS_WEB_VIEW_FRAME_CONNECTION_H_ | 6 #define COMPONENTS_WEB_VIEW_FRAME_CONNECTION_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "components/mus/public/interfaces/window_tree.mojom.h" | 13 #include "components/mus/public/interfaces/window_tree.mojom.h" |
| 14 #include "components/web_view/frame_tree_delegate.h" | 14 #include "components/web_view/frame_tree_delegate.h" |
| 15 #include "components/web_view/frame_user_data.h" | 15 #include "components/web_view/frame_user_data.h" |
| 16 #include "components/web_view/public/interfaces/frame.mojom.h" | 16 #include "components/web_view/public/interfaces/frame.mojom.h" |
| 17 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 17 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
| 18 | 18 |
| 19 namespace mojo { | 19 namespace mojo { |
| 20 class ApplicationConnection; | 20 class ApplicationConnection; |
| 21 class ApplicationImpl; | 21 class Shell; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace web_view { | 24 namespace web_view { |
| 25 | 25 |
| 26 class Frame; | 26 class Frame; |
| 27 | 27 |
| 28 // FrameConnection is a FrameUserData that manages the connection to a | 28 // FrameConnection is a FrameUserData that manages the connection to a |
| 29 // particular frame. It is also responsible for obtaining the necessary | 29 // particular frame. It is also responsible for obtaining the necessary |
| 30 // services from the remote side. | 30 // services from the remote side. |
| 31 class FrameConnection : public FrameUserData { | 31 class FrameConnection : public FrameUserData { |
| 32 public: | 32 public: |
| 33 FrameConnection(); | 33 FrameConnection(); |
| 34 ~FrameConnection() override; | 34 ~FrameConnection() override; |
| 35 | 35 |
| 36 // Creates a FrameConnection to service a call from | 36 // Creates a FrameConnection to service a call from |
| 37 // FrameTreeDelegate::CanNavigateFrame(). |callback| is run once the | 37 // FrameTreeDelegate::CanNavigateFrame(). |callback| is run once the |
| 38 // content handler id for the app is determined. | 38 // content handler id for the app is determined. |
| 39 static void CreateConnectionForCanNavigateFrame( | 39 static void CreateConnectionForCanNavigateFrame( |
| 40 mojo::ApplicationImpl* app, | 40 mojo::Shell* shell, |
| 41 Frame* frame, | 41 Frame* frame, |
| 42 mojo::URLRequestPtr request, | 42 mojo::URLRequestPtr request, |
| 43 const FrameTreeDelegate::CanNavigateFrameCallback& callback); | 43 const FrameTreeDelegate::CanNavigateFrameCallback& callback); |
| 44 | 44 |
| 45 // Initializes the FrameConnection with the specified parameters. | 45 // Initializes the FrameConnection with the specified parameters. |
| 46 // |on_got_id_callback| is run once the content handler is obtained from | 46 // |on_got_id_callback| is run once the content handler is obtained from |
| 47 // the connection. | 47 // the connection. |
| 48 void Init(mojo::ApplicationImpl* app, | 48 void Init(mojo::Shell* shell, |
| 49 mojo::URLRequestPtr request, | 49 mojo::URLRequestPtr request, |
| 50 const base::Closure& on_got_id_callback); | 50 const base::Closure& on_got_id_callback); |
| 51 | 51 |
| 52 mojom::FrameClient* frame_client() { return frame_client_.get(); } | 52 mojom::FrameClient* frame_client() { return frame_client_.get(); } |
| 53 | 53 |
| 54 mojo::ApplicationConnection* application_connection() { | 54 mojo::ApplicationConnection* application_connection() { |
| 55 return application_connection_.get(); | 55 return application_connection_.get(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 // Asks the remote application for a WindowTreeClient. | 58 // Asks the remote application for a WindowTreeClient. |
| 59 mus::mojom::WindowTreeClientPtr GetWindowTreeClient(); | 59 mus::mojom::WindowTreeClientPtr GetWindowTreeClient(); |
| 60 | 60 |
| 61 // Returns the id of the content handler app. Only available once the callback | 61 // Returns the id of the content handler app. Only available once the callback |
| 62 // has run. | 62 // has run. |
| 63 uint32_t GetContentHandlerID() const; | 63 uint32_t GetContentHandlerID() const; |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 mojom::FrameClientPtr frame_client_; | 66 mojom::FrameClientPtr frame_client_; |
| 67 | 67 |
| 68 scoped_ptr<mojo::ApplicationConnection> application_connection_; | 68 scoped_ptr<mojo::ApplicationConnection> application_connection_; |
| 69 | 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(FrameConnection); | 70 DISALLOW_COPY_AND_ASSIGN(FrameConnection); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 } // namespace web_view | 73 } // namespace web_view |
| 74 | 74 |
| 75 #endif // COMPONENTS_WEB_VIEW_FRAME_CONNECTION_H_ | 75 #endif // COMPONENTS_WEB_VIEW_FRAME_CONNECTION_H_ |
| OLD | NEW |