Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / web / web_state / web_state_facade_delegate.h
blobcf407d7d839f845820c9bf3bf83734959c9ee1b4
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_
8 class GURL;
10 namespace base {
11 class ListValue;
14 namespace content {
15 class WebContents;
18 namespace web {
20 class WebStateImpl;
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 {
27 public:
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
46 // embedder).
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;
58 } // namespace web
60 #endif // IOS_WEB_WEB_STATE_WEB_STATE_FACADE_DELEGATE_H_