| 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_HTML_VIEWER_FRAME_TREE_MANAGER_H_ | 5 #ifndef COMPONENTS_HTML_VIEWER_FRAME_TREE_MANAGER_H_ |
| 6 #define COMPONENTS_HTML_VIEWER_FRAME_TREE_MANAGER_H_ | 6 #define COMPONENTS_HTML_VIEWER_FRAME_TREE_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "mandoline/services/navigation/public/interfaces/navigation.mojom.h" | 10 #include "mandoline/services/navigation/public/interfaces/navigation.mojom.h" |
| 11 #include "mandoline/tab/public/interfaces/frame_tree.mojom.h" | 11 #include "mandoline/tab/public/interfaces/frame_tree.mojom.h" |
| 12 #include "mojo/application/public/cpp/lazy_interface_ptr.h" | 12 #include "mojo/application/public/cpp/lazy_interface_ptr.h" |
| 13 #include "third_party/WebKit/public/web/WebFrameClient.h" | 13 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 14 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 14 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 class WebFrame; | 17 class WebFrame; |
| 18 class WebFrameClient; | 18 class WebFrameClient; |
| 19 class WebLocalFrame; | 19 class WebLocalFrame; |
| 20 class WebRemoteFrameClient; | 20 class WebRemoteFrameClient; |
| 21 class WebString; |
| 21 class WebView; | 22 class WebView; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace gfx { | 25 namespace gfx { |
| 25 class Size; | 26 class Size; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace mojo { | 29 namespace mojo { |
| 29 class ApplicationConnection; | 30 class ApplicationConnection; |
| 30 class ApplicationImpl; | 31 class ApplicationImpl; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 69 |
| 69 blink::WebView* GetWebView(); | 70 blink::WebView* GetWebView(); |
| 70 | 71 |
| 71 void LoadingStarted(); | 72 void LoadingStarted(); |
| 72 void LoadingStopped(); | 73 void LoadingStopped(); |
| 73 void ProgressChanged(double progress); | 74 void ProgressChanged(double progress); |
| 74 | 75 |
| 75 private: | 76 private: |
| 76 friend class Frame; | 77 friend class Frame; |
| 77 | 78 |
| 78 // Recursively calls Init() on |frame| and it's children. | |
| 79 void InitFrames(mojo::View* local_view, Frame* frame); | |
| 80 | |
| 81 // Returns the navigation policy for the specified frame. | 79 // Returns the navigation policy for the specified frame. |
| 82 blink::WebNavigationPolicy DecidePolicyForNavigation( | 80 blink::WebNavigationPolicy DecidePolicyForNavigation( |
| 83 Frame* frame, | 81 Frame* frame, |
| 84 const blink::WebFrameClient::NavigationPolicyInfo& info); | 82 const blink::WebFrameClient::NavigationPolicyInfo& info); |
| 85 | 83 |
| 86 // Invoked when a Frame finishes loading. | 84 // Invoked when a Frame finishes loading. |
| 87 void OnFrameDidFinishLoad(Frame* frame); | 85 void OnFrameDidFinishLoad(Frame* frame); |
| 88 | 86 |
| 89 // Invoked when a Frame navigates. | 87 // Invoked when a Frame navigates. |
| 90 void OnFrameDidNavigateLocally(Frame* frame, const std::string& url); | 88 void OnFrameDidNavigateLocally(Frame* frame, const std::string& url); |
| 91 | 89 |
| 92 // Invoked when a Frame is destroye. | 90 // Invoked when a Frame is destroye. |
| 93 void OnFrameDestroyed(Frame* frame); | 91 void OnFrameDestroyed(Frame* frame); |
| 94 | 92 |
| 93 // Invoked when the name of a frame changes. |
| 94 void OnFrameDidChangeName(Frame* frame, const blink::WebString& name); |
| 95 |
| 95 // mandoline::FrameTreeClient: | 96 // mandoline::FrameTreeClient: |
| 96 void OnConnect(mandoline::FrameTreeServerPtr server, | 97 void OnConnect(mandoline::FrameTreeServerPtr server, |
| 97 mojo::Array<mandoline::FrameDataPtr> frame_data) override; | 98 mojo::Array<mandoline::FrameDataPtr> frame_data) override; |
| 98 void OnFrameAdded(mandoline::FrameDataPtr frame_data) override; | 99 void OnFrameAdded(mandoline::FrameDataPtr frame_data) override; |
| 99 void OnFrameRemoved(uint32_t frame_id) override; | 100 void OnFrameRemoved(uint32_t frame_id) override; |
| 101 void OnFrameNameChanged(uint32_t frame_id, const mojo::String& name) override; |
| 100 | 102 |
| 101 GlobalState* global_state_; | 103 GlobalState* global_state_; |
| 102 | 104 |
| 103 mojo::ApplicationImpl* app_; | 105 mojo::ApplicationImpl* app_; |
| 104 | 106 |
| 105 FrameTreeManagerDelegate* delegate_; | 107 FrameTreeManagerDelegate* delegate_; |
| 106 | 108 |
| 107 // Frame id of the frame we're rendering to. | 109 // Frame id of the frame we're rendering to. |
| 108 const uint32_t local_frame_id_; | 110 const uint32_t local_frame_id_; |
| 109 | 111 |
| 110 mandoline::FrameTreeServerPtr server_; | 112 mandoline::FrameTreeServerPtr server_; |
| 111 | 113 |
| 112 mojo::LazyInterfacePtr<mojo::NavigatorHost> navigator_host_; | 114 mojo::LazyInterfacePtr<mojo::NavigatorHost> navigator_host_; |
| 113 | 115 |
| 114 Frame* root_; | 116 Frame* root_; |
| 115 | 117 |
| 116 DISALLOW_COPY_AND_ASSIGN(FrameTreeManager); | 118 DISALLOW_COPY_AND_ASSIGN(FrameTreeManager); |
| 117 }; | 119 }; |
| 118 | 120 |
| 119 } // namespace html_viewer | 121 } // namespace html_viewer |
| 120 | 122 |
| 121 #endif // COMPONENTS_HTML_VIEWER_FRAME_TREE_MANAGER_H_ | 123 #endif // COMPONENTS_HTML_VIEWER_FRAME_TREE_MANAGER_H_ |
| OLD | NEW |