OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ui/search/instant_controller.h" | 5 #include "chrome/browser/ui/search/instant_controller.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 if (IsContentsFrom(overlay(), contents)) { | 1242 if (IsContentsFrom(overlay(), contents)) { |
1243 overlay_->sender()->SetDisplayInstantResults(instant_enabled_); | 1243 overlay_->sender()->SetDisplayInstantResults(instant_enabled_); |
1244 overlay_->sender()->FocusChanged(omnibox_focus_state_, | 1244 overlay_->sender()->FocusChanged(omnibox_focus_state_, |
1245 omnibox_focus_change_reason_); | 1245 omnibox_focus_change_reason_); |
1246 overlay_->sender()->SetOmniboxBounds(omnibox_bounds_); | 1246 overlay_->sender()->SetOmniboxBounds(omnibox_bounds_); |
1247 overlay_->InitializeFonts(); | 1247 overlay_->InitializeFonts(); |
1248 } else if (IsContentsFrom(ntp(), contents)) { | 1248 } else if (IsContentsFrom(ntp(), contents)) { |
1249 ntp_->sender()->SetDisplayInstantResults(instant_enabled_); | 1249 ntp_->sender()->SetDisplayInstantResults(instant_enabled_); |
1250 ntp_->sender()->SetOmniboxBounds(omnibox_bounds_); | 1250 ntp_->sender()->SetOmniboxBounds(omnibox_bounds_); |
1251 ntp_->InitializeFonts(); | 1251 ntp_->InitializeFonts(); |
| 1252 ntp_->InitializePromos(); |
1252 } else { | 1253 } else { |
1253 NOTREACHED(); | 1254 NOTREACHED(); |
1254 } | 1255 } |
1255 UpdateMostVisitedItems(); | 1256 UpdateMostVisitedItems(); |
1256 } | 1257 } |
1257 | 1258 |
1258 void InstantController::InstantSupportChanged( | 1259 void InstantController::InstantSupportChanged( |
1259 InstantSupportState instant_support) { | 1260 InstantSupportState instant_support) { |
1260 // Handle INSTANT_SUPPORT_YES here because InstantPage is not hooked up to the | 1261 // Handle INSTANT_SUPPORT_YES here because InstantPage is not hooked up to the |
1261 // active tab. Search model changed listener in InstantPage will handle other | 1262 // active tab. Search model changed listener in InstantPage will handle other |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1681 if (instant_tab_) { | 1682 if (instant_tab_) { |
1682 instant_tab_->sender()->SetDisplayInstantResults(instant_enabled_); | 1683 instant_tab_->sender()->SetDisplayInstantResults(instant_enabled_); |
1683 instant_tab_->sender()->SetOmniboxBounds(omnibox_bounds_); | 1684 instant_tab_->sender()->SetOmniboxBounds(omnibox_bounds_); |
1684 | 1685 |
1685 // Update theme details. | 1686 // Update theme details. |
1686 InstantService* instant_service = GetInstantService(); | 1687 InstantService* instant_service = GetInstantService(); |
1687 if (instant_service) | 1688 if (instant_service) |
1688 instant_service->UpdateThemeInfo(); | 1689 instant_service->UpdateThemeInfo(); |
1689 | 1690 |
1690 instant_tab_->InitializeFonts(); | 1691 instant_tab_->InitializeFonts(); |
| 1692 instant_tab_->InitializePromos(); |
1691 UpdateMostVisitedItems(); | 1693 UpdateMostVisitedItems(); |
1692 instant_tab_->sender()->FocusChanged(omnibox_focus_state_, | 1694 instant_tab_->sender()->FocusChanged(omnibox_focus_state_, |
1693 omnibox_focus_change_reason_); | 1695 omnibox_focus_change_reason_); |
1694 instant_tab_->sender()->SetInputInProgress(IsInputInProgress()); | 1696 instant_tab_->sender()->SetInputInProgress(IsInputInProgress()); |
1695 } | 1697 } |
1696 } | 1698 } |
1697 | 1699 |
1698 bool InstantController::IsInputInProgress() const { | 1700 bool InstantController::IsInputInProgress() const { |
1699 return !search_mode_.is_ntp() && | 1701 return !search_mode_.is_ntp() && |
1700 omnibox_focus_state_ == OMNIBOX_FOCUS_VISIBLE; | 1702 omnibox_focus_state_ == OMNIBOX_FOCUS_VISIBLE; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1920 | 1922 |
1921 bool InstantController::InStartup() const { | 1923 bool InstantController::InStartup() const { |
1922 // TODO(shishir): This is not completely reliable. Find a better way to detect | 1924 // TODO(shishir): This is not completely reliable. Find a better way to detect |
1923 // startup time. | 1925 // startup time. |
1924 return !browser_->GetActiveWebContents(); | 1926 return !browser_->GetActiveWebContents(); |
1925 } | 1927 } |
1926 | 1928 |
1927 InstantService* InstantController::GetInstantService() const { | 1929 InstantService* InstantController::GetInstantService() const { |
1928 return InstantServiceFactory::GetForProfile(profile()); | 1930 return InstantServiceFactory::GetForProfile(profile()); |
1929 } | 1931 } |
OLD | NEW |