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 IOS_WEB_WEB_STATE_WEB_STATE_FACADE_DELEGATE_H_
6 #define IOS_WEB_WEB_STATE_WEB_STATE_FACADE_DELEGATE_H_
22 // Interface used by WebStates to drive their WebContents facades. This pushes
23 // the ownership of the facade out of the web-layer to simplify upstreaming
24 // efforts. Once upstream features are componentized and use WebState, this
25 // class will no longer be necessary.
26 class WebStateFacadeDelegate
{
28 WebStateFacadeDelegate() {}
29 virtual ~WebStateFacadeDelegate() {}
31 // Sets the WebStateImpl that backs the WebContents facade.
32 virtual void SetWebState(WebStateImpl
* web_state
) = 0;
33 // Returns the facade object being driven by this delegate.
34 virtual content::WebContents
* GetWebContentsFacade() = 0;
36 // Called when the web state's |isLoading| property is changed.
37 virtual void OnLoadingStateChanged() = 0;
38 // Called when the current page has finished loading.
39 virtual void OnPageLoaded() = 0;
41 // TODO(stuartmorgan): Remove this block of methods once all necessary
42 // WebUIs have been converted to the web framework.
43 // Creates a content::WebUI page for the given url, owned by the facade.
44 // This is used to create WebUIs that have not been converted to the web
45 // infrastructure, but are made in the normal way (i.e., not managed by the
47 virtual void CreateLegacyWebUI(const GURL
& url
) = 0;
48 // Clears any current WebUI. Should be called when the page changes.
49 virtual void ClearLegacyWebUI() = 0;
50 // Returns true if there is a legacy WebUI active.
51 virtual bool HasLegacyWebUI() = 0;
52 // Processes a message from a legacy WebUI displayed at the given URL.
53 virtual void ProcessLegacyWebUIMessage(const GURL
& source_url
,
54 const std::string
& message
,
55 const base::ListValue
& args
) = 0;
60 #endif // IOS_WEB_WEB_STATE_WEB_STATE_FACADE_DELEGATE_H_