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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 // If error_code is ERR_ABORTED means that the user has canceled this | 332 // If error_code is ERR_ABORTED means that the user has canceled this |
333 // navigation so it shouldn't be redirected. | 333 // navigation so it shouldn't be redirected. |
334 if (!render_frame_host->GetParent() && error_code != net::ERR_ABORTED && | 334 if (!render_frame_host->GetParent() && error_code != net::ERR_ABORTED && |
335 validated_url != GURL(chrome::kChromeSearchLocalNtpUrl) && | 335 validated_url != GURL(chrome::kChromeSearchLocalNtpUrl) && |
336 chrome::IsNTPURL(validated_url, profile())) { | 336 chrome::IsNTPURL(validated_url, profile())) { |
337 RedirectToLocalNTP(); | 337 RedirectToLocalNTP(); |
338 RecordCacheableNTPLoadHistogram(false); | 338 RecordCacheableNTPLoadHistogram(false); |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 void SearchTabHelper::DidFinishLoad( | 342 void SearchTabHelper::DidFinishLoad(content::RenderFrameHost* render_frame_host, |
343 int64 /* frame_id */, | 343 const GURL& /* validated_url */) { |
344 const GURL& /* validated_url */, | 344 if (!render_frame_host->GetParent()) { |
345 bool is_main_frame, | |
346 content::RenderViewHost* /* render_view_host */) { | |
347 if (is_main_frame) { | |
348 if (chrome::IsInstantNTP(web_contents_)) | 345 if (chrome::IsInstantNTP(web_contents_)) |
349 RecordNewTabLoadTime(web_contents_); | 346 RecordNewTabLoadTime(web_contents_); |
350 | 347 |
351 DetermineIfPageSupportsInstant(); | 348 DetermineIfPageSupportsInstant(); |
352 } | 349 } |
353 } | 350 } |
354 | 351 |
355 void SearchTabHelper::NavigationEntryCommitted( | 352 void SearchTabHelper::NavigationEntryCommitted( |
356 const content::LoadCommittedDetails& load_details) { | 353 const content::LoadCommittedDetails& load_details) { |
357 if (!is_search_enabled_) | 354 if (!is_search_enabled_) |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 | 630 |
634 bool SearchTabHelper::IsInputInProgress() const { | 631 bool SearchTabHelper::IsInputInProgress() const { |
635 OmniboxView* omnibox = GetOmniboxView(); | 632 OmniboxView* omnibox = GetOmniboxView(); |
636 return !model_.mode().is_ntp() && omnibox && | 633 return !model_.mode().is_ntp() && omnibox && |
637 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 634 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
638 } | 635 } |
639 | 636 |
640 OmniboxView* SearchTabHelper::GetOmniboxView() const { | 637 OmniboxView* SearchTabHelper::GetOmniboxView() const { |
641 return delegate_ ? delegate_->GetOmniboxView() : NULL; | 638 return delegate_ ? delegate_->GetOmniboxView() : NULL; |
642 } | 639 } |
OLD | NEW |