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_LOADER_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_LOADER_DELEGATE_H_ |
6 #define CHROME_BROWSER_INSTANT_INSTANT_LOADER_DELEGATE_H_ | 6 #define CHROME_BROWSER_INSTANT_INSTANT_LOADER_DELEGATE_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/string16.h" | 10 #include "base/string16.h" |
9 #include "chrome/common/instant_types.h" | 11 #include "chrome/common/instant_types.h" |
10 | 12 |
11 class GURL; | |
12 | |
13 namespace gfx { | |
14 class Rect; | |
15 } | |
16 | |
17 class InstantLoader; | 13 class InstantLoader; |
18 | 14 |
19 // InstantLoader's delegate. This interface is implemented by InstantController. | 15 // InstantLoader calls these methods on its delegate (InstantController) |
| 16 // to notify it of interesting events happening on the Instant preview. |
20 class InstantLoaderDelegate { | 17 class InstantLoaderDelegate { |
21 public: | 18 public: |
22 // Invoked when the status (either http_status_ok or ready) has changed. | |
23 virtual void InstantStatusChanged(InstantLoader* loader) = 0; | |
24 | |
25 // Invoked when the loader has suggested text. | 19 // Invoked when the loader has suggested text. |
26 virtual void SetSuggestedTextFor( | 20 virtual void SetSuggestions( |
27 InstantLoader* loader, | 21 InstantLoader* loader, |
28 const string16& text, | 22 const std::vector<string16>& suggestions, |
29 InstantCompleteBehavior behavior) = 0; | 23 InstantCompleteBehavior behavior) = 0; |
30 | 24 |
31 // Returns the bounds of instant. | 25 // Commit the preview. |
32 virtual gfx::Rect GetInstantBounds() = 0; | |
33 | |
34 // Returns true if instant should be committed on mouse up or at the end of a | |
35 // touch-gesture. | |
36 virtual bool ShouldCommitInstantOnPointerRelease() = 0; | |
37 | |
38 // Invoked when the the loader should be committed. | |
39 virtual void CommitInstantLoader(InstantLoader* loader) = 0; | 26 virtual void CommitInstantLoader(InstantLoader* loader) = 0; |
40 | 27 |
41 // Invoked if the loader was created with the intention that the site supports | 28 // Notification that the first page load (of the Instant URL) completed. |
42 // instant, but it turned out the site doesn't support instant. | 29 virtual void InstantLoaderPreviewLoaded(InstantLoader* loader) = 0; |
43 virtual void InstantLoaderDoesntSupportInstant(InstantLoader* loader) = 0; | |
44 | 30 |
45 // Adds the specified url to the set of urls instant won't prefetch for. | 31 // Notification when the loader has determined whether or not the page |
46 virtual void AddToBlacklist(InstantLoader* loader, const GURL& url) = 0; | 32 // supports the Instant API. |
| 33 virtual void InstantSupportDetermined(InstantLoader* loader, |
| 34 bool supports_instant) = 0; |
47 | 35 |
48 // Invoked if the loader swaps to a different WebContents. | 36 // Notification that the loader swapped a different TabContents into the |
| 37 // preview, usually because a prerendered page was navigated to. |
49 virtual void SwappedTabContents(InstantLoader* loader) = 0; | 38 virtual void SwappedTabContents(InstantLoader* loader) = 0; |
50 | 39 |
51 // Invoked when the webcontents created by the loader is focused. | 40 // Notification that the preview gained focus, usually due to the user |
52 virtual void InstantLoaderContentsFocused() = 0; | 41 // clicking on it. |
| 42 virtual void InstantLoaderContentsFocused(InstantLoader* loader) = 0; |
53 | 43 |
54 protected: | 44 protected: |
55 virtual ~InstantLoaderDelegate() {} | 45 virtual ~InstantLoaderDelegate() {} |
56 }; | 46 }; |
57 | 47 |
58 #endif // CHROME_BROWSER_INSTANT_INSTANT_LOADER_DELEGATE_H_ | 48 #endif // CHROME_BROWSER_INSTANT_INSTANT_LOADER_DELEGATE_H_ |
OLD | NEW |