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