| 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 TabContentsWrapper; | 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(TabContentsWrapper* 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. Instant still may be |
| 30 // active at the time this is invoked. Use |is_active()| to determine if |
| 31 // instant is still active. |
| 30 virtual void HideInstant() = 0; | 32 virtual void HideInstant() = 0; |
| 31 | 33 |
| 32 // Invoked when the user does something that should result in the preview | 34 // Invoked when the user does something that should result in the preview |
| 33 // TabContents becoming the active TabContents. The delegate takes ownership | 35 // TabContents becoming the active TabContents. The delegate takes ownership |
| 34 // of the supplied TabContents. | 36 // of the supplied TabContents. |
| 35 virtual void CommitInstant(TabContentsWrapper* preview_contents) = 0; | 37 virtual void CommitInstant(TabContentsWrapper* preview_contents) = 0; |
| 36 | 38 |
| 37 // Invoked when the suggested text is to change to |text|. | 39 // Invoked when the suggested text is to change to |text|. |
| 38 virtual void SetSuggestedText(const string16& text) = 0; | 40 virtual void SetSuggestedText(const string16& text) = 0; |
| 39 | 41 |
| 40 // Returns the bounds instant will be placed at in screen coordinates. | 42 // Returns the bounds instant will be placed at in screen coordinates. |
| 41 virtual gfx::Rect GetInstantBounds() = 0; | 43 virtual gfx::Rect GetInstantBounds() = 0; |
| 42 | 44 |
| 43 protected: | 45 protected: |
| 44 virtual ~InstantDelegate() {} | 46 virtual ~InstantDelegate() {} |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 #endif // CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_ | 49 #endif // CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_ |
| OLD | NEW |