OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 int64 enable_time = service->GetInt64(prefs::kInstantEnabledTime); | 129 int64 enable_time = service->GetInt64(prefs::kInstantEnabledTime); |
130 if (enable_time) { | 130 if (enable_time) { |
131 base::TimeDelta delta = | 131 base::TimeDelta delta = |
132 base::Time::Now() - base::Time::FromInternalValue(enable_time); | 132 base::Time::Now() - base::Time::FromInternalValue(enable_time); |
133 // Histogram from 1 minute to 10 days. | 133 // Histogram from 1 minute to 10 days. |
134 UMA_HISTOGRAM_CUSTOM_COUNTS("Instant.TimeToDisable.Predictive", | 134 UMA_HISTOGRAM_CUSTOM_COUNTS("Instant.TimeToDisable.Predictive", |
135 delta.InMinutes(), 1, 60 * 24 * 10, 50); | 135 delta.InMinutes(), 1, 60 * 24 * 10, 50); |
136 } | 136 } |
137 | 137 |
| 138 service->SetBoolean(prefs::kInstantEnabledOnce, true); |
138 service->SetBoolean(prefs::kInstantEnabled, false); | 139 service->SetBoolean(prefs::kInstantEnabled, false); |
139 } | 140 } |
140 | 141 |
141 // static | 142 // static |
142 bool InstantController::CommitIfCurrent(InstantController* controller) { | 143 bool InstantController::CommitIfCurrent(InstantController* controller) { |
143 if (controller && controller->IsCurrent()) { | 144 if (controller && controller->IsCurrent()) { |
144 controller->CommitCurrentPreview(INSTANT_COMMIT_PRESSED_ENTER); | 145 controller->CommitCurrentPreview(INSTANT_COMMIT_PRESSED_ENTER); |
145 return true; | 146 return true; |
146 } | 147 } |
147 return false; | 148 return false; |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 if (destroy_factory_.empty()) { | 733 if (destroy_factory_.empty()) { |
733 MessageLoop::current()->PostTask( | 734 MessageLoop::current()->PostTask( |
734 FROM_HERE, destroy_factory_.NewRunnableMethod( | 735 FROM_HERE, destroy_factory_.NewRunnableMethod( |
735 &InstantController::DestroyLoaders)); | 736 &InstantController::DestroyLoaders)); |
736 } | 737 } |
737 } | 738 } |
738 | 739 |
739 void InstantController::DestroyLoaders() { | 740 void InstantController::DestroyLoaders() { |
740 loaders_to_destroy_.reset(); | 741 loaders_to_destroy_.reset(); |
741 } | 742 } |
OLD | NEW |