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

Side by Side Diff: chrome/browser/ui/search/instant_overlay_model.cc

Issue 22694002: InstantExtended: Nuke InstantOverlayController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/search/instant_overlay_model.h"
6
7 #include "chrome/browser/ui/search/instant_controller.h"
8 #include "chrome/browser/ui/search/instant_overlay_model_observer.h"
9
10 InstantOverlayModel::InstantOverlayModel(InstantController* controller)
11 : height_(0),
12 height_units_(INSTANT_SIZE_PIXELS),
13 overlay_contents_(NULL),
14 controller_(controller) {
15 }
16
17 InstantOverlayModel::~InstantOverlayModel() {
18 }
19
20 void InstantOverlayModel::SetOverlayState(const SearchMode& mode,
21 int height,
22 InstantSizeUnits height_units) {
23 if (mode_.mode == mode.mode && height_ == height &&
24 height_units_ == height_units) {
25 // Mode::mode hasn't changed, but perhaps bits that we ignore (such as
26 // Mode::origin) have. Update |mode_| anyway, so it's consistent with the
27 // argument (so mode() doesn't return something unexpected).
28 mode_ = mode;
29 return;
30 }
31
32 DVLOG(1) << "SetOverlayState: " << mode_.mode << " to " << mode.mode;
33 mode_ = mode;
34 height_ = height;
35 height_units_ = height_units;
36
37 FOR_EACH_OBSERVER(InstantOverlayModelObserver, observers_,
38 OverlayStateChanged(*this));
39 }
40
41 void InstantOverlayModel::SetOverlayContents(
42 content::WebContents* overlay_contents) {
43 if (overlay_contents_ == overlay_contents)
44 return;
45
46 overlay_contents_ = overlay_contents;
47
48 FOR_EACH_OBSERVER(InstantOverlayModelObserver, observers_,
49 OverlayStateChanged(*this));
50 }
51
52 content::WebContents* InstantOverlayModel::GetOverlayContents() const {
53 return overlay_contents_;
54 }
55
56 void InstantOverlayModel::AddObserver(InstantOverlayModelObserver* observer) {
57 observers_.AddObserver(observer);
58 }
59
60 void InstantOverlayModel::RemoveObserver(
61 InstantOverlayModelObserver* observer) {
62 observers_.RemoveObserver(observer);
63 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_overlay_model.h ('k') | chrome/browser/ui/search/instant_overlay_model_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698