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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
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) { | |
111 // If user is deactivating an NTP tab, give it a change to log stats. | |
112 if (search::IsInstantNTP(contents)) | |
113 InstantTab::TabDeactivated(contents); | |
114 } | |
115 | |
116 void InstantController::LogDebugEvent(const std::string& info) const { | 110 void InstantController::LogDebugEvent(const std::string& info) const { |
117 DVLOG(1) << info; | 111 DVLOG(1) << info; |
118 | 112 |
119 debug_events_.push_front(std::make_pair( | 113 debug_events_.push_front(std::make_pair( |
120 base::Time::Now().ToInternalValue(), info)); | 114 base::Time::Now().ToInternalValue(), info)); |
121 static const size_t kMaxDebugEventSize = 2000; | 115 static const size_t kMaxDebugEventSize = 2000; |
122 if (debug_events_.size() > kMaxDebugEventSize) | 116 if (debug_events_.size() > kMaxDebugEventSize) |
123 debug_events_.pop_back(); | 117 debug_events_.pop_back(); |
124 } | 118 } |
125 | 119 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 if (instant_service) { | 185 if (instant_service) { |
192 instant_service->UpdateThemeInfo(); | 186 instant_service->UpdateThemeInfo(); |
193 instant_service->UpdateMostVisitedItemsInfo(); | 187 instant_service->UpdateMostVisitedItemsInfo(); |
194 } | 188 } |
195 } | 189 } |
196 } | 190 } |
197 | 191 |
198 InstantService* InstantController::GetInstantService() const { | 192 InstantService* InstantController::GetInstantService() const { |
199 return InstantServiceFactory::GetForProfile(profile()); | 193 return InstantServiceFactory::GetForProfile(profile()); |
200 } | 194 } |
OLD | NEW |