| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/i18n/case_conversion.h" | 8 #include "base/i18n/case_conversion.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 | 543 |
| 544 last_suggestion_ = suggestion; | 544 last_suggestion_ = suggestion; |
| 545 if (!last_verbatim_) | 545 if (!last_verbatim_) |
| 546 delegate_->SetSuggestedText(suggestion.text, suggestion.behavior); | 546 delegate_->SetSuggestedText(suggestion.text, suggestion.behavior); |
| 547 } | 547 } |
| 548 | 548 |
| 549 if (mode_ != SUGGEST) | 549 if (mode_ != SUGGEST) |
| 550 Show(100, INSTANT_SIZE_PERCENT); | 550 Show(100, INSTANT_SIZE_PERCENT); |
| 551 } | 551 } |
| 552 | 552 |
| 553 void InstantController::SetHasCustomLogo(InstantLoader* loader, |
| 554 bool has_logo) { |
| 555 if (loader_ != loader || mode_ != EXTENDED) |
| 556 return; |
| 557 |
| 558 delegate_->SetHasCustomLogo(has_logo); |
| 559 } |
| 560 |
| 553 void InstantController::CommitInstantLoader(InstantLoader* loader) { | 561 void InstantController::CommitInstantLoader(InstantLoader* loader) { |
| 554 if (loader_ != loader || !is_showing_ || IsOutOfDate()) | 562 if (loader_ != loader || !is_showing_ || IsOutOfDate()) |
| 555 return; | 563 return; |
| 556 | 564 |
| 557 CommitCurrentPreview(INSTANT_COMMIT_FOCUS_LOST); | 565 CommitCurrentPreview(INSTANT_COMMIT_FOCUS_LOST); |
| 558 } | 566 } |
| 559 | 567 |
| 560 void InstantController::SetInstantPreviewHeight(InstantLoader* loader, | 568 void InstantController::SetInstantPreviewHeight(InstantLoader* loader, |
| 561 int height, | 569 int height, |
| 562 InstantSizeUnits units) { | 570 InstantSizeUnits units) { |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 DCHECK(url_obj.is_valid()); | 821 DCHECK(url_obj.is_valid()); |
| 814 *instant_url = url_obj.spec(); | 822 *instant_url = url_obj.spec(); |
| 815 } | 823 } |
| 816 } | 824 } |
| 817 } | 825 } |
| 818 | 826 |
| 819 bool InstantController::IsOutOfDate() const { | 827 bool InstantController::IsOutOfDate() const { |
| 820 return !last_active_tab_ || | 828 return !last_active_tab_ || |
| 821 last_active_tab_ != delegate_->GetActiveTabContents(); | 829 last_active_tab_ != delegate_->GetActiveTabContents(); |
| 822 } | 830 } |
| OLD | NEW |