| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_SEARCH_SEARCH_MODEL_H_ |
| 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_MODEL_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/observer_list.h" |
| 11 #include "chrome/browser/ui/search/search_types.h" |
| 12 #include "third_party/skia/include/core/SkColor.h" |
| 13 #include "ui/gfx/rect.h" |
| 14 |
| 15 class TabContents; |
| 16 |
| 17 namespace content { |
| 18 class WebContents; |
| 19 } |
| 20 |
| 21 namespace chrome { |
| 22 namespace search { |
| 23 |
| 24 class SearchModelObserver; |
| 25 |
| 26 // An observable model for UI components that care about search model state |
| 27 // changes. |
| 28 class SearchModel { |
| 29 public: |
| 30 explicit SearchModel(TabContents* contents); |
| 31 ~SearchModel(); |
| 32 |
| 33 // Change the mode. Change notifications are sent to observers. An animated |
| 34 // transition may be requested. |
| 35 void SetMode(const Mode& mode); |
| 36 |
| 37 // Get the active mode. |
| 38 const Mode& mode() const { return mode_; } |
| 39 |
| 40 // Change the mode to |to_mode| only if |from_mode| is the active mode. |
| 41 void MaybeChangeMode(Mode::Type from_mode, Mode::Type to_mode); |
| 42 |
| 43 // Add and remove observers. |
| 44 void AddObserver(SearchModelObserver* observer); |
| 45 void RemoveObserver(SearchModelObserver* observer); |
| 46 |
| 47 // This can be NULL if this is the browser model and it's accessed during |
| 48 // startup or shutdown. |
| 49 const TabContents* tab_contents() const { |
| 50 return contents_; |
| 51 } |
| 52 |
| 53 void set_tab_contents(TabContents* contents) { |
| 54 contents_ = contents; |
| 55 } |
| 56 |
| 57 private: |
| 58 // The display mode of UI elements such as the toolbar, the tab strip, etc. |
| 59 Mode mode_; |
| 60 |
| 61 // Weak. Used to access current profile to determine incognito status. |
| 62 TabContents* contents_; |
| 63 |
| 64 // Observers. |
| 65 ObserverList<SearchModelObserver> observers_; |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(SearchModel); |
| 68 }; |
| 69 |
| 70 } // namespace search |
| 71 } // namespace chrome |
| 72 |
| 73 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_MODEL_H_ |
| OLD | NEW |