| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/location.h" |
| 11 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/platform_util.h" | 15 #include "chrome/browser/platform_util.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/search/instant_service.h" | 17 #include "chrome/browser/search/instant_service.h" |
| 15 #include "chrome/browser/search/instant_service_factory.h" | 18 #include "chrome/browser/search/instant_service_factory.h" |
| 16 #include "chrome/browser/search/search.h" | 19 #include "chrome/browser/search/search.h" |
| 17 #include "chrome/browser/search_engines/template_url_service_factory.h" | 20 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 18 #include "chrome/browser/ui/browser_instant_controller.h" | 21 #include "chrome/browser/ui/browser_instant_controller.h" |
| 19 #include "chrome/browser/ui/search/instant_tab.h" | 22 #include "chrome/browser/ui/search/instant_tab.h" |
| 20 #include "chrome/browser/ui/search/search_tab_helper.h" | 23 #include "chrome/browser/ui/search/search_tab_helper.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 146 |
| 144 ResetInstantTab(); | 147 ResetInstantTab(); |
| 145 } | 148 } |
| 146 | 149 |
| 147 void InstantController::InstantSupportDetermined( | 150 void InstantController::InstantSupportDetermined( |
| 148 const content::WebContents* contents, | 151 const content::WebContents* contents, |
| 149 bool supports_instant) { | 152 bool supports_instant) { |
| 150 DCHECK(IsContentsFrom(instant_tab(), contents)); | 153 DCHECK(IsContentsFrom(instant_tab(), contents)); |
| 151 | 154 |
| 152 if (!supports_instant) | 155 if (!supports_instant) |
| 153 base::MessageLoop::current()->DeleteSoon(FROM_HERE, instant_tab_.release()); | 156 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, |
| 157 instant_tab_.release()); |
| 154 | 158 |
| 155 content::NotificationService::current()->Notify( | 159 content::NotificationService::current()->Notify( |
| 156 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, | 160 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, |
| 157 content::Source<InstantController>(this), | 161 content::Source<InstantController>(this), |
| 158 content::NotificationService::NoDetails()); | 162 content::NotificationService::NoDetails()); |
| 159 } | 163 } |
| 160 | 164 |
| 161 void InstantController::InstantPageAboutToNavigateMainFrame( | 165 void InstantController::InstantPageAboutToNavigateMainFrame( |
| 162 const content::WebContents* contents, | 166 const content::WebContents* contents, |
| 163 const GURL& url) { | 167 const GURL& url) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 188 if (instant_service) { | 192 if (instant_service) { |
| 189 instant_service->UpdateThemeInfo(); | 193 instant_service->UpdateThemeInfo(); |
| 190 instant_service->UpdateMostVisitedItemsInfo(); | 194 instant_service->UpdateMostVisitedItemsInfo(); |
| 191 } | 195 } |
| 192 } | 196 } |
| 193 } | 197 } |
| 194 | 198 |
| 195 InstantService* InstantController::GetInstantService() const { | 199 InstantService* InstantController::GetInstantService() const { |
| 196 return InstantServiceFactory::GetForProfile(profile()); | 200 return InstantServiceFactory::GetForProfile(profile()); |
| 197 } | 201 } |
| OLD | NEW |