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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 void ProcessBoundsChange(); | 151 void ProcessBoundsChange(); |
147 | 152 |
148 // Notifes the page of the omnibox bounds. If |force_if_loading| is true the | 153 // Notifes the page of the omnibox bounds. If |force_if_loading| is true the |
149 // bounds are sent down even if we're waiting on the load, otherwise if we're | 154 // bounds are sent down even if we're waiting on the load, otherwise if we're |
150 // waiting on the load and |force_if_loading| is false this does nothing. | 155 // waiting on the load and |force_if_loading| is false this does nothing. |
151 void SendBoundsToPage(bool force_if_loading); | 156 void SendBoundsToPage(bool force_if_loading); |
152 | 157 |
153 // Creates and sets the preview TabContentsWrapper. | 158 // Creates and sets the preview TabContentsWrapper. |
154 void CreatePreviewContents(TabContentsWrapper* tab_contents); | 159 void CreatePreviewContents(TabContentsWrapper* tab_contents); |
155 | 160 |
| 161 // Creates and loads the |template_url|'s instant URL. |
| 162 void LoadInstantURL(TabContentsWrapper* tab_contents, |
| 163 const TemplateURL* template_url, |
| 164 PageTransition::Type transition_type, |
| 165 const string16& user_text, |
| 166 bool verbatim); |
| 167 |
156 InstantLoaderDelegate* delegate_; | 168 InstantLoaderDelegate* delegate_; |
157 | 169 |
158 // If we're showing instant results this is the ID of the TemplateURL driving | 170 // If we're showing instant results this is the ID of the TemplateURL driving |
159 // the results. A value of 0 means there is no TemplateURL. | 171 // the results. A value of 0 means there is no TemplateURL. |
160 const TemplateURLID template_url_id_; | 172 const TemplateURLID template_url_id_; |
161 | 173 |
162 // The url we're displaying. | 174 // The url we're displaying. |
163 GURL url_; | 175 GURL url_; |
164 | 176 |
165 // Delegate of the preview TabContents. Used to detect when the user does some | 177 // 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... |
204 // Last value of verbatim passed to |Update|. | 216 // Last value of verbatim passed to |Update|. |
205 bool verbatim_; | 217 bool verbatim_; |
206 | 218 |
207 // True if the page needs to be reloaded. | 219 // True if the page needs to be reloaded. |
208 bool needs_reload_; | 220 bool needs_reload_; |
209 | 221 |
210 DISALLOW_COPY_AND_ASSIGN(InstantLoader); | 222 DISALLOW_COPY_AND_ASSIGN(InstantLoader); |
211 }; | 223 }; |
212 | 224 |
213 #endif // CHROME_BROWSER_INSTANT_INSTANT_LOADER_H_ | 225 #endif // CHROME_BROWSER_INSTANT_INSTANT_LOADER_H_ |
OLD | NEW |