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

Unified Diff: chrome/browser/instant/instant_overlay_model.cc

Issue 12386019: Instant: Use only one hidden WebContents per profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/instant/instant_overlay_model.cc
diff --git a/chrome/browser/instant/instant_overlay_model.cc b/chrome/browser/instant/instant_overlay_model.cc
index f08b74a9ad2f41135232f000b8d8d1e86aa69167..834d1b5e428942360c9b4ea421eebd4d8a6b2db4 100644
--- a/chrome/browser/instant/instant_overlay_model.cc
+++ b/chrome/browser/instant/instant_overlay_model.cc
@@ -4,33 +4,31 @@
#include "chrome/browser/instant/instant_overlay_model.h"
-#include "chrome/browser/instant/instant_controller.h"
+#include "base/stringprintf.h"
#include "chrome/browser/instant/instant_overlay_model_observer.h"
+#include "chrome/browser/instant/instant_service.h"
-InstantOverlayModel::InstantOverlayModel(InstantController* controller)
- : height_(0),
- height_units_(INSTANT_SIZE_PIXELS),
- overlay_contents_(NULL),
- controller_(controller) {
+InstantOverlayModel::InstantOverlayModel(InstantService* service)
+ : contents_(NULL),
+ height_(0),
+ height_units_(INSTANT_SIZE_PIXELS),
+ service_(service) {
}
InstantOverlayModel::~InstantOverlayModel() {
}
-void InstantOverlayModel::SetOverlayState(const chrome::search::Mode& mode,
+void InstantOverlayModel::SetOverlayState(content::WebContents* contents,
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 mode() doesn't return something unexpected).
- mode_ = mode;
+ if (contents_ == contents && height_ == height &&
+ height_units_ == height_units)
return;
- }
- DVLOG(1) << "SetOverlayState: " << mode_.mode << " to " << mode.mode;
- mode_ = mode;
+ service_->LogDebugEvent(base::StringPrintf("%p SetOverlayState %s",
+ this,
+ contents ? "show" : "hide"));
+ contents_ = contents;
height_ = height;
height_units_ = height_units;
@@ -38,24 +36,6 @@ void InstantOverlayModel::SetOverlayState(const chrome::search::Mode& mode,
OverlayStateChanged(*this));
}
-void InstantOverlayModel::SetOverlayContents(
- content::WebContents* overlay_contents) {
- if (overlay_contents_ == overlay_contents)
- return;
-
- overlay_contents_ = overlay_contents;
-
- FOR_EACH_OBSERVER(InstantOverlayModelObserver, observers_,
- OverlayStateChanged(*this));
-}
-
-content::WebContents* InstantOverlayModel::GetOverlayContents() const {
- // |controller_| maybe NULL durning tests.
- if (controller_)
- return controller_->GetOverlayContents();
- return overlay_contents_;
-}
-
void InstantOverlayModel::AddObserver(InstantOverlayModelObserver* observer) {
observers_.AddObserver(observer);
}

Powered by Google App Engine
This is Rietveld 408576698