| 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_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_SEARCH_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "chrome/browser/ui/search/search_model_observer.h" | 10 #include "chrome/browser/ui/search/search_model_observer.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // observers. | 21 // observers. |
| 22 // Changes are propagated from the active tab's model via this class to the | 22 // Changes are propagated from the active tab's model via this class to the |
| 23 // Browser-level model. | 23 // Browser-level model. |
| 24 class SearchDelegate : public SearchModelObserver { | 24 class SearchDelegate : public SearchModelObserver { |
| 25 public: | 25 public: |
| 26 explicit SearchDelegate(SearchModel* browser_search_model); | 26 explicit SearchDelegate(SearchModel* browser_search_model); |
| 27 virtual ~SearchDelegate(); | 27 virtual ~SearchDelegate(); |
| 28 | 28 |
| 29 // Overrides for SearchModelObserver: | 29 // Overrides for SearchModelObserver: |
| 30 virtual void ModelChanged(const SearchModel::State& old_state, | 30 virtual void ModelChanged(const SearchModel::State& old_state, |
| 31 const SearchModel::State& new_state) OVERRIDE; | 31 const SearchModel::State& new_state) override; |
| 32 | 32 |
| 33 // When the active tab is changed, the model state of this new active tab is | 33 // When the active tab is changed, the model state of this new active tab is |
| 34 // propagated to the browser. | 34 // propagated to the browser. |
| 35 void OnTabActivated(content::WebContents* web_contents); | 35 void OnTabActivated(content::WebContents* web_contents); |
| 36 | 36 |
| 37 // When a tab is deactivated, this class no longer observes changes to the | 37 // When a tab is deactivated, this class no longer observes changes to the |
| 38 // tab's model. | 38 // tab's model. |
| 39 void OnTabDeactivated(content::WebContents* web_contents); | 39 void OnTabDeactivated(content::WebContents* web_contents); |
| 40 | 40 |
| 41 // When a tab is detached, this class no longer observes changes to the | 41 // When a tab is detached, this class no longer observes changes to the |
| 42 // tab's model. | 42 // tab's model. |
| 43 void OnTabDetached(content::WebContents* web_contents); | 43 void OnTabDetached(content::WebContents* web_contents); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 // Stop observing tab. | 46 // Stop observing tab. |
| 47 void StopObservingTab(content::WebContents* web_contents); | 47 void StopObservingTab(content::WebContents* web_contents); |
| 48 | 48 |
| 49 // Weak. The Browser class owns this. The active |tab_model_| state is | 49 // Weak. The Browser class owns this. The active |tab_model_| state is |
| 50 // propagated to the |browser_model_|. | 50 // propagated to the |browser_model_|. |
| 51 SearchModel* browser_model_; | 51 SearchModel* browser_model_; |
| 52 | 52 |
| 53 // Weak. The WebContents owns this. It is the model of the active | 53 // Weak. The WebContents owns this. It is the model of the active |
| 54 // tab. Changes to this model are propagated through to the |browser_model_|. | 54 // tab. Changes to this model are propagated through to the |browser_model_|. |
| 55 SearchModel* tab_model_; | 55 SearchModel* tab_model_; |
| 56 | 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(SearchDelegate); | 57 DISALLOW_COPY_AND_ASSIGN(SearchDelegate); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_DELEGATE_H_ | 60 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_DELEGATE_H_ |
| OLD | NEW |