1// Copyright (c) 2012 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.
4
5#ifndef CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_DELEGATE_H_
6#define CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_DELEGATE_H_
7
8#include "base/basictypes.h"
9
10namespace content {
11class WebContents;
12}
13
14// Objects implement this interface to get notified about changes in a
15// WebContents and to provide necessary functionality.
16//
17// This is the catch-all interface for holding additions to WebContents that are
18// needed when a WebContents is promoted to being a tab contents, but that
19// don't cleanly fit elsewhere.
20class CoreTabHelperDelegate {
21 public:
22  // The caller is responsible for deleting |old_contents|.
23  // |did_finish_load| is true if WebContentsObserver::DidFinishLoad() has
24  // already been called for |new_contents|.
25  virtual void SwapTabContents(content::WebContents* old_contents,
26                               content::WebContents* new_contents,
27                               bool did_start_load,
28                               bool did_finish_load);
29
30  // Whether the specified WebContents can be reloaded.
31  // Reloading can be disabled e.g. for the DevTools window.
32  virtual bool CanReloadContents(content::WebContents* web_contents) const;
33
34  // Whether the specified WebContents can be saved.
35  // Saving can be disabled e.g. for the DevTools window.
36  virtual bool CanSaveContents(content::WebContents* web_contents) const;
37
38 protected:
39  virtual ~CoreTabHelperDelegate();
40};
41
42#endif  // CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_DELEGATE_H_
43