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.
5 #ifndef MANDOLINE_TAB_FRAME_TREE_DELEGATE_H_
6 #define MANDOLINE_TAB_FRAME_TREE_DELEGATE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "components/view_manager/public/interfaces/view_tree.mojom.h"
10 #include "mandoline/tab/public/interfaces/frame_tree.mojom.h"
11 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
17 class HTMLMessageEvent
;
19 class FrameTreeDelegate
{
21 // Returns whether a request to post a message from |source| to |target|
22 // is allowed. |source| and |target| are never null.
23 virtual bool CanPostMessageEventToFrame(const Frame
* source
,
25 HTMLMessageEvent
* event
) = 0;
27 virtual void LoadingStateChanged(bool loading
) = 0;
28 virtual void ProgressChanged(double progress
) = 0;
30 // |source| is requesting a navigation. If |target_type| is
31 // |EXISTING_FRAME| then |target_frame| identifies the frame to perform the
32 // navigation in, otherwise |target_frame| is not used. |target_frame| may
33 // be null, even for |EXISTING_FRAME|.
34 // TODO(sky): this needs to distinguish between navigate in source, vs new
35 // background tab, vs new foreground tab.
36 virtual void NavigateTopLevel(Frame
* source
, mojo::URLRequestPtr request
) = 0;
38 // Returns true if |target| can navigation to |request|. If the navigation is
39 // allowed the client should set the arguments appropriately.
40 virtual bool CanNavigateFrame(
42 mojo::URLRequestPtr request
,
43 FrameTreeClient
** frame_tree_client
,
44 scoped_ptr
<FrameUserData
>* frame_user_data
,
45 mojo::ViewTreeClientPtr
* view_tree_client
) = 0;
47 // Invoked when a navigation in |frame| has been initiated.
48 virtual void DidStartNavigation(Frame
* frame
) = 0;
51 virtual ~FrameTreeDelegate() {}
54 } // namespace mandoline
56 #endif // MANDOLINE_TAB_FRAME_TREE_DELEGATE_H_