// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_VIEW_MANAGER_SERVER_VIEW_DELEGATE_H_ #define COMPONENTS_VIEW_MANAGER_SERVER_VIEW_DELEGATE_H_ #include "base/memory/scoped_ptr.h" #include "components/view_manager/public/interfaces/compositor_frame.mojom.h" #include "components/view_manager/public/interfaces/view_manager_constants.mojom.h" namespace cc { class CompositorFrame; } namespace gfx { class Rect; } namespace mojo { class ViewportMetrics; } namespace surfaces { class SurfacesState; } namespace view_manager { class ServerView; // ServerViewDelegate is notified at key points in the lifetime of a // ServerView. Some of the functions are similar to that of // ServerViewObserver. For example, ServerViewDelegate::PrepareToDestroyView() // and ServerViewObserver::OnWillDestroyView(). The key difference between // the two are the ServerViewDelegate ones are always notified first, and // ServerViewDelegate gets non-const arguments. class ServerViewDelegate { public: virtual scoped_ptr UpdateViewTreeFromCompositorFrame( const mojo::CompositorFramePtr& input) = 0; virtual surfaces::SurfacesState* GetSurfacesState() = 0; // Invoked when a view is about to be destroyed; before any of the children // have been removed and before the view has been removed from its parent. virtual void PrepareToDestroyView(ServerView* view) = 0; virtual void PrepareToChangeViewHierarchy(ServerView* view, ServerView* new_parent, ServerView* old_parent) = 0; virtual void PrepareToChangeViewVisibility(ServerView* view) = 0; virtual void OnScheduleViewPaint(const ServerView* view) = 0; // Returns the root of the view tree to which this |view| is attached. Returns // null if this view is not attached up through to a root view. virtual const ServerView* GetRootView(const ServerView* view) const = 0; protected: virtual ~ServerViewDelegate() {} }; } // namespace view_manager #endif // COMPONENTS_VIEW_MANAGER_SERVER_VIEW_DELEGATE_H_