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