| 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_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_DELEGATE_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" |
| 11 #include "chrome/browser/ui/search/search_model_observer.h" |
| 12 |
| 13 class TabContents; |
| 14 |
| 15 namespace chrome { |
| 16 namespace search { |
| 17 |
| 18 class SearchModel; |
| 19 |
| 20 // The SearchDelegate class acts as a helper to the Browser class. |
| 21 // It is responsible for routing the changes from the active tab's |
| 22 // SearchModel through to the toolbar, tabstrip and other UI |
| 23 // observers. |
| 24 // Changes are propagated from the active tab's model via this class to the |
| 25 // Browser-level model. |
| 26 class SearchDelegate : public SearchModelObserver { |
| 27 public: |
| 28 explicit SearchDelegate(SearchModel* model); |
| 29 virtual ~SearchDelegate(); |
| 30 |
| 31 // Overrides for SearchModelObserver: |
| 32 virtual void ModeChanged(const Mode& mode) OVERRIDE; |
| 33 |
| 34 // When the active tab is changed, the model state of this new active tab is |
| 35 // propagated to the browser. |
| 36 void OnTabActivated(TabContents* contents); |
| 37 |
| 38 // When a tab is closed, this class no longer observes changes to the |
| 39 // tab's model. |
| 40 void OnTabClosing(TabContents* contents); |
| 41 |
| 42 // When a tab is deactivated, this class no longer observes changes to the |
| 43 // tab's model. |
| 44 void OnTabDeactivated(TabContents* contents); |
| 45 |
| 46 // When a tab is dettached, this class no longer observes changes to the |
| 47 // tab's model. |
| 48 void OnTabDettached(TabContents* contents); |
| 49 |
| 50 private: |
| 51 // Stop observing tab. |
| 52 void StopObserveringTab(TabContents* contents); |
| 53 |
| 54 // Weak. The Browser class owns this. The active |tab_model_| state is |
| 55 // propagated to the |browser_model_|. |
| 56 SearchModel* browser_model_; |
| 57 |
| 58 // Weak. The TabContents owns this. It is the model of the active |
| 59 // tab. Changes to this model are propagated through to the |browser_model_|. |
| 60 SearchModel* tab_model_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(SearchDelegate); |
| 63 }; |
| 64 |
| 65 } // namespace search |
| 66 } // namespace chrome |
| 67 |
| 68 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_DELEGATE_H_ |
| OLD | NEW |