summaryrefslogtreecommitdiffstats
path: root/chrome/browser/instant/instant_loader_delegate.h
blob: 8fbd1f9d143329690e545f18dd5b41a973f1e6ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_INSTANT_INSTANT_LOADER_DELEGATE_H_
#define CHROME_BROWSER_INSTANT_INSTANT_LOADER_DELEGATE_H_

#include <vector>

#include "base/string16.h"
#include "chrome/common/instant_types.h"

class InstantLoader;

// InstantLoader calls these methods on its delegate (InstantController)
// to notify it of interesting events happening on the Instant preview.
class InstantLoaderDelegate {
 public:
  // Invoked when the loader has suggested text.
  virtual void SetSuggestions(
      InstantLoader* loader,
      const std::vector<string16>& suggestions,
      InstantCompleteBehavior behavior) = 0;

  // Commit the preview.
  virtual void CommitInstantLoader(InstantLoader* loader) = 0;

  // Notification that the first page load (of the Instant URL) completed.
  virtual void InstantLoaderPreviewLoaded(InstantLoader* loader) = 0;

  // Notification when the loader has determined whether or not the page
  // supports the Instant API.
  virtual void InstantSupportDetermined(InstantLoader* loader,
                                        bool supports_instant) = 0;

  // Notification that the loader swapped a different TabContents into the
  // preview, usually because a prerendered page was navigated to.
  virtual void SwappedTabContents(InstantLoader* loader) = 0;

  // Notification that the preview gained focus, usually due to the user
  // clicking on it.
  virtual void InstantLoaderContentsFocused(InstantLoader* loader) = 0;

 protected:
  virtual ~InstantLoaderDelegate() {}
};

#endif  // CHROME_BROWSER_INSTANT_INSTANT_LOADER_DELEGATE_H_