1 // Copyright 2014 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 COMPONENTS_VIEW_MANAGER_SERVER_VIEW_DELEGATE_H_
6 #define COMPONENTS_VIEW_MANAGER_SERVER_VIEW_DELEGATE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "components/view_manager/public/interfaces/compositor_frame.mojom.h"
10 #include "components/view_manager/public/interfaces/view_manager_constants.mojom.h"
13 class CompositorFrame
;
21 class ViewportMetrics
;
28 namespace view_manager
{
32 // ServerViewDelegate is notified at key points in the lifetime of a
33 // ServerView. Some of the functions are similar to that of
34 // ServerViewObserver. For example, ServerViewDelegate::PrepareToDestroyView()
35 // and ServerViewObserver::OnWillDestroyView(). The key difference between
36 // the two are the ServerViewDelegate ones are always notified first, and
37 // ServerViewDelegate gets non-const arguments.
38 class ServerViewDelegate
{
40 virtual scoped_ptr
<cc::CompositorFrame
> UpdateViewTreeFromCompositorFrame(
41 const mojo::CompositorFramePtr
& input
) = 0;
43 virtual surfaces::SurfacesState
* GetSurfacesState() = 0;
45 // Invoked when a view is about to be destroyed; before any of the children
46 // have been removed and before the view has been removed from its parent.
47 virtual void PrepareToDestroyView(ServerView
* view
) = 0;
49 virtual void PrepareToChangeViewHierarchy(ServerView
* view
,
50 ServerView
* new_parent
,
51 ServerView
* old_parent
) = 0;
53 virtual void PrepareToChangeViewVisibility(ServerView
* view
) = 0;
55 virtual void OnScheduleViewPaint(const ServerView
* view
) = 0;
57 // Returns the root of the view tree to which this |view| is attached. Returns
58 // null if this view is not attached up through to a root view.
59 virtual const ServerView
* GetRootView(const ServerView
* view
) const = 0;
62 virtual ~ServerViewDelegate() {}
65 } // namespace view_manager
67 #endif // COMPONENTS_VIEW_MANAGER_SERVER_VIEW_DELEGATE_H_