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