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 #include "chrome/browser/instant/instant_controller.h" | 5 #include "chrome/browser/instant/instant_controller.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // 5 yes no blank } Impossible. DCHECK()ed above. | 218 // 5 yes no blank } Impossible. DCHECK()ed above. |
219 // 6 yes no non-blank } | 219 // 6 yes no non-blank } |
220 // | 220 // |
221 // 7 yes yes blank User typed a "?" into the omnibox. | 221 // 7 yes yes blank User typed a "?" into the omnibox. |
222 // | 222 // |
223 // 8 yes yes non-blank User typed text into the omnibox. | 223 // 8 yes yes non-blank User typed text into the omnibox. |
224 // | 224 // |
225 // In non-extended mode, #1 to #7 call Hide(). #8 calls loader_->Update(). | 225 // In non-extended mode, #1 to #7 call Hide(). #8 calls loader_->Update(). |
226 // | 226 // |
227 // In extended mode, #2 and #4 call Hide(). #1 doesn't Hide() as the preview | 227 // In extended mode, #2 and #4 call Hide(). #1 doesn't Hide() as the preview |
228 // may be showing custom NTP content, but doesn't Update() either. #3 and #7 | 228 // may be showing custom NTP content, but doesn't Update() either. #3 calls |
| 229 // Hide() unless on the NTP _and_ sends a blank query; otherwise #3 and #7 |
229 // don't Hide(), but send a blank query to Update(). #8 calls Update(). | 230 // don't Hide(), but send a blank query to Update(). #8 calls Update(). |
230 | 231 |
231 if (extended_enabled_) { | 232 if (extended_enabled_) { |
232 if (!omnibox_popup_is_open) { | 233 if (!omnibox_popup_is_open) { |
233 if (!full_text.empty()) { | 234 if (!full_text.empty() || |
| 235 (user_input_in_progress && !search_mode_.is_origin_ntp())) { |
234 Hide(true); | 236 Hide(true); |
235 return false; | 237 return false; |
236 } | 238 } |
237 if (!user_input_in_progress && full_text.empty()) | 239 if (!user_input_in_progress && full_text.empty()) |
238 return false; | 240 return false; |
239 } | 241 } |
240 } else if (!omnibox_popup_is_open || full_text.empty()) { | 242 } else if (!omnibox_popup_is_open || full_text.empty()) { |
241 // Update() can be called if the user clicks the preview while composing | 243 // Update() can be called if the user clicks the preview while composing |
242 // text with an IME. If so, we should commit on mouse up, so don't Hide(). | 244 // text with an IME. If so, we should commit on mouse up, so don't Hide(). |
243 if (!GetPreviewContents() || !loader_->IsPointerDownFromActivate()) | 245 if (!GetPreviewContents() || !loader_->IsPointerDownFromActivate()) |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 } | 903 } |
902 | 904 |
903 std::map<std::string, int>::const_iterator iter = | 905 std::map<std::string, int>::const_iterator iter = |
904 blacklisted_urls_.find(*instant_url); | 906 blacklisted_urls_.find(*instant_url); |
905 if (iter != blacklisted_urls_.end() && | 907 if (iter != blacklisted_urls_.end() && |
906 iter->second > kMaxInstantSupportFailures) | 908 iter->second > kMaxInstantSupportFailures) |
907 return false; | 909 return false; |
908 | 910 |
909 return true; | 911 return true; |
910 } | 912 } |
OLD | NEW |