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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 return false; | 502 return false; |
503 | 503 |
504 if (instant_tab_) | 504 if (instant_tab_) |
505 instant_tab_->UpOrDownKeyPressed(count); | 505 instant_tab_->UpOrDownKeyPressed(count); |
506 else | 506 else |
507 overlay_->UpOrDownKeyPressed(count); | 507 overlay_->UpOrDownKeyPressed(count); |
508 | 508 |
509 return true; | 509 return true; |
510 } | 510 } |
511 | 511 |
| 512 bool InstantController::OnCancel(string16 user_text) { |
| 513 if (!extended_enabled_) |
| 514 return false; |
| 515 |
| 516 if (!instant_tab_ && !overlay_) |
| 517 return false; |
| 518 |
| 519 if (instant_tab_) |
| 520 instant_tab_->CancelSelection(user_text); |
| 521 else |
| 522 overlay_->CancelSelection(user_text); |
| 523 |
| 524 return true; |
| 525 } |
| 526 |
512 content::WebContents* InstantController::GetPreviewContents() const { | 527 content::WebContents* InstantController::GetPreviewContents() const { |
513 return overlay_ ? overlay_->contents() : NULL; | 528 return overlay_ ? overlay_->contents() : NULL; |
514 } | 529 } |
515 | 530 |
516 bool InstantController::IsPreviewingSearchResults() const { | 531 bool InstantController::IsPreviewingSearchResults() const { |
517 return model_.mode().is_search_suggestions() && IsFullHeight(model_) && | 532 return model_.mode().is_search_suggestions() && IsFullHeight(model_) && |
518 (last_match_was_search_ || | 533 (last_match_was_search_ || |
519 last_suggestion_.behavior == INSTANT_COMPLETE_NEVER); | 534 last_suggestion_.behavior == INSTANT_COMPLETE_NEVER); |
520 } | 535 } |
521 | 536 |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 delete overlay_->ReleaseContents().release(); | 1413 delete overlay_->ReleaseContents().release(); |
1399 MessageLoop::current()->DeleteSoon(FROM_HERE, overlay_.release()); | 1414 MessageLoop::current()->DeleteSoon(FROM_HERE, overlay_.release()); |
1400 EnsureOverlayIsCurrent(false); | 1415 EnsureOverlayIsCurrent(false); |
1401 } | 1416 } |
1402 | 1417 |
1403 void InstantController::RemoveFromBlacklist(const std::string& url) { | 1418 void InstantController::RemoveFromBlacklist(const std::string& url) { |
1404 if (blacklisted_urls_.erase(url)) { | 1419 if (blacklisted_urls_.erase(url)) { |
1405 RecordEventHistogram(INSTANT_CONTROLLER_EVENT_URL_REMOVED_FROM_BLACKLIST); | 1420 RecordEventHistogram(INSTANT_CONTROLLER_EVENT_URL_REMOVED_FROM_BLACKLIST); |
1406 } | 1421 } |
1407 } | 1422 } |
OLD | NEW |