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