OLD | NEW |
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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 verbatim, suggested_text); | 491 verbatim, suggested_text); |
492 UpdateIsDisplayable(); | 492 UpdateIsDisplayable(); |
493 // For the HIDDEN and SILENT field trials, don't send back suggestions. | 493 // For the HIDDEN and SILENT field trials, don't send back suggestions. |
494 if (!InstantFieldTrial::ShouldSetSuggestedText(tab_contents_->profile())) | 494 if (!InstantFieldTrial::ShouldSetSuggestedText(tab_contents_->profile())) |
495 suggested_text->clear(); | 495 suggested_text->clear(); |
496 } | 496 } |
497 | 497 |
498 // Returns true if |template_url| is a valid TemplateURL for use by instant. | 498 // Returns true if |template_url| is a valid TemplateURL for use by instant. |
499 bool InstantController::IsValidInstantTemplateURL( | 499 bool InstantController::IsValidInstantTemplateURL( |
500 const TemplateURL* template_url) { | 500 const TemplateURL* template_url) { |
501 return template_url && template_url->id() && | 501 return template_url && template_url->instant_url() && template_url->id() && |
502 template_url->instant_url_ref().SupportsReplacement() && | 502 template_url->instant_url()->SupportsReplacement() && |
503 !IsBlacklistedFromInstant(template_url->id()); | 503 !IsBlacklistedFromInstant(template_url->id()); |
504 } | 504 } |
505 | 505 |
506 void InstantController::BlacklistFromInstant() { | 506 void InstantController::BlacklistFromInstant() { |
507 if (!loader_.get()) | 507 if (!loader_.get()) |
508 return; | 508 return; |
509 | 509 |
510 DCHECK(loader_->template_url_id()); | 510 DCHECK(loader_->template_url_id()); |
511 blacklisted_ids_.insert(loader_->template_url_id()); | 511 blacklisted_ids_.insert(loader_->template_url_id()); |
512 | 512 |
(...skipping 15 matching lines...) Expand all Loading... |
528 if (!weak_factory_.HasWeakPtrs()) { | 528 if (!weak_factory_.HasWeakPtrs()) { |
529 MessageLoop::current()->PostTask( | 529 MessageLoop::current()->PostTask( |
530 FROM_HERE, base::Bind(&InstantController::DestroyLoaders, | 530 FROM_HERE, base::Bind(&InstantController::DestroyLoaders, |
531 weak_factory_.GetWeakPtr())); | 531 weak_factory_.GetWeakPtr())); |
532 } | 532 } |
533 } | 533 } |
534 | 534 |
535 void InstantController::DestroyLoaders() { | 535 void InstantController::DestroyLoaders() { |
536 loaders_to_destroy_.reset(); | 536 loaders_to_destroy_.reset(); |
537 } | 537 } |
OLD | NEW |