Index: chrome/browser/instant/instant_model.cc |
diff --git a/chrome/browser/instant/instant_model.cc b/chrome/browser/instant/instant_model.cc |
index cf61ae30380b3fc9241921d796774a2e2057aab0..77bc0dd35f2d60e959695a00d2c7a8d9dd2257e2 100644 |
--- a/chrome/browser/instant/instant_model.cc |
+++ b/chrome/browser/instant/instant_model.cc |
@@ -4,55 +4,36 @@ |
#include "chrome/browser/instant/instant_model.h" |
-#include "chrome/browser/instant/instant_controller.h" |
+#include "base/stringprintf.h" |
#include "chrome/browser/instant/instant_model_observer.h" |
+#include "chrome/browser/instant/instant_service.h" |
-InstantModel::InstantModel(InstantController* controller) |
- : height_(0), |
- height_units_(INSTANT_SIZE_PIXELS), |
- preview_contents_(NULL), |
- controller_(controller) { |
+InstantModel::InstantModel(InstantService* service) |
+ : overlay_(NULL), |
+ height_(0), |
+ is_height_in_pixels_(false), |
+ service_(service) { |
} |
InstantModel::~InstantModel() { |
} |
-void InstantModel::SetPreviewState(const chrome::search::Mode& mode, |
+void InstantModel::SetOverlayState(content::WebContents* overlay, |
int height, |
- InstantSizeUnits height_units) { |
- if (mode_.mode == mode.mode && height_ == height && |
- height_units_ == height_units) { |
- // Mode::mode hasn't changed, but perhaps bits that we ignore (such as |
- // Mode::origin) have. Update |mode_| anyway, so it's consistent with the |
- // argument (so InstantModel::mode() doesn't return something unexpected). |
- mode_ = mode; |
+ bool is_height_in_pixels) { |
+ if (overlay_ == overlay && height_ == height && |
+ is_height_in_pixels_ == is_height_in_pixels) |
return; |
- } |
- DVLOG(1) << "SetPreviewState: " << mode_.mode << " to " << mode.mode; |
- mode_ = mode; |
+ service_->LogDebugEvent(base::StringPrintf("%p SetOverlayState %s", |
+ this, |
+ overlay ? "showed" : "hidden")); |
+ overlay_ = overlay; |
height_ = height; |
- height_units_ = height_units; |
+ is_height_in_pixels_ = is_height_in_pixels; |
FOR_EACH_OBSERVER(InstantModelObserver, observers_, |
- PreviewStateChanged(*this)); |
-} |
- |
-void InstantModel::SetPreviewContents(content::WebContents* preview_contents) { |
- if (preview_contents_ == preview_contents) |
- return; |
- |
- preview_contents_ = preview_contents; |
- |
- FOR_EACH_OBSERVER(InstantModelObserver, observers_, |
- PreviewStateChanged(*this)); |
-} |
- |
-content::WebContents* InstantModel::GetPreviewContents() const { |
- // |controller_| maybe NULL durning tests. |
- if (controller_) |
- return controller_->GetPreviewContents(); |
- return preview_contents_; |
+ OverlayStateChanged(*this)); |
} |
void InstantModel::AddObserver(InstantModelObserver* observer) { |