| 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/browser_instant_controller.h" | 5 #include "chrome/browser/ui/browser_instant_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/extension_web_ui.h" | 9 #include "chrome/browser/extensions/extension_web_ui.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // source contents. | 80 // source contents. |
| 81 // TODO(sreeram): Always using the local URL is wrong in the case of the | 81 // TODO(sreeram): Always using the local URL is wrong in the case of the |
| 82 // first tab in a window where we might want to use the remote URL. Fix. | 82 // first tab in a window where we might want to use the remote URL. Fix. |
| 83 if (!instant_ntp->GetController().CanPruneAllButLastCommitted()) { | 83 if (!instant_ntp->GetController().CanPruneAllButLastCommitted()) { |
| 84 source_contents->GetController().LoadURL(chrome::GetLocalInstantURL( | 84 source_contents->GetController().LoadURL(chrome::GetLocalInstantURL( |
| 85 profile()), content::Referrer(), content::PAGE_TRANSITION_GENERATED, | 85 profile()), content::Referrer(), content::PAGE_TRANSITION_GENERATED, |
| 86 std::string()); | 86 std::string()); |
| 87 *target_contents = source_contents; | 87 *target_contents = source_contents; |
| 88 } else { | 88 } else { |
| 89 instant_ntp->GetController().CopyStateFromAndPrune( | 89 instant_ntp->GetController().CopyStateFromAndPrune( |
| 90 &source_contents->GetController()); | 90 &source_contents->GetController(), false); |
| 91 ReplaceWebContentsAt( | 91 ReplaceWebContentsAt( |
| 92 browser_->tab_strip_model()->GetIndexOfWebContents(source_contents), | 92 browser_->tab_strip_model()->GetIndexOfWebContents(source_contents), |
| 93 instant_ntp.Pass()); | 93 instant_ntp.Pass()); |
| 94 } | 94 } |
| 95 } else { | 95 } else { |
| 96 // If the Instant NTP hasn't yet committed an entry, we can't call | 96 // If the Instant NTP hasn't yet committed an entry, we can't call |
| 97 // PruneAllButLastCommitted. In that case, there shouldn't be any entries | 97 // PruneAllButLastCommitted. In that case, there shouldn't be any entries |
| 98 // to prune anyway. | 98 // to prune anyway. |
| 99 if (instant_ntp->GetController().CanPruneAllButLastCommitted()) | 99 if (instant_ntp->GetController().CanPruneAllButLastCommitted()) |
| 100 instant_ntp->GetController().PruneAllButLastCommitted(); | 100 instant_ntp->GetController().PruneAllButLastCommitted(); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 content::RenderProcessHost* rph = contents->GetRenderProcessHost(); | 212 content::RenderProcessHost* rph = contents->GetRenderProcessHost(); |
| 213 instant_service->SendSearchURLsToRenderer(rph); | 213 instant_service->SendSearchURLsToRenderer(rph); |
| 214 | 214 |
| 215 // Reload the contents to ensure that it gets assigned to a non-priviledged | 215 // Reload the contents to ensure that it gets assigned to a non-priviledged |
| 216 // renderer. | 216 // renderer. |
| 217 if (!instant_service->IsInstantProcess(rph->GetID())) | 217 if (!instant_service->IsInstantProcess(rph->GetID())) |
| 218 continue; | 218 continue; |
| 219 contents->GetController().Reload(false); | 219 contents->GetController().Reload(false); |
| 220 } | 220 } |
| 221 } | 221 } |
| OLD | NEW |