15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_DELEGATE_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_DELEGATE_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h"
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content {
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class WebContents;
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Objects implement this interface to get notified about changes in a
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// WebContents and to provide necessary functionality.
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This is the catch-all interface for holding additions to WebContents that are
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// needed when a WebContents is promoted to being a tab contents, but that
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// don't cleanly fit elsewhere.
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class CoreTabHelperDelegate {
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The caller is responsible for deleting |old_contents|.
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // |did_finish_load| is true if WebContentsObserver::DidFinishLoad() has
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // already been called for |new_contents|.
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SwapTabContents(content::WebContents* old_contents,
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                               content::WebContents* new_contents,
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                               bool did_start_load,
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                               bool did_finish_load);
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Whether the specified WebContents can be reloaded.
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Reloading can be disabled e.g. for the DevTools window.
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanReloadContents(content::WebContents* web_contents) const;
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Whether the specified WebContents can be saved.
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Saving can be disabled e.g. for the DevTools window.
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanSaveContents(content::WebContents* web_contents) const;
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected:
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~CoreTabHelperDelegate();
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_DELEGATE_H_
43