summaryrefslogtreecommitdiffstats
path: root/chrome/browser/instant/instant_delegate.h
blob: 2f09c25b40ab871ec590fcf1285469782e489d74 (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
// 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_DELEGATE_H_
#define CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_
#pragma once

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

class TabContentsWrapper;

namespace gfx {
class Rect;
}

// InstantController's delegate. Normally the Browser implements this. See
// InstantController for details.
class InstantDelegate {
 public:
  // Invoked when the instant TabContentsWrapper should be shown.
  virtual void ShowInstant(TabContentsWrapper* preview_contents) = 0;

  // Invoked when the instant TabContentsWrapper should be hidden.
  virtual void HideInstant() = 0;

  // Invoked when the user does something that should result in the preview
  // TabContentsWrapper becoming the active TabContentsWrapper. The delegate
  // takes ownership of the supplied TabContentsWrapper.
  virtual void CommitInstant(TabContentsWrapper* preview_contents) = 0;

  // Invoked when the suggested text is to change to |text|.
  virtual void SetSuggestedText(const string16& text,
                                InstantCompleteBehavior behavior) = 0;

  // Returns the bounds instant will be placed at in screen coordinates.
  virtual gfx::Rect GetInstantBounds() = 0;

  // Invoked when the WebContents becomes focused.
  virtual void InstantPreviewFocused() = 0;

 protected:
  virtual ~InstantDelegate() {}
};

#endif  // CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_