| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class InstantController; | 21 class InstantController; |
| 22 struct ThemeBackgroundInfo; | 22 struct ThemeBackgroundInfo; |
| 23 | 23 |
| 24 namespace chrome { | 24 namespace chrome { |
| 25 namespace search { | 25 namespace search { |
| 26 struct Mode; | 26 struct Mode; |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace content { | 30 namespace content { |
| 31 class NavigationEntry; |
| 31 class WebContents; | 32 class WebContents; |
| 32 } | 33 } |
| 33 | 34 |
| 34 namespace gfx { | 35 namespace gfx { |
| 35 class Rect; | 36 class Rect; |
| 36 } | 37 } |
| 37 | 38 |
| 38 // InstantLoader is used to communicate with a preview WebContents that it owns | 39 // InstantLoader is used to communicate with a preview WebContents that it owns |
| 39 // and loads the "Instant URL" into. This preview can appear and disappear at | 40 // and loads the "Instant URL" into. This preview can appear and disappear at |
| 40 // will as the user types in the omnibox (compare: InstantTab, which talks to a | 41 // will as the user types in the omnibox (compare: InstantTab, which talks to a |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 84 } |
| 84 | 85 |
| 85 // Called by the history tab helper with information that it would have added | 86 // Called by the history tab helper with information that it would have added |
| 86 // to the history service had this WebContents not been used for Instant. | 87 // to the history service had this WebContents not been used for Instant. |
| 87 void DidNavigate(const history::HistoryAddPageArgs& add_page_args); | 88 void DidNavigate(const history::HistoryAddPageArgs& add_page_args); |
| 88 | 89 |
| 89 // Returns true if the loader is using | 90 // Returns true if the loader is using |
| 90 // InstantController::kLocalOmniboxPopupURL as the |instant_url_|. | 91 // InstantController::kLocalOmniboxPopupURL as the |instant_url_|. |
| 91 bool IsUsingLocalPreview() const; | 92 bool IsUsingLocalPreview() const; |
| 92 | 93 |
| 94 const content::NavigationEntry* base_navigation_entry() const { |
| 95 return base_navigation_entry_.get(); |
| 96 } |
| 97 |
| 93 // Calls through to methods of the same name on InstantClient. | 98 // Calls through to methods of the same name on InstantClient. |
| 94 void Update(const string16& text, | 99 void Update(const string16& text, |
| 95 size_t selection_start, | 100 size_t selection_start, |
| 96 size_t selection_end, | 101 size_t selection_end, |
| 97 bool verbatim); | 102 bool verbatim); |
| 98 void Submit(const string16& text); | 103 void Submit(const string16& text); |
| 99 void Cancel(const string16& text); | 104 void Cancel(const string16& text); |
| 100 void SetPopupBounds(const gfx::Rect& bounds); | 105 void SetPopupBounds(const gfx::Rect& bounds); |
| 101 void SetMarginSize(int start, int end); | 106 void SetMarginSize(int start, int end); |
| 102 void SendAutocompleteResults( | 107 void SendAutocompleteResults( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 void ReplacePreviewContents(content::WebContents* old_contents, | 140 void ReplacePreviewContents(content::WebContents* old_contents, |
| 136 content::WebContents* new_contents); | 141 content::WebContents* new_contents); |
| 137 | 142 |
| 138 InstantClient client_; | 143 InstantClient client_; |
| 139 InstantController* const controller_; | 144 InstantController* const controller_; |
| 140 | 145 |
| 141 // Delegate of the preview WebContents. Used when the user does some gesture | 146 // Delegate of the preview WebContents. Used when the user does some gesture |
| 142 // on the preview and it needs to be activated. | 147 // on the preview and it needs to be activated. |
| 143 scoped_ptr<WebContentsDelegateImpl> delegate_; | 148 scoped_ptr<WebContentsDelegateImpl> delegate_; |
| 144 scoped_ptr<content::WebContents> contents_; | 149 scoped_ptr<content::WebContents> contents_; |
| 150 scoped_ptr<const content::NavigationEntry> base_navigation_entry_; |
| 145 | 151 |
| 146 const std::string instant_url_; | 152 const std::string instant_url_; |
| 147 bool supports_instant_; | 153 bool supports_instant_; |
| 148 bool is_pointer_down_from_activate_; | 154 bool is_pointer_down_from_activate_; |
| 149 history::HistoryAddPageArgs last_navigation_; | 155 history::HistoryAddPageArgs last_navigation_; |
| 150 | 156 |
| 151 // Used to get notifications about renderers coming and going. | 157 // Used to get notifications about renderers coming and going. |
| 152 content::NotificationRegistrar registrar_; | 158 content::NotificationRegistrar registrar_; |
| 153 | 159 |
| 154 DISALLOW_COPY_AND_ASSIGN(InstantLoader); | 160 DISALLOW_COPY_AND_ASSIGN(InstantLoader); |
| 155 }; | 161 }; |
| 156 | 162 |
| 157 #endif // CHROME_BROWSER_INSTANT_INSTANT_LOADER_H_ | 163 #endif // CHROME_BROWSER_INSTANT_INSTANT_LOADER_H_ |
| OLD | NEW |