| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 TabContents; | 12 class TabContents; |
| 13 typedef TabContents TabContentsWrapper; | |
| 14 | 13 |
| 15 namespace gfx { | 14 namespace gfx { |
| 16 class Rect; | 15 class Rect; |
| 17 } | 16 } |
| 18 | 17 |
| 19 // InstantController's delegate. Normally the Browser implements this. See | 18 // InstantController's delegate. Normally the Browser implements this. See |
| 20 // InstantController for details. | 19 // InstantController for details. |
| 21 class InstantDelegate { | 20 class InstantDelegate { |
| 22 public: | 21 public: |
| 23 // Invoked when the instant TabContentsWrapper should be shown. | 22 // Invoked when the instant TabContents should be shown. |
| 24 virtual void ShowInstant(TabContentsWrapper* preview_contents) = 0; | 23 virtual void ShowInstant(TabContents* preview_contents) = 0; |
| 25 | 24 |
| 26 // Invoked when the instant TabContentsWrapper should be hidden. | 25 // Invoked when the instant TabContents should be hidden. |
| 27 virtual void HideInstant() = 0; | 26 virtual void HideInstant() = 0; |
| 28 | 27 |
| 29 // 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 |
| 30 // TabContentsWrapper becoming the active TabContentsWrapper. The delegate | 29 // TabContents becoming the active TabContents. The delegate |
| 31 // takes ownership of the supplied TabContentsWrapper. | 30 // takes ownership of the supplied TabContents. |
| 32 virtual void CommitInstant(TabContentsWrapper* preview_contents) = 0; | 31 virtual void CommitInstant(TabContents* preview_contents) = 0; |
| 33 | 32 |
| 34 // Invoked when the suggested text is to change to |text|. | 33 // Invoked when the suggested text is to change to |text|. |
| 35 virtual void SetSuggestedText(const string16& text, | 34 virtual void SetSuggestedText(const string16& text, |
| 36 InstantCompleteBehavior behavior) = 0; | 35 InstantCompleteBehavior behavior) = 0; |
| 37 | 36 |
| 38 // Returns the bounds instant will be placed at in screen coordinates. | 37 // Returns the bounds instant will be placed at in screen coordinates. |
| 39 virtual gfx::Rect GetInstantBounds() = 0; | 38 virtual gfx::Rect GetInstantBounds() = 0; |
| 40 | 39 |
| 41 // Invoked when the WebContents becomes focused. | 40 // Invoked when the WebContents becomes focused. |
| 42 virtual void InstantPreviewFocused() = 0; | 41 virtual void InstantPreviewFocused() = 0; |
| 43 | 42 |
| 44 // Returns the tab contents over which the instant preview is overlaid. | 43 // Returns the tab contents over which the instant preview is overlaid. |
| 45 virtual TabContentsWrapper* GetInstantHostTabContents() const = 0; | 44 virtual TabContents* GetInstantHostTabContents() const = 0; |
| 46 | 45 |
| 47 protected: | 46 protected: |
| 48 virtual ~InstantDelegate() {} | 47 virtual ~InstantDelegate() {} |
| 49 }; | 48 }; |
| 50 | 49 |
| 51 #endif // CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_ | 50 #endif // CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_ |
| OLD | NEW |