| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tab_contents/match_preview.h" | 5 #include "chrome/browser/tab_contents/match_preview.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 | 498 |
| 499 omnibox_bounds_ = bounds; | 499 omnibox_bounds_ = bounds; |
| 500 if (preview_contents_.get() && is_showing_instant() && | 500 if (preview_contents_.get() && is_showing_instant() && |
| 501 !is_waiting_for_load()) { | 501 !is_waiting_for_load()) { |
| 502 SendOmniboxBoundsScript(preview_contents_.get(), | 502 SendOmniboxBoundsScript(preview_contents_.get(), |
| 503 GetOmniboxBoundsInTermsOfPreview()); | 503 GetOmniboxBoundsInTermsOfPreview()); |
| 504 } | 504 } |
| 505 } | 505 } |
| 506 | 506 |
| 507 void MatchPreview::DestroyPreviewContents() { | 507 void MatchPreview::DestroyPreviewContents() { |
| 508 if (!preview_contents_.get()) { |
| 509 // We're not showing anything, nothing to do. |
| 510 return; |
| 511 } |
| 512 |
| 508 delegate_->HideMatchPreview(); | 513 delegate_->HideMatchPreview(); |
| 509 delete ReleasePreviewContents(false); | 514 delete ReleasePreviewContents(false); |
| 510 } | 515 } |
| 511 | 516 |
| 512 void MatchPreview::CommitCurrentPreview() { | 517 void MatchPreview::CommitCurrentPreview() { |
| 513 DCHECK(preview_contents_.get()); | 518 DCHECK(preview_contents_.get()); |
| 514 delegate_->CommitMatchPreview(); | 519 delegate_->CommitMatchPreview(); |
| 515 } | 520 } |
| 516 | 521 |
| 517 TabContents* MatchPreview::ReleasePreviewContents(bool commit_history) { | 522 TabContents* MatchPreview::ReleasePreviewContents(bool commit_history) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 gfx::Rect MatchPreview::GetOmniboxBoundsInTermsOfPreview() { | 579 gfx::Rect MatchPreview::GetOmniboxBoundsInTermsOfPreview() { |
| 575 if (omnibox_bounds_.IsEmpty()) | 580 if (omnibox_bounds_.IsEmpty()) |
| 576 return omnibox_bounds_; | 581 return omnibox_bounds_; |
| 577 | 582 |
| 578 gfx::Rect preview_bounds(delegate_->GetMatchPreviewBounds()); | 583 gfx::Rect preview_bounds(delegate_->GetMatchPreviewBounds()); |
| 579 return gfx::Rect(omnibox_bounds_.x() - preview_bounds.x(), | 584 return gfx::Rect(omnibox_bounds_.x() - preview_bounds.x(), |
| 580 omnibox_bounds_.y() - preview_bounds.y(), | 585 omnibox_bounds_.y() - preview_bounds.y(), |
| 581 omnibox_bounds_.width(), | 586 omnibox_bounds_.width(), |
| 582 omnibox_bounds_.height()); | 587 omnibox_bounds_.height()); |
| 583 } | 588 } |
| OLD | NEW |