Chromium Code Reviews| 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 (IsOutOfDate() && !active_tab_is_ntp_)) | |
|
sreeram
2012/10/10 18:57:04
Don't do the IsOutOfDate or active_tab_is_ntp_ che
Jered
2012/10/10 22:10:48
Done.
| |
| 557 return; | |
| 558 | |
| 559 delegate_->SetHasCustomLogo(has_logo); | |
| 560 } | |
| 561 | |
| 553 void InstantController::CommitInstantLoader(InstantLoader* loader) { | 562 void InstantController::CommitInstantLoader(InstantLoader* loader) { |
| 554 if (loader_ != loader || !is_showing_ || IsOutOfDate()) | 563 if (loader_ != loader || !is_showing_ || IsOutOfDate()) |
| 555 return; | 564 return; |
| 556 | 565 |
| 557 CommitCurrentPreview(INSTANT_COMMIT_FOCUS_LOST); | 566 CommitCurrentPreview(INSTANT_COMMIT_FOCUS_LOST); |
| 558 } | 567 } |
| 559 | 568 |
| 560 void InstantController::SetInstantPreviewHeight(InstantLoader* loader, | 569 void InstantController::SetInstantPreviewHeight(InstantLoader* loader, |
| 561 int height, | 570 int height, |
| 562 InstantSizeUnits units) { | 571 InstantSizeUnits units) { |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 813 DCHECK(url_obj.is_valid()); | 822 DCHECK(url_obj.is_valid()); |
| 814 *instant_url = url_obj.spec(); | 823 *instant_url = url_obj.spec(); |
| 815 } | 824 } |
| 816 } | 825 } |
| 817 } | 826 } |
| 818 | 827 |
| 819 bool InstantController::IsOutOfDate() const { | 828 bool InstantController::IsOutOfDate() const { |
| 820 return !last_active_tab_ || | 829 return !last_active_tab_ || |
| 821 last_active_tab_ != delegate_->GetActiveTabContents(); | 830 last_active_tab_ != delegate_->GetActiveTabContents(); |
| 822 } | 831 } |
| OLD | NEW |