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 TabContents; |
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 |
| 22 // ready to be shown. This may be used to animate between the states. |
| 23 // This is followed by ShowInstant and/or HideInstant. |
| 24 virtual void PrepareForInstant() = 0; |
| 25 |
21 // Invoked when the instant TabContents should be shown. | 26 // Invoked when the instant TabContents should be shown. |
22 virtual void ShowInstant(TabContents* preview_contents) = 0; | 27 virtual void ShowInstant(TabContents* preview_contents) = 0; |
23 | 28 |
24 // Invoked when the instant TabContents should be hidden. | 29 // Invoked when the instant TabContents should be hidden. |
25 virtual void HideInstant() = 0; | 30 virtual void HideInstant() = 0; |
26 | 31 |
27 // 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 |
28 // TabContents becoming the active TabContents. The delegate takes ownership | 33 // TabContents becoming the active TabContents. The delegate takes ownership |
29 // of the supplied TabContents. | 34 // of the supplied TabContents. |
30 virtual void CommitInstant(TabContents* preview_contents) = 0; | 35 virtual void CommitInstant(TabContents* preview_contents) = 0; |
31 | 36 |
32 // Invoked when the suggested text is to change to |text|. | 37 // Invoked when the suggested text is to change to |text|. |
33 virtual void SetSuggestedText(const string16& text) = 0; | 38 virtual void SetSuggestedText(const string16& text) = 0; |
34 | 39 |
35 // Returns the bounds instant will be placed at in screen coordinates. | 40 // Returns the bounds instant will be placed at in screen coordinates. |
36 virtual gfx::Rect GetInstantBounds() = 0; | 41 virtual gfx::Rect GetInstantBounds() = 0; |
37 | 42 |
38 protected: | 43 protected: |
39 virtual ~InstantDelegate() {} | 44 virtual ~InstantDelegate() {} |
40 }; | 45 }; |
41 | 46 |
42 #endif // CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_ | 47 #endif // CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_ |
OLD | NEW |