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_TREE_DELEGATE_H_ | 5 #ifndef COMPONENTS_WEB_VIEW_FRAME_TREE_DELEGATE_H_ |
6 #define COMPONENTS_WEB_VIEW_FRAME_TREE_DELEGATE_H_ | 6 #define COMPONENTS_WEB_VIEW_FRAME_TREE_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "components/mus/public/interfaces/view_tree.mojom.h" | 12 #include "components/mus/public/interfaces/view_tree.mojom.h" |
13 #include "components/web_view/public/interfaces/frame_tree.mojom.h" | 13 #include "components/web_view/public/interfaces/frame.mojom.h" |
14 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 14 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
15 | 15 |
16 namespace web_view { | 16 namespace web_view { |
17 | 17 |
18 class Frame; | 18 class Frame; |
19 class FrameUserData; | 19 class FrameUserData; |
| 20 |
| 21 namespace mojom { |
20 class HTMLMessageEvent; | 22 class HTMLMessageEvent; |
| 23 } |
21 | 24 |
22 class FrameTreeDelegate { | 25 class FrameTreeDelegate { |
23 public: | 26 public: |
24 // Callback from CanNavigateFrame(). The uint32_t is the id of the app the | 27 // Callback from CanNavigateFrame(). The uint32_t is the id of the app the |
25 // FrameTreeClient comes from; typically the content handler id. | 28 // FrameClient comes from; typically the content handler id. |
26 using CanNavigateFrameCallback = | 29 using CanNavigateFrameCallback = |
27 base::Callback<void(uint32_t, | 30 base::Callback<void(uint32_t, |
28 FrameTreeClient*, | 31 mojom::FrameClient*, |
29 scoped_ptr<FrameUserData>, | 32 scoped_ptr<FrameUserData>, |
30 mojo::ViewTreeClientPtr)>; | 33 mojo::ViewTreeClientPtr)>; |
31 | 34 |
32 // Called when a Frame creates a new child Frame. |frame_tree_client| is the | 35 // Called when a Frame creates a new child Frame. |frame_tree_client| is the |
33 // FrameTreeClient for the new frame. | 36 // FrameClient for the new frame. |
34 virtual scoped_ptr<FrameUserData> CreateUserDataForNewFrame( | 37 virtual scoped_ptr<FrameUserData> CreateUserDataForNewFrame( |
35 FrameTreeClientPtr frame_tree_client) = 0; | 38 mojom::FrameClientPtr frame_client) = 0; |
36 | 39 |
37 // Returns whether a request to post a message from |source| to |target| | 40 // Returns whether a request to post a message from |source| to |target| |
38 // is allowed. |source| and |target| are never null. | 41 // is allowed. |source| and |target| are never null. |
39 virtual bool CanPostMessageEventToFrame(const Frame* source, | 42 virtual bool CanPostMessageEventToFrame(const Frame* source, |
40 const Frame* target, | 43 const Frame* target, |
41 HTMLMessageEvent* event) = 0; | 44 mojom::HTMLMessageEvent* event) = 0; |
42 | 45 |
43 virtual void LoadingStateChanged(bool loading, double progress) = 0; | 46 virtual void LoadingStateChanged(bool loading, double progress) = 0; |
44 | 47 |
45 virtual void TitleChanged(const mojo::String& title) = 0; | 48 virtual void TitleChanged(const mojo::String& title) = 0; |
46 | 49 |
47 // |source| is requesting a navigation. If |target_type| is | 50 // |source| is requesting a navigation. If |target_type| is |
48 // |EXISTING_FRAME| then |target_frame| identifies the frame to perform the | 51 // |EXISTING_FRAME| then |target_frame| identifies the frame to perform the |
49 // navigation in, otherwise |target_frame| is not used. |target_frame| may | 52 // navigation in, otherwise |target_frame| is not used. |target_frame| may |
50 // be null, even for |EXISTING_FRAME|. | 53 // be null, even for |EXISTING_FRAME|. |
51 // TODO(sky): this needs to distinguish between navigate in source, vs new | 54 // TODO(sky): this needs to distinguish between navigate in source, vs new |
(...skipping 29 matching lines...) Expand all Loading... |
81 // action. | 84 // action. |
82 virtual void OnViewEmbeddedInFrameDisconnected(Frame* frame); | 85 virtual void OnViewEmbeddedInFrameDisconnected(Frame* frame); |
83 | 86 |
84 protected: | 87 protected: |
85 virtual ~FrameTreeDelegate() {} | 88 virtual ~FrameTreeDelegate() {} |
86 }; | 89 }; |
87 | 90 |
88 } // namespace web_view | 91 } // namespace web_view |
89 | 92 |
90 #endif // COMPONENTS_WEB_VIEW_FRAME_TREE_DELEGATE_H_ | 93 #endif // COMPONENTS_WEB_VIEW_FRAME_TREE_DELEGATE_H_ |
OLD | NEW |