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

Side by Side Diff: chrome/browser/instant/instant_controller.cc

Issue 10353017: Unlaunch the HIDDEN mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/instant/instant_controller.h" 5 #include "chrome/browser/instant/instant_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 28 matching lines...) Expand all
39 InstantDelegate* delegate) 39 InstantDelegate* delegate)
40 : delegate_(delegate), 40 : delegate_(delegate),
41 template_url_service_(TemplateURLServiceFactory::GetForProfile(profile)), 41 template_url_service_(TemplateURLServiceFactory::GetForProfile(profile)),
42 tab_contents_(NULL), 42 tab_contents_(NULL),
43 is_displayable_(false), 43 is_displayable_(false),
44 is_out_of_date_(true), 44 is_out_of_date_(true),
45 commit_on_mouse_up_(false), 45 commit_on_mouse_up_(false),
46 last_transition_type_(content::PAGE_TRANSITION_LINK), 46 last_transition_type_(content::PAGE_TRANSITION_LINK),
47 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { 47 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
48 DCHECK(template_url_service_); 48 DCHECK(template_url_service_);
49 PrefService* service = profile->GetPrefs(); 49 PrefService* prefs = profile->GetPrefs();
50 if (service && !InstantFieldTrial::IsInstantExperiment(profile)) { 50 if (prefs && prefs->GetBoolean(prefs::kInstantEnabled)) {
51 // kInstantEnabledOnce was added after instant, set it now to make sure it 51 // kInstantEnabledOnce was added after Instant, set it now to make sure it
52 // is correctly set. 52 // is correctly set.
53 service->SetBoolean(prefs::kInstantEnabledOnce, true); 53 prefs->SetBoolean(prefs::kInstantEnabledOnce, true);
54 } 54 }
55 } 55 }
56 56
57 InstantController::~InstantController() { 57 InstantController::~InstantController() {
58 } 58 }
59 59
60 // static 60 // static
61 void InstantController::RegisterUserPrefs(PrefService* prefs) { 61 void InstantController::RegisterUserPrefs(PrefService* prefs) {
62 prefs->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, 62 prefs->RegisterBooleanPref(prefs::kInstantConfirmDialogShown,
63 false, 63 false,
64 PrefService::SYNCABLE_PREF); 64 PrefService::SYNCABLE_PREF);
65 prefs->RegisterBooleanPref(prefs::kInstantEnabled, 65 prefs->RegisterBooleanPref(prefs::kInstantEnabled,
66 false, 66 false,
67 PrefService::SYNCABLE_PREF); 67 PrefService::SYNCABLE_PREF);
68 prefs->RegisterBooleanPref(prefs::kInstantEnabledOnce, 68 prefs->RegisterBooleanPref(prefs::kInstantEnabledOnce,
69 false, 69 false,
70 PrefService::SYNCABLE_PREF); 70 PrefService::SYNCABLE_PREF);
71 } 71 }
72 72
73 // static 73 // static
74 void InstantController::RecordMetrics(Profile* profile) { 74 void InstantController::RecordMetrics(Profile* profile) {
75 UMA_HISTOGRAM_ENUMERATION("Instant.Status", IsEnabled(profile), 2); 75 UMA_HISTOGRAM_ENUMERATION("Instant.Status", IsEnabled(profile), 2);
76 } 76 }
77 77
78 // static 78 // static
79 bool InstantController::IsEnabled(Profile* profile) { 79 bool InstantController::IsEnabled(Profile* profile) {
80 PrefService* prefs = profile->GetPrefs(); 80 return InstantFieldTrial::GetMode(profile) != InstantFieldTrial::CONTROL;
81 return prefs->GetBoolean(prefs::kInstantEnabled) ||
82 InstantFieldTrial::IsInstantExperiment(profile);
83 } 81 }
84 82
85 // static 83 // static
86 void InstantController::Enable(Profile* profile) { 84 void InstantController::Enable(Profile* profile) {
87 PrefService* service = profile->GetPrefs(); 85 PrefService* service = profile->GetPrefs();
88 if (!service) 86 if (!service)
89 return; 87 return;
90 88
91 base::Histogram* histogram = base::LinearHistogram::FactoryGet( 89 base::Histogram* histogram = base::LinearHistogram::FactoryGet(
92 "Instant.Preference" + InstantFieldTrial::GetGroupName(profile), 1, 2, 3, 90 "Instant.Preference" + InstantFieldTrial::GetModeAsString(profile),
93 base::Histogram::kUmaTargetedHistogramFlag); 91 1, 2, 3, base::Histogram::kUmaTargetedHistogramFlag);
94 histogram->Add(1); 92 histogram->Add(1);
95 93
96 service->SetBoolean(prefs::kInstantEnabledOnce, true); 94 service->SetBoolean(prefs::kInstantEnabledOnce, true);
97 service->SetBoolean(prefs::kInstantEnabled, true); 95 service->SetBoolean(prefs::kInstantEnabled, true);
98 service->SetBoolean(prefs::kInstantConfirmDialogShown, true); 96 service->SetBoolean(prefs::kInstantConfirmDialogShown, true);
99 } 97 }
100 98
101 // static 99 // static
102 void InstantController::Disable(Profile* profile) { 100 void InstantController::Disable(Profile* profile) {
103 PrefService* service = profile->GetPrefs(); 101 PrefService* service = profile->GetPrefs();
104 if (!service || !IsEnabled(profile)) 102 if (!service || !IsEnabled(profile))
105 return; 103 return;
106 104
107 base::Histogram* histogram = base::LinearHistogram::FactoryGet( 105 base::Histogram* histogram = base::LinearHistogram::FactoryGet(
108 "Instant.Preference" + InstantFieldTrial::GetGroupName(profile), 1, 2, 3, 106 "Instant.Preference" + InstantFieldTrial::GetModeAsString(profile),
109 base::Histogram::kUmaTargetedHistogramFlag); 107 1, 2, 3, base::Histogram::kUmaTargetedHistogramFlag);
110 histogram->Add(0); 108 histogram->Add(0);
111 109
112 service->SetBoolean(prefs::kInstantEnabledOnce, true); 110 service->SetBoolean(prefs::kInstantEnabledOnce, true);
113 service->SetBoolean(prefs::kInstantEnabled, false); 111 service->SetBoolean(prefs::kInstantEnabled, false);
114 } 112 }
115 113
116 // static 114 // static
117 bool InstantController::CommitIfCurrent(InstantController* controller) { 115 bool InstantController::CommitIfCurrent(InstantController* controller) {
118 if (controller && controller->IsCurrent()) { 116 if (controller && controller->IsCurrent()) {
119 controller->CommitCurrentPreview(INSTANT_COMMIT_PRESSED_ENTER); 117 controller->CommitCurrentPreview(INSTANT_COMMIT_PRESSED_ENTER);
(...skipping 19 matching lines...) Expand all
139 const TemplateURL* default_t_url = 137 const TemplateURL* default_t_url =
140 template_url_service_->GetDefaultSearchProvider(); 138 template_url_service_->GetDefaultSearchProvider();
141 if (!IsValidInstantTemplateURL(template_url) || !default_t_url || 139 if (!IsValidInstantTemplateURL(template_url) || !default_t_url ||
142 (template_url->id() != default_t_url->id())) { 140 (template_url->id() != default_t_url->id())) {
143 Hide(); 141 Hide();
144 return false; 142 return false;
145 } 143 }
146 144
147 if (!loader_.get()) { 145 if (!loader_.get()) {
148 loader_.reset(new InstantLoader(this, template_url->id(), 146 loader_.reset(new InstantLoader(this, template_url->id(),
149 InstantFieldTrial::GetGroupName(tab_contents->profile()))); 147 InstantFieldTrial::GetModeAsString(tab_contents->profile())));
150 } 148 }
151 149
152 // In some rare cases (involving group policy), Instant can go from the field 150 // In some rare cases (involving group policy), Instant can go from the field
153 // trial to normal mode, with no intervening call to DestroyPreviewContents(). 151 // trial to normal mode, with no intervening call to DestroyPreviewContents().
154 // This would leave the loader in a weird state, which would manifest if the 152 // This would leave the loader in a weird state, which would manifest if the
155 // user pressed <Enter> without calling Update(). TODO(sreeram): Handle it. 153 // user pressed <Enter> without calling Update(). TODO(sreeram): Handle it.
156 if (InstantFieldTrial::IsSilentExperiment(tab_contents->profile())) { 154 if (InstantFieldTrial::GetMode(tab_contents->profile()) ==
157 // For the SILENT field trial we process |user_text| at commit time, which 155 InstantFieldTrial::SILENT) {
158 // means we're never really out of date. 156 // For the SILENT mode, we process |user_text| at commit time, which means
157 // we're never really out of date.
159 is_out_of_date_ = false; 158 is_out_of_date_ = false;
160 loader_->MaybeLoadInstantURL(tab_contents, template_url); 159 loader_->MaybeLoadInstantURL(tab_contents, template_url);
161 return true; 160 return true;
162 } 161 }
163 162
164 UpdateLoader(template_url, match.destination_url, match.transition, user_text, 163 UpdateLoader(template_url, match.destination_url, match.transition, user_text,
165 verbatim, suggested_text); 164 verbatim, suggested_text);
166 165
167 content::NotificationService::current()->Notify( 166 content::NotificationService::current()->Notify(
168 chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED, 167 chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED,
169 content::Source<InstantController>(this), 168 content::Source<InstantController>(this),
170 content::NotificationService::NoDetails()); 169 content::NotificationService::NoDetails());
171 return true; 170 return true;
172 } 171 }
173 172
174 void InstantController::SetOmniboxBounds(const gfx::Rect& bounds) { 173 void InstantController::SetOmniboxBounds(const gfx::Rect& bounds) {
175 if (omnibox_bounds_ == bounds) 174 if (omnibox_bounds_ == bounds)
176 return; 175 return;
177 176
178 // Always track the omnibox bounds. That way if Update is later invoked the 177 // Always track the omnibox bounds. That way if Update is later invoked the
179 // bounds are in sync. 178 // bounds are in sync.
180 omnibox_bounds_ = bounds; 179 omnibox_bounds_ = bounds;
181 180
182 if (loader_.get() && !is_out_of_date_ && 181 if (loader_.get() && !is_out_of_date_ &&
183 !InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile())) { 182 InstantFieldTrial::GetMode(tab_contents_->profile()) ==
183 InstantFieldTrial::INSTANT) {
184 loader_->SetOmniboxBounds(bounds); 184 loader_->SetOmniboxBounds(bounds);
185 } 185 }
186 } 186 }
187 187
188 void InstantController::DestroyPreviewContents() { 188 void InstantController::DestroyPreviewContents() {
189 if (!loader_.get()) { 189 if (!loader_.get()) {
190 // We're not showing anything, nothing to do. 190 // We're not showing anything, nothing to do.
191 return; 191 return;
192 } 192 }
193 193
(...skipping 16 matching lines...) Expand all
210 return is_displayable_ && !loader_->IsNavigationPending() && 210 return is_displayable_ && !loader_->IsNavigationPending() &&
211 !loader_->needs_reload(); 211 !loader_->needs_reload();
212 } 212 }
213 213
214 bool InstantController::PrepareForCommit() { 214 bool InstantController::PrepareForCommit() {
215 // Basic checks to prevent accessing a dangling |tab_contents_| pointer. 215 // Basic checks to prevent accessing a dangling |tab_contents_| pointer.
216 // http://crbug.com/100521. 216 // http://crbug.com/100521.
217 if (is_out_of_date_ || !loader_.get()) 217 if (is_out_of_date_ || !loader_.get())
218 return false; 218 return false;
219 219
220 // If we are not in the HIDDEN or SILENT field trials, return the status of 220 const InstantFieldTrial::Mode mode =
221 // the preview. 221 InstantFieldTrial::GetMode(tab_contents_->profile());
222 if (!InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile())) 222
223 // If we are in the visible (INSTANT) mode, return the status of the preview.
224 if (mode == InstantFieldTrial::INSTANT)
223 return IsCurrent(); 225 return IsCurrent();
224 226
225 const TemplateURL* template_url = 227 const TemplateURL* template_url =
226 template_url_service_->GetDefaultSearchProvider(); 228 template_url_service_->GetDefaultSearchProvider();
227 if (!IsValidInstantTemplateURL(template_url) || 229 if (!IsValidInstantTemplateURL(template_url) ||
228 loader_->template_url_id() != template_url->id() || 230 loader_->template_url_id() != template_url->id() ||
229 loader_->IsNavigationPending() || 231 loader_->IsNavigationPending() ||
230 loader_->is_determining_if_page_supports_instant()) { 232 loader_->is_determining_if_page_supports_instant()) {
231 return false; 233 return false;
232 } 234 }
233 235
234 // In the HIDDEN and SUGGEST experiments (but not SILENT), we must have sent 236 // In the SUGGEST and HIDDEN modes, we must have sent an Update() by now, so
235 // an Update() by now, so check if the loader failed to process it. 237 // check if the loader failed to process it.
236 if (!InstantFieldTrial::IsSilentExperiment(tab_contents_->profile()) && 238 if ((mode == InstantFieldTrial::SUGGEST || mode == InstantFieldTrial::HIDDEN)
237 (!loader_->ready() || !loader_->http_status_ok())) { 239 && (!loader_->ready() || !loader_->http_status_ok())) {
238 return false; 240 return false;
239 } 241 }
240 242
241 // Ignore the suggested text, as we are about to commit the verbatim query. 243 // Ignore the suggested text, as we are about to commit the verbatim query.
242 string16 suggested_text; 244 string16 suggested_text;
243 UpdateLoader(template_url, last_url_, last_transition_type_, last_user_text_, 245 UpdateLoader(template_url, last_url_, last_transition_type_, last_user_text_,
244 true, &suggested_text); 246 true, &suggested_text);
245 return true; 247 return true;
246 } 248 }
247 249
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 CommitCurrentPreview(INSTANT_COMMIT_FOCUS_LOST); 344 CommitCurrentPreview(INSTANT_COMMIT_FOCUS_LOST);
343 return; 345 return;
344 } 346 }
345 347
346 DestroyPreviewContents(); 348 DestroyPreviewContents();
347 } 349 }
348 #endif 350 #endif
349 351
350 void InstantController::OnAutocompleteGotFocus( 352 void InstantController::OnAutocompleteGotFocus(
351 TabContentsWrapper* tab_contents) { 353 TabContentsWrapper* tab_contents) {
352 CommandLine* cl = CommandLine::ForCurrentProcess();
353 if (!cl->HasSwitch(switches::kPreloadInstantSearch) &&
354 !InstantFieldTrial::IsInstantExperiment(tab_contents->profile())) {
355 return;
356 }
357
358 const TemplateURL* template_url = 354 const TemplateURL* template_url =
359 template_url_service_->GetDefaultSearchProvider(); 355 template_url_service_->GetDefaultSearchProvider();
360 if (!IsValidInstantTemplateURL(template_url)) 356 if (!IsValidInstantTemplateURL(template_url))
361 return; 357 return;
362 358
363 tab_contents_ = tab_contents; 359 tab_contents_ = tab_contents;
364 360
365 if (!loader_.get()) { 361 if (!loader_.get()) {
366 loader_.reset(new InstantLoader(this, template_url->id(), 362 loader_.reset(new InstantLoader(this, template_url->id(),
367 InstantFieldTrial::GetGroupName(tab_contents->profile()))); 363 InstantFieldTrial::GetModeAsString(tab_contents->profile())));
368 } 364 }
369 loader_->MaybeLoadInstantURL(tab_contents, template_url); 365 loader_->MaybeLoadInstantURL(tab_contents, template_url);
370 } 366 }
371 367
372 TabContentsWrapper* InstantController::ReleasePreviewContents( 368 TabContentsWrapper* InstantController::ReleasePreviewContents(
373 InstantCommitType type, 369 InstantCommitType type,
374 TabContentsWrapper* current_tab) { 370 TabContentsWrapper* current_tab) {
375 if (!loader_.get()) 371 if (!loader_.get())
376 return NULL; 372 return NULL;
377 373
(...skipping 17 matching lines...) Expand all
395 391
396 void InstantController::InstantStatusChanged(InstantLoader* loader) { 392 void InstantController::InstantStatusChanged(InstantLoader* loader) {
397 DCHECK(loader_.get()); 393 DCHECK(loader_.get());
398 UpdateIsDisplayable(); 394 UpdateIsDisplayable();
399 } 395 }
400 396
401 void InstantController::SetSuggestedTextFor( 397 void InstantController::SetSuggestedTextFor(
402 InstantLoader* loader, 398 InstantLoader* loader,
403 const string16& text, 399 const string16& text,
404 InstantCompleteBehavior behavior) { 400 InstantCompleteBehavior behavior) {
405 if (!is_out_of_date_ && 401 if (is_out_of_date_)
406 InstantFieldTrial::ShouldSetSuggestedText(tab_contents_->profile())) { 402 return;
403
404 const InstantFieldTrial::Mode mode =
405 InstantFieldTrial::GetMode(tab_contents_->profile());
406 if (mode == InstantFieldTrial::INSTANT || mode == InstantFieldTrial::SUGGEST)
407 delegate_->SetSuggestedText(text, behavior); 407 delegate_->SetSuggestedText(text, behavior);
408 }
409 } 408 }
410 409
411 gfx::Rect InstantController::GetInstantBounds() { 410 gfx::Rect InstantController::GetInstantBounds() {
412 return delegate_->GetInstantBounds(); 411 return delegate_->GetInstantBounds();
413 } 412 }
414 413
415 bool InstantController::ShouldCommitInstantOnMouseUp() { 414 bool InstantController::ShouldCommitInstantOnMouseUp() {
416 return commit_on_mouse_up_; 415 return commit_on_mouse_up_;
417 } 416 }
418 417
(...skipping 23 matching lines...) Expand all
442 441
443 void InstantController::SwappedTabContents(InstantLoader* loader) { 442 void InstantController::SwappedTabContents(InstantLoader* loader) {
444 if (is_displayable_) 443 if (is_displayable_)
445 delegate_->ShowInstant(loader->preview_contents()); 444 delegate_->ShowInstant(loader->preview_contents());
446 } 445 }
447 446
448 void InstantController::InstantLoaderContentsFocused() { 447 void InstantController::InstantLoaderContentsFocused() {
449 #if defined(USE_AURA) 448 #if defined(USE_AURA)
450 // On aura the omnibox only receives a focus lost if we initiate the focus 449 // On aura the omnibox only receives a focus lost if we initiate the focus
451 // change. This does that. 450 // change. This does that.
452 if (!InstantFieldTrial::IsSilentExperiment(tab_contents_->profile())) 451 if (InstantFieldTrial::GetMode(tab_contents_->profile()) !=
452 InstantFieldTrial::SILENT) {
sreeram 2012/05/03 21:06:21 @sky: Should this instead be: if (InstantFieldTria
sky 2012/05/03 21:22:09 Yes, this should only matter for visible INSTANT m
453 delegate_->InstantPreviewFocused(); 453 delegate_->InstantPreviewFocused();
454 }
454 #endif 455 #endif
455 } 456 }
456 457
457 void InstantController::UpdateIsDisplayable() { 458 void InstantController::UpdateIsDisplayable() {
458 if (!is_out_of_date_ && 459 if (!is_out_of_date_ &&
459 InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile())) { 460 InstantFieldTrial::GetMode(tab_contents_->profile()) !=
461 InstantFieldTrial::INSTANT) {
460 return; 462 return;
461 } 463 }
462 464
463 bool displayable = 465 bool displayable =
464 (!is_out_of_date_ && loader_.get() && loader_->ready() && 466 (!is_out_of_date_ && loader_.get() && loader_->ready() &&
465 loader_->http_status_ok()); 467 loader_->http_status_ok());
466 if (displayable == is_displayable_) 468 if (displayable == is_displayable_)
467 return; 469 return;
468 470
469 is_displayable_ = displayable; 471 is_displayable_ = displayable;
470 if (!is_displayable_) { 472 if (!is_displayable_) {
471 delegate_->HideInstant(); 473 delegate_->HideInstant();
472 } else { 474 } else {
473 delegate_->ShowInstant(loader_->preview_contents()); 475 delegate_->ShowInstant(loader_->preview_contents());
474 content::NotificationService::current()->Notify( 476 content::NotificationService::current()->Notify(
475 chrome::NOTIFICATION_INSTANT_CONTROLLER_SHOWN, 477 chrome::NOTIFICATION_INSTANT_CONTROLLER_SHOWN,
476 content::Source<InstantController>(this), 478 content::Source<InstantController>(this),
477 content::NotificationService::NoDetails()); 479 content::NotificationService::NoDetails());
478 } 480 }
479 } 481 }
480 482
481 void InstantController::UpdateLoader(const TemplateURL* template_url, 483 void InstantController::UpdateLoader(const TemplateURL* template_url,
482 const GURL& url, 484 const GURL& url,
483 content::PageTransition transition_type, 485 content::PageTransition transition_type,
484 const string16& user_text, 486 const string16& user_text,
485 bool verbatim, 487 bool verbatim,
486 string16* suggested_text) { 488 string16* suggested_text) {
487 is_out_of_date_ = false; 489 is_out_of_date_ = false;
488 if (!InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile())) 490 const InstantFieldTrial::Mode mode =
491 InstantFieldTrial::GetMode(tab_contents_->profile());
492 if (mode == InstantFieldTrial::INSTANT)
489 loader_->SetOmniboxBounds(omnibox_bounds_); 493 loader_->SetOmniboxBounds(omnibox_bounds_);
490 loader_->Update(tab_contents_, template_url, url, transition_type, user_text, 494 loader_->Update(tab_contents_, template_url, url, transition_type, user_text,
491 verbatim, suggested_text); 495 verbatim, suggested_text);
492 UpdateIsDisplayable(); 496 UpdateIsDisplayable();
493 // For the HIDDEN and SILENT field trials, don't send back suggestions. 497 // For the HIDDEN and SILENT field trials, don't send back suggestions.
494 if (!InstantFieldTrial::ShouldSetSuggestedText(tab_contents_->profile())) 498 if (mode == InstantFieldTrial::HIDDEN || mode == InstantFieldTrial::SILENT)
495 suggested_text->clear(); 499 suggested_text->clear();
496 } 500 }
497 501
498 // Returns true if |template_url| is a valid TemplateURL for use by instant. 502 // Returns true if |template_url| is a valid TemplateURL for use by instant.
499 bool InstantController::IsValidInstantTemplateURL( 503 bool InstantController::IsValidInstantTemplateURL(
500 const TemplateURL* template_url) { 504 const TemplateURL* template_url) {
501 return template_url && template_url->id() && 505 return template_url && template_url->id() &&
502 template_url->instant_url_ref().SupportsReplacement() && 506 template_url->instant_url_ref().SupportsReplacement() &&
503 !IsBlacklistedFromInstant(template_url->id()); 507 !IsBlacklistedFromInstant(template_url->id());
504 } 508 }
(...skipping 23 matching lines...) Expand all
528 if (!weak_factory_.HasWeakPtrs()) { 532 if (!weak_factory_.HasWeakPtrs()) {
529 MessageLoop::current()->PostTask( 533 MessageLoop::current()->PostTask(
530 FROM_HERE, base::Bind(&InstantController::DestroyLoaders, 534 FROM_HERE, base::Bind(&InstantController::DestroyLoaders,
531 weak_factory_.GetWeakPtr())); 535 weak_factory_.GetWeakPtr()));
532 } 536 }
533 } 537 }
534 538
535 void InstantController::DestroyLoaders() { 539 void InstantController::DestroyLoaders() {
536 loaders_to_destroy_.reset(); 540 loaders_to_destroy_.reset();
537 } 541 }
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_browsertest.cc ('k') | chrome/browser/instant/instant_field_trial.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698