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

Side by Side Diff: chrome/browser/ui/search/search_model.h

Issue 10944016: Switch SearchTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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
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 #ifndef CHROME_BROWSER_UI_SEARCH_SEARCH_MODEL_H_ 5 #ifndef CHROME_BROWSER_UI_SEARCH_SEARCH_MODEL_H_
6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_MODEL_H_ 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_MODEL_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/observer_list.h" 9 #include "base/observer_list.h"
10 #include "chrome/browser/ui/search/search_types.h" 10 #include "chrome/browser/ui/search/search_types.h"
11 11
12 class TabContents;
13
14 namespace content { 12 namespace content {
15 class WebContents; 13 class WebContents;
16 } 14 }
17 15
18 namespace chrome { 16 namespace chrome {
19 namespace search { 17 namespace search {
20 18
21 class SearchModelObserver; 19 class SearchModelObserver;
22 20
23 // An observable model for UI components that care about search model state 21 // An observable model for UI components that care about search model state
24 // changes. 22 // changes.
25 class SearchModel { 23 class SearchModel {
26 public: 24 public:
27 explicit SearchModel(TabContents* contents); 25 explicit SearchModel(content::WebContents* web_contents);
28 ~SearchModel(); 26 ~SearchModel();
29 27
30 // Change the mode. Change notifications are sent to observers. An animated 28 // Change the mode. Change notifications are sent to observers. An animated
31 // transition may be requested. 29 // transition may be requested.
32 void SetMode(const Mode& mode); 30 void SetMode(const Mode& mode);
33 31
34 // Get the active mode. 32 // Get the active mode.
35 const Mode& mode() const { return mode_; } 33 const Mode& mode() const { return mode_; }
36 34
37 // Add and remove observers. 35 // Add and remove observers.
38 void AddObserver(SearchModelObserver* observer); 36 void AddObserver(SearchModelObserver* observer);
39 void RemoveObserver(SearchModelObserver* observer); 37 void RemoveObserver(SearchModelObserver* observer);
40 38
41 // This can be NULL if this is the browser model and it's accessed during 39 // This can be NULL if this is the browser model and it's accessed during
42 // startup or shutdown. 40 // startup or shutdown.
43 const TabContents* tab_contents() const { 41 const content::WebContents* web_contents() const {
44 return contents_; 42 return web_contents_;
45 } 43 }
46 44
47 void set_tab_contents(TabContents* contents) { 45 void set_web_contents(content::WebContents* web_contents) {
48 contents_ = contents; 46 web_contents_ = web_contents;
49 } 47 }
50 48
51 private: 49 private:
52 // The display mode of UI elements such as the toolbar, the tab strip, etc. 50 // The display mode of UI elements such as the toolbar, the tab strip, etc.
53 Mode mode_; 51 Mode mode_;
54 52
55 // Weak. Used to access current profile to determine incognito status. 53 // Weak. Used to access current profile to determine incognito status.
56 TabContents* contents_; 54 content::WebContents* web_contents_;
57 55
58 // Observers. 56 // Observers.
59 ObserverList<SearchModelObserver> observers_; 57 ObserverList<SearchModelObserver> observers_;
60 58
61 DISALLOW_COPY_AND_ASSIGN(SearchModel); 59 DISALLOW_COPY_AND_ASSIGN(SearchModel);
62 }; 60 };
63 61
64 } // namespace search 62 } // namespace search
65 } // namespace chrome 63 } // namespace chrome
66 64
67 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_MODEL_H_ 65 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698