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