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_CONTROLLER_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_DELEGATE_H_ |
6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_DELEGATE_H_ | 6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_DELEGATE_H_ |
7 | 7 |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "chrome/common/instant_types.h" | 9 #include "chrome/common/instant_types.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| calls these methods on its delegate (usually |Browser|) | 17 // InstantController calls these methods on its delegate (usually Browser) |
18 // to ask for the Instant preview to be shown, hidden, etc. In the following | 18 // to ask for the Instant preview to be shown, hidden, etc. In the following |
19 // methods, if a |TabContents| argument is explicitly supplied, the delegate | 19 // methods, if a TabContents argument is explicitly supplied, the delegate |
20 // MUST use it. Otherwise, the preview TabContents can be gotten by calling | 20 // MUST use it. Otherwise, the preview TabContents can be gotten by calling |
21 // |InstantController::GetPreviewContents| (note that it may return NULL). | 21 // InstantController::GetPreviewContents() (note that it may return NULL). |
22 class InstantControllerDelegate { | 22 class InstantControllerDelegate { |
23 public: | 23 public: |
24 // Show the preview. | 24 // Show the preview. |
25 virtual void ShowInstant(TabContents* preview_contents) = 0; | 25 virtual void ShowInstant() = 0; |
26 | 26 |
27 // Hide any preview currently being shown. | 27 // Hide any preview currently being shown. |
28 virtual void HideInstant() = 0; | 28 virtual void HideInstant() = 0; |
29 | 29 |
30 // Commit the preview by merging it into the active tab. Delegate takes | 30 // Commit the preview by merging it into the active tab. Delegate takes |
31 // ownership of |preview_contents|. | 31 // ownership of |preview_contents|. |
32 virtual void CommitInstant(TabContents* preview_contents) = 0; | 32 virtual void CommitInstant(TabContents* preview_contents) = 0; |
33 | 33 |
34 // Autocomplete the Instant suggested |text| into the omnibox, using the | 34 // Autocomplete the Instant suggested |text| into the omnibox, using the |
35 // specified |behavior| (see instant_types.h for details). | 35 // specified |behavior| (see instant_types.h for details). |
36 virtual void SetSuggestedText(const string16& text, | 36 virtual void SetSuggestedText(const string16& text, |
37 InstantCompleteBehavior behavior) = 0; | 37 InstantCompleteBehavior behavior) = 0; |
38 | 38 |
39 // Return the bounds that the preview is placed at, in screen coordinates. | 39 // Return the bounds that the preview is placed at, in screen coordinates. |
40 virtual gfx::Rect GetInstantBounds() = 0; | 40 virtual gfx::Rect GetInstantBounds() = 0; |
41 | 41 |
42 // Notification that the preview gained focus, usually due to the user | 42 // Notification that the preview gained focus, usually due to the user |
43 // clicking on it. | 43 // clicking on it. |
44 virtual void InstantPreviewFocused() = 0; | 44 virtual void InstantPreviewFocused() = 0; |
45 | 45 |
46 // Return the currently active tab, over which any preview would be shown. | 46 // Return the currently active tab, over which any preview would be shown. |
47 virtual TabContents* GetInstantHostTabContents() const = 0; | 47 virtual TabContents* GetInstantHostTabContents() const = 0; |
48 | 48 |
49 protected: | 49 protected: |
50 virtual ~InstantControllerDelegate() {} | 50 virtual ~InstantControllerDelegate() {} |
51 }; | 51 }; |
52 | 52 |
53 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_DELEGATE_H_ | 53 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_DELEGATE_H_ |
OLD | NEW |