OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_ |
6 #define CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_ | 6 #define CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 | 10 |
11 class TabContents; | 11 class TabContentsWrapper; |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 class Rect; | 14 class Rect; |
15 } | 15 } |
16 | 16 |
17 // InstantController's delegate. Normally the Browser implements this. See | 17 // InstantController's delegate. Normally the Browser implements this. See |
18 // InstantController for details. | 18 // InstantController for details. |
19 class InstantDelegate { | 19 class InstantDelegate { |
20 public: | 20 public: |
21 // Invoked when instant starts loading, but before the preview tab contents is | 21 // Invoked when instant starts loading, but before the preview tab contents is |
22 // ready to be shown. This may be used to animate between the states. | 22 // ready to be shown. This may be used to animate between the states. |
23 // This is followed by ShowInstant and/or HideInstant. | 23 // This is followed by ShowInstant and/or HideInstant. |
24 virtual void PrepareForInstant() = 0; | 24 virtual void PrepareForInstant() = 0; |
25 | 25 |
26 // Invoked when the instant TabContents should be shown. | 26 // Invoked when the instant TabContents should be shown. |
27 virtual void ShowInstant(TabContents* preview_contents) = 0; | 27 virtual void ShowInstant(TabContentsWrapper* preview_contents) = 0; |
28 | 28 |
29 // Invoked when the instant TabContents should be hidden. | 29 // Invoked when the instant TabContents should be hidden. |
30 virtual void HideInstant() = 0; | 30 virtual void HideInstant() = 0; |
31 | 31 |
32 // Invoked when the user does something that should result in the preview | 32 // Invoked when the user does something that should result in the preview |
33 // TabContents becoming the active TabContents. The delegate takes ownership | 33 // TabContents becoming the active TabContents. The delegate takes ownership |
34 // of the supplied TabContents. | 34 // of the supplied TabContents. |
35 virtual void CommitInstant(TabContents* preview_contents) = 0; | 35 virtual void CommitInstant(TabContentsWrapper* preview_contents) = 0; |
36 | 36 |
37 // Invoked when the suggested text is to change to |text|. | 37 // Invoked when the suggested text is to change to |text|. |
38 virtual void SetSuggestedText(const string16& text) = 0; | 38 virtual void SetSuggestedText(const string16& text) = 0; |
39 | 39 |
40 // Returns the bounds instant will be placed at in screen coordinates. | 40 // Returns the bounds instant will be placed at in screen coordinates. |
41 virtual gfx::Rect GetInstantBounds() = 0; | 41 virtual gfx::Rect GetInstantBounds() = 0; |
42 | 42 |
43 protected: | 43 protected: |
44 virtual ~InstantDelegate() {} | 44 virtual ~InstantDelegate() {} |
45 }; | 45 }; |
46 | 46 |
47 #endif // CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_ | 47 #endif // CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_ |
OLD | NEW |