| 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" | 10 #include "base/location.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 search_mode_ = new_mode; | 101 search_mode_ = new_mode; |
| 102 ResetInstantTab(); | 102 ResetInstantTab(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void InstantController::ActiveTabChanged() { | 105 void InstantController::ActiveTabChanged() { |
| 106 LOG_INSTANT_DEBUG_EVENT(this, "ActiveTabChanged"); | 106 LOG_INSTANT_DEBUG_EVENT(this, "ActiveTabChanged"); |
| 107 ResetInstantTab(); | 107 ResetInstantTab(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void InstantController::TabDeactivated(content::WebContents* contents) { | 110 void InstantController::TabDeactivated(content::WebContents* contents) { |
| 111 // If user is deactivating an NTP tab, log the number of mouseovers for this | 111 // If user is deactivating an NTP tab, give it a change to log stats. |
| 112 // NTP session. | |
| 113 if (search::IsInstantNTP(contents)) | 112 if (search::IsInstantNTP(contents)) |
| 114 InstantTab::EmitNtpStatistics(contents); | 113 InstantTab::TabDeactivated(contents); |
| 115 } | 114 } |
| 116 | 115 |
| 117 void InstantController::LogDebugEvent(const std::string& info) const { | 116 void InstantController::LogDebugEvent(const std::string& info) const { |
| 118 DVLOG(1) << info; | 117 DVLOG(1) << info; |
| 119 | 118 |
| 120 debug_events_.push_front(std::make_pair( | 119 debug_events_.push_front(std::make_pair( |
| 121 base::Time::Now().ToInternalValue(), info)); | 120 base::Time::Now().ToInternalValue(), info)); |
| 122 static const size_t kMaxDebugEventSize = 2000; | 121 static const size_t kMaxDebugEventSize = 2000; |
| 123 if (debug_events_.size() > kMaxDebugEventSize) | 122 if (debug_events_.size() > kMaxDebugEventSize) |
| 124 debug_events_.pop_back(); | 123 debug_events_.pop_back(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 if (instant_service) { | 191 if (instant_service) { |
| 193 instant_service->UpdateThemeInfo(); | 192 instant_service->UpdateThemeInfo(); |
| 194 instant_service->UpdateMostVisitedItemsInfo(); | 193 instant_service->UpdateMostVisitedItemsInfo(); |
| 195 } | 194 } |
| 196 } | 195 } |
| 197 } | 196 } |
| 198 | 197 |
| 199 InstantService* InstantController::GetInstantService() const { | 198 InstantService* InstantController::GetInstantService() const { |
| 200 return InstantServiceFactory::GetForProfile(profile()); | 199 return InstantServiceFactory::GetForProfile(profile()); |
| 201 } | 200 } |
| OLD | NEW |