OLD | NEW |
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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 explicit SearchModel(TabContents* contents); | 29 explicit SearchModel(TabContents* contents); |
30 ~SearchModel(); | 30 ~SearchModel(); |
31 | 31 |
32 // Change the mode. Change notifications are sent to observers. An animated | 32 // Change the mode. Change notifications are sent to observers. An animated |
33 // transition may be requested. | 33 // transition may be requested. |
34 void SetMode(const Mode& mode); | 34 void SetMode(const Mode& mode); |
35 | 35 |
36 // Get the active mode. | 36 // Get the active mode. |
37 const Mode& mode() const { return mode_; } | 37 const Mode& mode() const { return mode_; } |
38 | 38 |
39 // Change the mode to |to_mode| only if |from_mode| is the active mode. | |
40 void MaybeChangeMode(Mode::Type from_mode, Mode::Type to_mode); | |
41 | |
42 // Add and remove observers. | 39 // Add and remove observers. |
43 void AddObserver(SearchModelObserver* observer); | 40 void AddObserver(SearchModelObserver* observer); |
44 void RemoveObserver(SearchModelObserver* observer); | 41 void RemoveObserver(SearchModelObserver* observer); |
45 | 42 |
46 // This can be NULL if this is the browser model and it's accessed during | 43 // This can be NULL if this is the browser model and it's accessed during |
47 // startup or shutdown. | 44 // startup or shutdown. |
48 const TabContents* tab_contents() const { | 45 const TabContents* tab_contents() const { |
49 return contents_; | 46 return contents_; |
50 } | 47 } |
51 | 48 |
(...skipping 11 matching lines...) Expand all Loading... |
63 // Observers. | 60 // Observers. |
64 ObserverList<SearchModelObserver> observers_; | 61 ObserverList<SearchModelObserver> observers_; |
65 | 62 |
66 DISALLOW_COPY_AND_ASSIGN(SearchModel); | 63 DISALLOW_COPY_AND_ASSIGN(SearchModel); |
67 }; | 64 }; |
68 | 65 |
69 } // namespace search | 66 } // namespace search |
70 } // namespace chrome | 67 } // namespace chrome |
71 | 68 |
72 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_MODEL_H_ | 69 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_MODEL_H_ |
OLD | NEW |