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_VIEWS_SEARCH_VIEW_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_SEARCH_VIEW_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_SEARCH_VIEW_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_SEARCH_VIEW_CONTROLLER_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 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 // SearchViewController maintains the search overlay (native new tab page). | 33 // SearchViewController maintains the search overlay (native new tab page). |
34 // To avoid ordering dependencies this class listens directly to the | 34 // To avoid ordering dependencies this class listens directly to the |
35 // SearchModel of the active tab. BrowserView is responsible for telling this | 35 // SearchModel of the active tab. BrowserView is responsible for telling this |
36 // class when the active tab changes. | 36 // class when the active tab changes. |
37 class SearchViewController | 37 class SearchViewController |
38 : public chrome::search::SearchModelObserver, | 38 : public chrome::search::SearchModelObserver, |
39 public ui::ImplicitAnimationObserver { | 39 public ui::ImplicitAnimationObserver { |
40 public: | 40 public: |
41 SearchViewController(content::BrowserContext* browser_context, | 41 explicit SearchViewController(ContentsContainer* contents_container); |
42 ContentsContainer* contents_container); | |
43 virtual ~SearchViewController(); | 42 virtual ~SearchViewController(); |
44 | 43 |
45 views::View* omnibox_popup_view_parent(); | 44 views::View* omnibox_popup_view_parent(); |
46 | 45 |
47 void set_location_bar_container( | 46 void set_location_bar_container( |
48 LocationBarContainer* location_bar_container) { | 47 LocationBarContainer* location_bar_container) { |
49 location_bar_container_ = location_bar_container; | 48 location_bar_container_ = location_bar_container; |
50 } | 49 } |
51 | 50 |
52 // Sets the active tab. | 51 // Sets the active tab. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // Create the various views and installs them as an overlay on | 94 // Create the various views and installs them as an overlay on |
96 // |contents_container_|. | 95 // |contents_container_|. |
97 void CreateViews(); | 96 void CreateViews(); |
98 | 97 |
99 // Destroys the various views. | 98 // Destroys the various views. |
100 void DestroyViews(); | 99 void DestroyViews(); |
101 | 100 |
102 // Invoked when the visibility of the omnibox popup changes. | 101 // Invoked when the visibility of the omnibox popup changes. |
103 void PopupVisibilityChanged(); | 102 void PopupVisibilityChanged(); |
104 | 103 |
105 // Load the NTP from the associated |SearchTabHelper| if in NTP mode | |
106 // and the current |tab_contents_| has changed. | |
107 void MaybeLoadNTP(); | |
108 | |
109 // Access active search model. | 104 // Access active search model. |
110 chrome::search::SearchModel* search_model(); | 105 chrome::search::SearchModel* search_model(); |
111 | 106 |
112 // Access active web contents. | 107 // Access active web contents. |
113 content::WebContents* web_contents(); | 108 content::WebContents* web_contents(); |
114 | 109 |
115 // The profile. Weak. | |
116 content::BrowserContext* browser_context_; | |
117 | |
118 // Where the overlay is placed. Weak. | 110 // Where the overlay is placed. Weak. |
119 ContentsContainer* contents_container_; | 111 ContentsContainer* contents_container_; |
120 | 112 |
121 // Weak. | 113 // Weak. |
122 LocationBarContainer* location_bar_container_; | 114 LocationBarContainer* location_bar_container_; |
123 | 115 |
124 State state_; | 116 State state_; |
125 | 117 |
126 // The active TabContents. Weak. May be NULL. | 118 // The active TabContents. Weak. May be NULL. |
127 TabContents* tab_contents_; | 119 TabContents* tab_contents_; |
(...skipping 23 matching lines...) Expand all Loading... |
151 // of any of these views. | 143 // of any of these views. |
152 // | 144 // |
153 // NTPView and OmniboxPopupViewParent are siblings. When on the NTP the | 145 // NTPView and OmniboxPopupViewParent are siblings. When on the NTP the |
154 // OmniboxPopupViewParent is obscured by the NTPView. When on a search page | 146 // OmniboxPopupViewParent is obscured by the NTPView. When on a search page |
155 // the NTPView is hidden. | 147 // the NTPView is hidden. |
156 // | 148 // |
157 // | 149 // |
158 views::View* search_container_; | 150 views::View* search_container_; |
159 views::View* ntp_view_; | 151 views::View* ntp_view_; |
160 views::View* logo_view_; | 152 views::View* logo_view_; |
| 153 |
| 154 // An alias to |contents_container_->active()|, but reparented within |
| 155 // |ntp_view_| when in the NTP state. |
161 views::WebView* content_view_; | 156 views::WebView* content_view_; |
| 157 |
162 OmniboxPopupViewParent* omnibox_popup_view_parent_; | 158 OmniboxPopupViewParent* omnibox_popup_view_parent_; |
163 | 159 |
164 DISALLOW_COPY_AND_ASSIGN(SearchViewController); | 160 DISALLOW_COPY_AND_ASSIGN(SearchViewController); |
165 }; | 161 }; |
166 | 162 |
167 #endif // CHROME_BROWSER_UI_VIEWS_SEARCH_VIEW_CONTROLLER_H_ | 163 #endif // CHROME_BROWSER_UI_VIEWS_SEARCH_VIEW_CONTROLLER_H_ |
OLD | NEW |