OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_LOADER_H_ |
6 #define CHROME_BROWSER_INSTANT_INSTANT_LOADER_H_ | 6 #define CHROME_BROWSER_INSTANT_INSTANT_LOADER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // Releases the preview TabContents passing ownership to the caller. This is | 63 // Releases the preview TabContents passing ownership to the caller. This is |
64 // intended to be called when the preview TabContents is committed. This does | 64 // intended to be called when the preview TabContents is committed. This does |
65 // not notify the delegate. | 65 // not notify the delegate. |
66 TabContentsWrapper* ReleasePreviewContents(InstantCommitType type); | 66 TabContentsWrapper* ReleasePreviewContents(InstantCommitType type); |
67 | 67 |
68 // Calls through to method of same name on delegate. | 68 // Calls through to method of same name on delegate. |
69 bool ShouldCommitInstantOnMouseUp(); | 69 bool ShouldCommitInstantOnMouseUp(); |
70 void CommitInstantLoader(); | 70 void CommitInstantLoader(); |
71 | 71 |
| 72 // Preload |template_url|'s instant URL, if the loader doesn't already have |
| 73 // a |preview_contents()| for it. |
| 74 void MaybeLoadInstantURL(TabContentsWrapper* tab_contents, |
| 75 const TemplateURL* template_url); |
| 76 |
72 // NotificationObserver: | 77 // NotificationObserver: |
73 virtual void Observe(NotificationType type, | 78 virtual void Observe(NotificationType type, |
74 const NotificationSource& source, | 79 const NotificationSource& source, |
75 const NotificationDetails& details) OVERRIDE; | 80 const NotificationDetails& details) OVERRIDE; |
76 | 81 |
77 // The preview TabContents; may be null. | 82 // The preview TabContents; may be null. |
78 TabContentsWrapper* preview_contents() const { | 83 TabContentsWrapper* preview_contents() const { |
79 return preview_contents_.get(); | 84 return preview_contents_.get(); |
80 } | 85 } |
81 | 86 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 void ReplacePreviewContents(TabContentsWrapper* old_tc, | 160 void ReplacePreviewContents(TabContentsWrapper* old_tc, |
156 TabContentsWrapper* new_tc); | 161 TabContentsWrapper* new_tc); |
157 | 162 |
158 // Called to set up the |preview_contents_| based on |tab_contents| when it is | 163 // Called to set up the |preview_contents_| based on |tab_contents| when it is |
159 // created or replaced. | 164 // created or replaced. |
160 void SetupPreviewContents(TabContentsWrapper* tab_contents); | 165 void SetupPreviewContents(TabContentsWrapper* tab_contents); |
161 | 166 |
162 // Creates and sets the preview TabContentsWrapper. | 167 // Creates and sets the preview TabContentsWrapper. |
163 void CreatePreviewContents(TabContentsWrapper* tab_contents); | 168 void CreatePreviewContents(TabContentsWrapper* tab_contents); |
164 | 169 |
| 170 // Creates and loads the |template_url|'s instant URL. |
| 171 void LoadInstantURL(TabContentsWrapper* tab_contents, |
| 172 const TemplateURL* template_url, |
| 173 PageTransition::Type transition_type, |
| 174 const string16& user_text, |
| 175 bool verbatim); |
| 176 |
165 InstantLoaderDelegate* delegate_; | 177 InstantLoaderDelegate* delegate_; |
166 | 178 |
167 // If we're showing instant results this is the ID of the TemplateURL driving | 179 // If we're showing instant results this is the ID of the TemplateURL driving |
168 // the results. A value of 0 means there is no TemplateURL. | 180 // the results. A value of 0 means there is no TemplateURL. |
169 const TemplateURLID template_url_id_; | 181 const TemplateURLID template_url_id_; |
170 | 182 |
171 // The url we're displaying. | 183 // The url we're displaying. |
172 GURL url_; | 184 GURL url_; |
173 | 185 |
174 // Delegate of the preview TabContents. Used to detect when the user does some | 186 // Delegate of the preview TabContents. Used to detect when the user does some |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // Last value of verbatim passed to |Update|. | 225 // Last value of verbatim passed to |Update|. |
214 bool verbatim_; | 226 bool verbatim_; |
215 | 227 |
216 // True if the page needs to be reloaded. | 228 // True if the page needs to be reloaded. |
217 bool needs_reload_; | 229 bool needs_reload_; |
218 | 230 |
219 DISALLOW_COPY_AND_ASSIGN(InstantLoader); | 231 DISALLOW_COPY_AND_ASSIGN(InstantLoader); |
220 }; | 232 }; |
221 | 233 |
222 #endif // CHROME_BROWSER_INSTANT_INSTANT_LOADER_H_ | 234 #endif // CHROME_BROWSER_INSTANT_INSTANT_LOADER_H_ |
OLD | NEW |