Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: chrome/browser/ui/search/instant_search_prerenderer.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_search_prerenderer.h" 5 #include "chrome/browser/ui/search/instant_search_prerenderer.h"
6 6
7 #include "chrome/browser/prerender/prerender_handle.h" 7 #include "chrome/browser/prerender/prerender_handle.h"
8 #include "chrome/browser/prerender/prerender_manager.h" 8 #include "chrome/browser/prerender/prerender_manager.h"
9 #include "chrome/browser/prerender/prerender_manager_factory.h" 9 #include "chrome/browser/prerender/prerender_manager_factory.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 void InstantSearchPrerenderer::Init( 61 void InstantSearchPrerenderer::Init(
62 content::SessionStorageNamespace* session_storage_namespace, 62 content::SessionStorageNamespace* session_storage_namespace,
63 const gfx::Size& size) { 63 const gfx::Size& size) {
64 // TODO(kmadhusu): Enable Instant for Incognito profile. 64 // TODO(kmadhusu): Enable Instant for Incognito profile.
65 if (profile_->IsOffTheRecord()) 65 if (profile_->IsOffTheRecord())
66 return; 66 return;
67 67
68 // Only cancel the old prerender after starting the new one, so if the URLs 68 // Only cancel the old prerender after starting the new one, so if the URLs
69 // are the same, the underlying prerender will be reused. 69 // are the same, the underlying prerender will be reused.
70 scoped_ptr<prerender::PrerenderHandle> old_prerender_handle( 70 std::unique_ptr<prerender::PrerenderHandle> old_prerender_handle(
71 prerender_handle_.release()); 71 prerender_handle_.release());
72 prerender::PrerenderManager* prerender_manager = 72 prerender::PrerenderManager* prerender_manager =
73 prerender::PrerenderManagerFactory::GetForProfile(profile_); 73 prerender::PrerenderManagerFactory::GetForProfile(profile_);
74 if (prerender_manager) { 74 if (prerender_manager) {
75 prerender_handle_.reset(prerender_manager->AddPrerenderForInstant( 75 prerender_handle_.reset(prerender_manager->AddPrerenderForInstant(
76 prerender_url_, session_storage_namespace, size)); 76 prerender_url_, session_storage_namespace, size));
77 } 77 }
78 if (old_prerender_handle) 78 if (old_prerender_handle)
79 old_prerender_handle->OnCancel(); 79 old_prerender_handle->OnCancel();
80 } 80 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 return (prerender_handle_ && prerender_handle_->contents()) ? 189 return (prerender_handle_ && prerender_handle_->contents()) ?
190 prerender_handle_->contents()->prerender_contents() : NULL; 190 prerender_handle_->contents()->prerender_contents() : NULL;
191 } 191 }
192 192
193 bool InstantSearchPrerenderer::QueryMatchesPrefetch( 193 bool InstantSearchPrerenderer::QueryMatchesPrefetch(
194 const base::string16& query) const { 194 const base::string16& query) const {
195 if (search::ShouldReuseInstantSearchBasePage()) 195 if (search::ShouldReuseInstantSearchBasePage())
196 return true; 196 return true;
197 return last_instant_suggestion_.text == query; 197 return last_instant_suggestion_.text == query;
198 } 198 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_search_prerenderer.h ('k') | chrome/browser/ui/search/instant_search_prerenderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698