1// Copyright (c) 2011 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_INSTANT_INSTANT_LOADER_DELEGATE_H_
6#define CHROME_BROWSER_INSTANT_INSTANT_LOADER_DELEGATE_H_
7#pragma once
8
9#include "base/string16.h"
10#include "chrome/common/instant_types.h"
11
12class GURL;
13
14namespace gfx {
15class Rect;
16}
17
18class InstantLoader;
19
20// InstantLoader's delegate. This interface is implemented by InstantController.
21class InstantLoaderDelegate {
22 public:
23  // Invoked when the status (either http_status_ok or ready) has changed.
24  virtual void InstantStatusChanged(InstantLoader* loader) = 0;
25
26  // Invoked when the loader has suggested text.
27  virtual void SetSuggestedTextFor(
28      InstantLoader* loader,
29      const string16& text,
30      InstantCompleteBehavior behavior) = 0;
31
32  // Returns the bounds of instant.
33  virtual gfx::Rect GetInstantBounds() = 0;
34
35  // Returns true if instant should be committed on mouse up.
36  virtual bool ShouldCommitInstantOnMouseUp() = 0;
37
38  // Invoked when the the loader should be committed.
39  virtual void CommitInstantLoader(InstantLoader* loader) = 0;
40
41  // Invoked if the loader was created with the intention that the site supports
42  // instant, but it turned out the site doesn't support instant.
43  virtual void InstantLoaderDoesntSupportInstant(InstantLoader* loader) = 0;
44
45  // Adds the specified url to the set of urls instant won't prefetch for.
46  virtual void AddToBlacklist(InstantLoader* loader, const GURL& url) = 0;
47
48 protected:
49  virtual ~InstantLoaderDelegate() {}
50};
51
52#endif  // CHROME_BROWSER_INSTANT_INSTANT_LOADER_DELEGATE_H_
53