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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
522 verbatim, suggested_text); | 522 verbatim, suggested_text); |
523 UpdateIsDisplayable(); | 523 UpdateIsDisplayable(); |
524 // For the HIDDEN and SILENT field trials, don't send back suggestions. | 524 // For the HIDDEN and SILENT field trials, don't send back suggestions. |
525 if (!InstantFieldTrial::ShouldSetSuggestedText(tab_contents_->profile())) | 525 if (!InstantFieldTrial::ShouldSetSuggestedText(tab_contents_->profile())) |
526 suggested_text->clear(); | 526 suggested_text->clear(); |
527 } | 527 } |
528 | 528 |
529 // Returns true if |template_url| is a valid TemplateURL for use by instant. | 529 // Returns true if |template_url| is a valid TemplateURL for use by instant. |
530 bool InstantController::IsValidInstantTemplateURL( | 530 bool InstantController::IsValidInstantTemplateURL( |
531 const TemplateURL* template_url) { | 531 const TemplateURL* template_url) { |
532 return template_url && template_url->instant_url() && template_url->id() && | 532 return template_url && |
sky
2012/03/30 22:00:29
I think we should keep this id() check. During sta
| |
533 template_url->instant_url()->SupportsReplacement() && | 533 template_url->instant_url_ref().SupportsReplacement() && |
534 !IsBlacklistedFromInstant(template_url->id()); | 534 !IsBlacklistedFromInstant(template_url->id()); |
535 } | 535 } |
536 | 536 |
537 void InstantController::BlacklistFromInstant() { | 537 void InstantController::BlacklistFromInstant() { |
538 if (!loader_.get()) | 538 if (!loader_.get()) |
539 return; | 539 return; |
540 | 540 |
541 DCHECK(loader_->template_url_id()); | 541 DCHECK(loader_->template_url_id()); |
542 blacklisted_ids_.insert(loader_->template_url_id()); | 542 blacklisted_ids_.insert(loader_->template_url_id()); |
543 | 543 |
(...skipping 15 matching lines...) Expand all Loading... | |
559 if (!weak_factory_.HasWeakPtrs()) { | 559 if (!weak_factory_.HasWeakPtrs()) { |
560 MessageLoop::current()->PostTask( | 560 MessageLoop::current()->PostTask( |
561 FROM_HERE, base::Bind(&InstantController::DestroyLoaders, | 561 FROM_HERE, base::Bind(&InstantController::DestroyLoaders, |
562 weak_factory_.GetWeakPtr())); | 562 weak_factory_.GetWeakPtr())); |
563 } | 563 } |
564 } | 564 } |
565 | 565 |
566 void InstantController::DestroyLoaders() { | 566 void InstantController::DestroyLoaders() { |
567 loaders_to_destroy_.reset(); | 567 loaders_to_destroy_.reset(); |
568 } | 568 } |
OLD | NEW |