OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_DELEGATE_H_ | |
6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_DELEGATE_H_ | |
7 | |
8 #include "base/string16.h" | |
9 #include "chrome/common/instant_types.h" | |
10 | |
11 class TabContents; | |
12 | |
13 namespace gfx { | |
14 class Rect; | |
15 } | |
16 | |
17 // InstantController calls these methods on its delegate (Browser, via | |
18 // BrowserInstantController) to ask for the Instant preview to be shown, | |
19 // hidden, etc. In the following methods, if a TabContents argument is | |
20 // explicitly supplied, the delegate MUST use it. Otherwise, the preview | |
21 // TabContents can be gotten by calling InstantController::GetPreviewContents() | |
22 // (note that it may return NULL). | |
23 class InstantControllerDelegate { | |
24 public: | |
25 // Commit the |preview| by merging it into the active tab or adding it as a | |
26 // new tab, based on |in_new_tab|. Delegate takes ownership of |preview|. | |
27 virtual void CommitInstant(TabContents* preview, bool in_new_tab) = 0; | |
28 | |
29 // Autocomplete the Instant |suggestion| into the omnibox. | |
30 virtual void SetInstantSuggestion(const InstantSuggestion& suggestion) = 0; | |
31 | |
32 // Return the bounds that the preview is placed at, in screen coordinates. | |
33 virtual gfx::Rect GetInstantBounds() = 0; | |
34 | |
35 // Notification that the preview gained focus, usually due to the user | |
36 // clicking on it. | |
37 virtual void InstantPreviewFocused() = 0; | |
38 | |
39 // Return the currently active tab, over which any preview would be shown. | |
40 virtual TabContents* GetActiveTabContents() const = 0; | |
41 | |
42 protected: | |
43 virtual ~InstantControllerDelegate() {} | |
44 }; | |
45 | |
46 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_DELEGATE_H_ | |
OLD | NEW |