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/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/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 return false; | 485 return false; |
486 | 486 |
487 if (instant_tab_) | 487 if (instant_tab_) |
488 instant_tab_->UpOrDownKeyPressed(count); | 488 instant_tab_->UpOrDownKeyPressed(count); |
489 else | 489 else |
490 loader_->UpOrDownKeyPressed(count); | 490 loader_->UpOrDownKeyPressed(count); |
491 | 491 |
492 return true; | 492 return true; |
493 } | 493 } |
494 | 494 |
| 495 bool InstantController::OnCancel() { |
| 496 if (!extended_enabled_) |
| 497 return false; |
| 498 |
| 499 if (!instant_tab_ && !loader_) |
| 500 return false; |
| 501 |
| 502 if (instant_tab_) |
| 503 instant_tab_->EscKeyPressed(); |
| 504 else |
| 505 loader_->EscKeyPressed(); |
| 506 |
| 507 return true; |
| 508 } |
| 509 |
495 content::WebContents* InstantController::GetPreviewContents() const { | 510 content::WebContents* InstantController::GetPreviewContents() const { |
496 return loader_ ? loader_->contents() : NULL; | 511 return loader_ ? loader_->contents() : NULL; |
497 } | 512 } |
498 | 513 |
499 bool InstantController::IsPreviewingSearchResults() const { | 514 bool InstantController::IsPreviewingSearchResults() const { |
500 return model_.mode().is_search_suggestions() && IsFullHeight(model_) && | 515 return model_.mode().is_search_suggestions() && IsFullHeight(model_) && |
501 (last_match_was_search_ || | 516 (last_match_was_search_ || |
502 last_suggestion_.behavior == INSTANT_COMPLETE_NEVER); | 517 last_suggestion_.behavior == INSTANT_COMPLETE_NEVER); |
503 } | 518 } |
504 | 519 |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 RecordEventHistogram(INSTANT_CONTROLLER_EVENT_URL_BLOCKED_BY_BLACKLIST); | 1324 RecordEventHistogram(INSTANT_CONTROLLER_EVENT_URL_BLOCKED_BY_BLACKLIST); |
1310 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( | 1325 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( |
1311 "GetInstantURL: Instant URL blacklisted: url=%s", | 1326 "GetInstantURL: Instant URL blacklisted: url=%s", |
1312 instant_url->c_str())); | 1327 instant_url->c_str())); |
1313 return false; | 1328 return false; |
1314 } | 1329 } |
1315 } | 1330 } |
1316 | 1331 |
1317 return true; | 1332 return true; |
1318 } | 1333 } |
OLD | NEW |