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

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

Issue 24733003: Update defaults for InstantExtended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up test. Created 7 years, 2 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 | Annotate | Revision Log
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_ntp_prerenderer.h" 5 #include "chrome/browser/ui/search/instant_ntp_prerenderer.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 InstantNTPPrerenderer::~InstantNTPPrerenderer() { 69 InstantNTPPrerenderer::~InstantNTPPrerenderer() {
70 InstantService* instant_service = 70 InstantService* instant_service =
71 InstantServiceFactory::GetForProfile(profile_); 71 InstantServiceFactory::GetForProfile(profile_);
72 if (instant_service) 72 if (instant_service)
73 instant_service->RemoveObserver(this); 73 instant_service->RemoveObserver(this);
74 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); 74 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
75 } 75 }
76 76
77 void InstantNTPPrerenderer::ReloadInstantNTP() { 77 void InstantNTPPrerenderer::ReloadInstantNTP() {
78 // Stub out for unit tests that don't run on the UI message loop.
79 if (base::MessageLoop::current()->type() != base::MessageLoop::TYPE_UI)
80 return;
81
78 ResetNTP(GetInstantURL()); 82 ResetNTP(GetInstantURL());
79 } 83 }
80 84
81 scoped_ptr<content::WebContents> InstantNTPPrerenderer::ReleaseNTPContents() { 85 scoped_ptr<content::WebContents> InstantNTPPrerenderer::ReleaseNTPContents() {
82 if (!profile_ || profile_->IsOffTheRecord() || 86 if (!profile_ || profile_->IsOffTheRecord() ||
83 !chrome::ShouldShowInstantNTP()) 87 !chrome::ShouldShowInstantNTP())
84 return scoped_ptr<content::WebContents>(); 88 return scoped_ptr<content::WebContents>();
85 89
86 if (ShouldSwitchToLocalNTP()) 90 if (ShouldSwitchToLocalNTP())
87 ResetNTP(GetLocalInstantURL()); 91 ResetNTP(GetLocalInstantURL());
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 return !(InStartup() && chrome::ShouldPreferRemoteNTPOnStartup()); 295 return !(InStartup() && chrome::ShouldPreferRemoteNTPOnStartup());
292 } 296 }
293 297
294 void InstantNTPPrerenderer::DefaultSearchProviderChanged() { 298 void InstantNTPPrerenderer::DefaultSearchProviderChanged() {
295 ReloadInstantNTP(); 299 ReloadInstantNTP();
296 } 300 }
297 301
298 void InstantNTPPrerenderer::GoogleURLUpdated() { 302 void InstantNTPPrerenderer::GoogleURLUpdated() {
299 ReloadInstantNTP(); 303 ReloadInstantNTP();
300 } 304 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698