Chromium Code Reviews| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/i18n/case_conversion.h" | 8 #include "base/i18n/case_conversion.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 618 if (loader_ == loader) | 618 if (loader_ == loader) |
| 619 DeleteLoader(); | 619 DeleteLoader(); |
| 620 } | 620 } |
| 621 | 621 |
| 622 content::NotificationService::current()->Notify( | 622 content::NotificationService::current()->Notify( |
| 623 chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED, | 623 chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED, |
| 624 content::Source<InstantController>(this), | 624 content::Source<InstantController>(this), |
| 625 content::NotificationService::NoDetails()); | 625 content::NotificationService::NoDetails()); |
| 626 } | 626 } |
| 627 | 627 |
| 628 void InstantController::OnWebSearchBoxBlur(InstantLoader* loader) { | |
| 629 if (loader_ != loader || mode_ != EXTENDED || | |
| 630 model_.preview_state() != InstantModel::CUSTOM_NTP_CONTENT) | |
| 631 return; | |
| 632 | |
| 633 browser_->OnWebSearchBoxBlur(); | |
|
dhollowa
2012/11/15 21:31:00
BrowserInstantController is not needed to set this
| |
| 634 } | |
| 635 | |
| 636 void InstantController::OnWebSearchBoxFocus(InstantLoader* loader) { | |
| 637 if (loader_ != loader || mode_ != EXTENDED || | |
| 638 model_.preview_state() != InstantModel::CUSTOM_NTP_CONTENT) | |
| 639 return; | |
| 640 | |
| 641 browser_->OnWebSearchBoxFocus(); | |
| 642 } | |
| 643 | |
| 628 void InstantController::SwappedTabContents(InstantLoader* loader) { | 644 void InstantController::SwappedTabContents(InstantLoader* loader) { |
| 629 if (loader_ == loader) | 645 if (loader_ == loader) |
| 630 model_.SetPreviewContents(GetPreviewContents()); | 646 model_.SetPreviewContents(GetPreviewContents()); |
| 631 } | 647 } |
| 632 | 648 |
| 633 void InstantController::InstantLoaderContentsFocused(InstantLoader* loader) { | 649 void InstantController::InstantLoaderContentsFocused(InstantLoader* loader) { |
| 634 #if defined(USE_AURA) | 650 #if defined(USE_AURA) |
| 635 // On aura the omnibox only receives a focus lost if we initiate the focus | 651 // On aura the omnibox only receives a focus lost if we initiate the focus |
| 636 // change. This does that. | 652 // change. This does that. |
| 637 if (model_.preview_state() != InstantModel::NOT_READY) | 653 if (model_.preview_state() != InstantModel::NOT_READY) |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 816 } | 832 } |
| 817 | 833 |
| 818 std::map<std::string, int>::const_iterator iter = | 834 std::map<std::string, int>::const_iterator iter = |
| 819 blacklisted_urls_.find(*instant_url); | 835 blacklisted_urls_.find(*instant_url); |
| 820 if (iter != blacklisted_urls_.end() && | 836 if (iter != blacklisted_urls_.end() && |
| 821 iter->second > kMaxInstantSupportFailures) | 837 iter->second > kMaxInstantSupportFailures) |
| 822 return false; | 838 return false; |
| 823 | 839 |
| 824 return true; | 840 return true; |
| 825 } | 841 } |
| OLD | NEW |