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 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 TabContentsWrapper 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. | 25 // Invoked when the instant TabContentsWrapper should be hidden. |
26 virtual void HideInstant() = 0; | 26 virtual void HideInstant() = 0; |
27 | 27 |
28 // 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 |
29 // TabContents becoming the active TabContents. The delegate takes ownership | 29 // TabContentsWrapper becoming the active TabContentsWrapper. The delegate |
30 // of the supplied TabContents. | 30 // takes ownership of the supplied TabContentsWrapper. |
31 virtual void CommitInstant(TabContentsWrapper* preview_contents) = 0; | 31 virtual void CommitInstant(TabContentsWrapper* preview_contents) = 0; |
32 | 32 |
33 // Invoked when the suggested text is to change to |text|. | 33 // Invoked when the suggested text is to change to |text|. |
34 virtual void SetSuggestedText(const string16& text, | 34 virtual void SetSuggestedText(const string16& text, |
35 InstantCompleteBehavior behavior) = 0; | 35 InstantCompleteBehavior behavior) = 0; |
36 | 36 |
37 // Returns the bounds instant will be placed at in screen coordinates. | 37 // Returns the bounds instant will be placed at in screen coordinates. |
38 virtual gfx::Rect GetInstantBounds() = 0; | 38 virtual gfx::Rect GetInstantBounds() = 0; |
39 | 39 |
40 // Invoked when the WebContents becomes focused. | 40 // Invoked when the WebContents becomes focused. |
41 virtual void InstantPreviewFocused() = 0; | 41 virtual void InstantPreviewFocused() = 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 |