| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/common/instant_types.h" | 10 #include "chrome/common/instant_types.h" |
| 11 | 11 |
| 12 class TabContentsWrapper; | 12 class TabContentsWrapper; |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Rect; | 15 class Rect; |
| 16 } | 16 } |
| 17 | 17 |
| 18 // InstantController's delegate. Normally the Browser implements this. See | 18 // InstantController's delegate. Normally the Browser implements this. See |
| 19 // InstantController for details. | 19 // InstantController for details. |
| 20 class InstantDelegate { | 20 class InstantDelegate { |
| 21 public: | 21 public: |
| 22 // Invoked when the instant TabContents should be shown. | 22 // Invoked when the instant TabContents should be shown. |
| 23 virtual void ShowInstant(TabContentsWrapper* preview_contents) = 0; | 23 virtual void ShowInstant(TabContentsWrapper* preview_contents) = 0; |
| 24 | 24 |
| 25 // Invoked when the instant TabContents should be hidden. Instant still may be | 25 // Invoked when the instant TabContents should be hidden. |
| 26 // active at the time this is invoked. Use |is_active()| to determine if | |
| 27 // instant is still active. | |
| 28 virtual void HideInstant() = 0; | 26 virtual void HideInstant() = 0; |
| 29 | 27 |
| 30 // Invoked when the user does something that should result in the preview | 28 // Invoked when the user does something that should result in the preview |
| 31 // TabContents becoming the active TabContents. The delegate takes ownership | 29 // TabContents becoming the active TabContents. The delegate takes ownership |
| 32 // of the supplied TabContents. | 30 // of the supplied TabContents. |
| 33 virtual void CommitInstant(TabContentsWrapper* preview_contents) = 0; | 31 virtual void CommitInstant(TabContentsWrapper* preview_contents) = 0; |
| 34 | 32 |
| 35 // Invoked when the suggested text is to change to |text|. | 33 // Invoked when the suggested text is to change to |text|. |
| 36 virtual void SetSuggestedText(const string16& text, | 34 virtual void SetSuggestedText(const string16& text, |
| 37 InstantCompleteBehavior behavior) = 0; | 35 InstantCompleteBehavior behavior) = 0; |
| 38 | 36 |
| 39 // Returns the bounds instant will be placed at in screen coordinates. | 37 // Returns the bounds instant will be placed at in screen coordinates. |
| 40 virtual gfx::Rect GetInstantBounds() = 0; | 38 virtual gfx::Rect GetInstantBounds() = 0; |
| 41 | 39 |
| 42 protected: | 40 protected: |
| 43 virtual ~InstantDelegate() {} | 41 virtual ~InstantDelegate() {} |
| 44 }; | 42 }; |
| 45 | 43 |
| 46 #endif // CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_ | 44 #endif // CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_ |
| OLD | NEW |