| 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/instant_loader.h" | 5 #include "chrome/browser/ui/search/instant_loader.h" |
| 6 | 6 |
| 7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 8 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" | 8 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" |
| 9 #include "chrome/browser/favicon/favicon_tab_helper.h" | 9 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 10 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" | 10 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 contents_->GetController().LoadURL( | 58 contents_->GetController().LoadURL( |
| 59 instant_url_, content::Referrer(), | 59 instant_url_, content::Referrer(), |
| 60 content::PAGE_TRANSITION_GENERATED, kInstantHeader); | 60 content::PAGE_TRANSITION_GENERATED, kInstantHeader); |
| 61 | 61 |
| 62 // Explicitly set the new tab title and virtual URL. | 62 // Explicitly set the new tab title and virtual URL. |
| 63 // | 63 // |
| 64 // This ensures that the title is set even before we get a title from the | 64 // This ensures that the title is set even before we get a title from the |
| 65 // page, preventing a potential flicker of the URL, and also ensures that | 65 // page, preventing a potential flicker of the URL, and also ensures that |
| 66 // (unless overridden by the page) the new tab title matches the browser UI | 66 // (unless overridden by the page) the new tab title matches the browser UI |
| 67 // locale. | 67 // locale. |
| 68 content::NavigationEntry* entry = contents_->GetController().GetActiveEntry(); | 68 content::NavigationEntry* entry = |
| 69 contents_->GetController().GetVisibleEntry(); |
| 69 if (entry) | 70 if (entry) |
| 70 entry->SetTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); | 71 entry->SetTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
| 71 | 72 |
| 72 contents_->WasHidden(); | 73 contents_->WasHidden(); |
| 73 | 74 |
| 74 int staleness_timeout_ms = chrome::GetInstantLoaderStalenessTimeoutSec() * | 75 int staleness_timeout_ms = chrome::GetInstantLoaderStalenessTimeoutSec() * |
| 75 1000; | 76 1000; |
| 76 if (staleness_timeout_ms > 0) { | 77 if (staleness_timeout_ms > 0) { |
| 77 stale_page_timer_.Start( | 78 stale_page_timer_.Start( |
| 78 FROM_HERE, | 79 FROM_HERE, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 167 |
| 167 bool InstantLoader::OnGoToEntryOffset(int /* offset */) { | 168 bool InstantLoader::OnGoToEntryOffset(int /* offset */) { |
| 168 return false; | 169 return false; |
| 169 } | 170 } |
| 170 | 171 |
| 171 content::WebContents* InstantLoader::OpenURLFromTab( | 172 content::WebContents* InstantLoader::OpenURLFromTab( |
| 172 content::WebContents* source, | 173 content::WebContents* source, |
| 173 const content::OpenURLParams& params) { | 174 const content::OpenURLParams& params) { |
| 174 return delegate_->OpenURLFromTab(source, params); | 175 return delegate_->OpenURLFromTab(source, params); |
| 175 } | 176 } |
| OLD | NEW |