| 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/ui/search/search_tab_helper.h" | 5 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 } | 350 } |
| 351 | 351 |
| 352 UpdateMode(true, false); | 352 UpdateMode(true, false); |
| 353 | 353 |
| 354 content::NavigationEntry* entry = | 354 content::NavigationEntry* entry = |
| 355 web_contents_->GetController().GetVisibleEntry(); | 355 web_contents_->GetController().GetVisibleEntry(); |
| 356 DCHECK(entry); | 356 DCHECK(entry); |
| 357 | 357 |
| 358 // Already determined the instant support state for this page, do not reset | 358 // Already determined the instant support state for this page, do not reset |
| 359 // the instant support state. | 359 // the instant support state. |
| 360 // | 360 if (load_details.is_in_page) { |
| 361 // When we get a navigation entry committed event, there seem to be two ways | |
| 362 // to tell whether the navigation was "in-page". Ideally, when | |
| 363 // LoadCommittedDetails::is_in_page is true, we should have | |
| 364 // LoadCommittedDetails::type to be NAVIGATION_TYPE_IN_PAGE. Unfortunately, | |
| 365 // they are different in some cases. To workaround this bug, we are checking | |
| 366 // (is_in_page || type == NAVIGATION_TYPE_IN_PAGE). Please refer to | |
| 367 // crbug.com/251330 for more details. | |
| 368 if (load_details.is_in_page || | |
| 369 load_details.type == content::NAVIGATION_TYPE_IN_PAGE) { | |
| 370 // When an "in-page" navigation happens, we will not receive a | 361 // When an "in-page" navigation happens, we will not receive a |
| 371 // DidFinishLoad() event. Therefore, we will not determine the Instant | 362 // DidFinishLoad() event. Therefore, we will not determine the Instant |
| 372 // support for the navigated page. So, copy over the Instant support from | 363 // support for the navigated page. So, copy over the Instant support from |
| 373 // the previous entry. If the page does not support Instant, update the | 364 // the previous entry. If the page does not support Instant, update the |
| 374 // location bar from here to turn off search terms replacement. | 365 // location bar from here to turn off search terms replacement. |
| 375 chrome::SetInstantSupportStateInNavigationEntry(model_.instant_support(), | 366 chrome::SetInstantSupportStateInNavigationEntry(model_.instant_support(), |
| 376 entry); | 367 entry); |
| 377 if (delegate_ && model_.instant_support() == INSTANT_SUPPORT_NO) | 368 if (delegate_ && model_.instant_support() == INSTANT_SUPPORT_NO) |
| 378 delegate_->OnWebContentsInstantSupportDisabled(web_contents_); | 369 delegate_->OnWebContentsInstantSupportDisabled(web_contents_); |
| 379 return; | 370 return; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 | 586 |
| 596 bool SearchTabHelper::IsInputInProgress() const { | 587 bool SearchTabHelper::IsInputInProgress() const { |
| 597 OmniboxView* omnibox = GetOmniboxView(); | 588 OmniboxView* omnibox = GetOmniboxView(); |
| 598 return !model_.mode().is_ntp() && omnibox && | 589 return !model_.mode().is_ntp() && omnibox && |
| 599 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 590 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
| 600 } | 591 } |
| 601 | 592 |
| 602 OmniboxView* SearchTabHelper::GetOmniboxView() const { | 593 OmniboxView* SearchTabHelper::GetOmniboxView() const { |
| 603 return delegate_ ? delegate_->GetOmniboxView() : NULL; | 594 return delegate_ ? delegate_->GetOmniboxView() : NULL; |
| 604 } | 595 } |
| OLD | NEW |