Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: chrome/browser/instant/instant_controller.cc

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 } 713 }
714 } 714 }
715 715
716 void InstantController::SendBoundsToPage() { 716 void InstantController::SendBoundsToPage() {
717 if (last_omnibox_bounds_ == omnibox_bounds_ || IsOutOfDate() || 717 if (last_omnibox_bounds_ == omnibox_bounds_ || IsOutOfDate() ||
718 !GetPreviewContents() || loader_->IsPointerDownFromActivate()) 718 !GetPreviewContents() || loader_->IsPointerDownFromActivate())
719 return; 719 return;
720 720
721 last_omnibox_bounds_ = omnibox_bounds_; 721 last_omnibox_bounds_ = omnibox_bounds_;
722 gfx::Rect preview_bounds = delegate_->GetInstantBounds(); 722 gfx::Rect preview_bounds = delegate_->GetInstantBounds();
723 gfx::Rect intersection = omnibox_bounds_.Intersect(preview_bounds); 723 gfx::Rect intersection = omnibox_bounds_;
724 intersection.Intersect(preview_bounds);
724 725
725 // Translate into window coordinates. 726 // Translate into window coordinates.
726 if (!intersection.IsEmpty()) { 727 if (!intersection.IsEmpty()) {
727 intersection.Offset(-preview_bounds.origin().x(), 728 intersection.Offset(-preview_bounds.origin().x(),
728 -preview_bounds.origin().y()); 729 -preview_bounds.origin().y());
729 } 730 }
730 731
731 // In the current Chrome UI, these must always be true so they sanity check 732 // In the current Chrome UI, these must always be true so they sanity check
732 // the above operations. In a future UI, these may be removed or adjusted. 733 // the above operations. In a future UI, these may be removed or adjusted.
733 // There is no point in sanity-checking |intersection.y()| because the omnibox 734 // There is no point in sanity-checking |intersection.y()| because the omnibox
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 iter->second > kMaxInstantSupportFailures) 791 iter->second > kMaxInstantSupportFailures)
791 return false; 792 return false;
792 793
793 return true; 794 return true;
794 } 795 }
795 796
796 bool InstantController::IsOutOfDate() const { 797 bool InstantController::IsOutOfDate() const {
797 return !last_active_tab_ || 798 return !last_active_tab_ ||
798 last_active_tab_ != delegate_->GetActiveTabContents(); 799 last_active_tab_ != delegate_->GetActiveTabContents();
799 } 800 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698