Chromium Code Reviews| 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" |
| 11 #include "ui/compositor/layer_animation_observer.h" | 11 #include "ui/compositor/layer_animation_observer.h" |
| 12 | 12 |
| 13 class ContentsContainer; | 13 class ContentsContainer; |
| 14 class LocationBarContainer; | 14 class LocationBarContainer; |
| 15 class TabContents; | 15 class TabContents; |
| 16 | 16 |
| 17 namespace chrome { | 17 namespace chrome { |
| 18 namespace search { | 18 namespace search { |
| 19 class SearchModel; | 19 class SearchModel; |
| 20 } | 20 } |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 class BrowserContext; | 24 class BrowserContext; |
| 25 class WebContents; | 25 class WebContents; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace views { | 28 namespace views { |
| 29 class ImageView; | |
| 30 class Label; | |
| 29 class View; | 31 class View; |
| 30 class WebView; | 32 class WebView; |
| 31 } | 33 } |
| 32 | 34 |
| 33 // SearchViewController maintains the search overlay (native new tab page). | 35 // SearchViewController maintains the search overlay (native new tab page). |
| 34 // To avoid ordering dependencies this class listens directly to the | 36 // To avoid ordering dependencies this class listens directly to the |
| 35 // SearchModel of the active tab. BrowserView is responsible for telling this | 37 // SearchModel of the active tab. BrowserView is responsible for telling this |
| 36 // class when the active tab changes. | 38 // class when the active tab changes. |
| 37 class SearchViewController | 39 class SearchViewController |
| 38 : public chrome::search::SearchModelObserver, | 40 : public chrome::search::SearchModelObserver, |
| 39 public ui::ImplicitAnimationObserver { | 41 public ui::ImplicitAnimationObserver { |
| 40 public: | 42 public: |
| 41 explicit SearchViewController(ContentsContainer* contents_container); | 43 SearchViewController(content::BrowserContext* browser_context, |
| 44 ContentsContainer* contents_container); | |
| 42 virtual ~SearchViewController(); | 45 virtual ~SearchViewController(); |
| 43 | 46 |
| 44 views::View* omnibox_popup_view_parent(); | 47 views::View* omnibox_popup_view_parent(); |
| 45 | 48 |
| 46 void set_location_bar_container( | 49 void set_location_bar_container( |
| 47 LocationBarContainer* location_bar_container) { | 50 LocationBarContainer* location_bar_container) { |
| 48 location_bar_container_ = location_bar_container; | 51 location_bar_container_ = location_bar_container; |
| 49 } | 52 } |
| 50 | 53 |
| 51 // Sets the active tab. | 54 // Sets the active tab. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 // from the current state of the SearchModel. | 92 // from the current state of the SearchModel. |
| 90 void SetState(State state); | 93 void SetState(State state); |
| 91 | 94 |
| 92 // Starts the animation. | 95 // Starts the animation. |
| 93 void StartAnimation(); | 96 void StartAnimation(); |
| 94 | 97 |
| 95 // Create the various views and installs them as an overlay on | 98 // Create the various views and installs them as an overlay on |
| 96 // |contents_container_|. | 99 // |contents_container_|. |
| 97 void CreateViews(); | 100 void CreateViews(); |
| 98 | 101 |
| 102 // Return the logo image view, or a label if an image is not available. | |
| 103 views::View* GetLogoView() const; | |
| 104 | |
| 99 // Destroys the various views. | 105 // Destroys the various views. |
| 100 void DestroyViews(); | 106 void DestroyViews(); |
| 101 | 107 |
| 102 // Invoked when the visibility of the omnibox popup changes. | 108 // Invoked when the visibility of the omnibox popup changes. |
| 103 void PopupVisibilityChanged(); | 109 void PopupVisibilityChanged(); |
| 104 | 110 |
| 105 // Access active search model. | 111 // Access active search model. |
| 106 chrome::search::SearchModel* search_model(); | 112 chrome::search::SearchModel* search_model(); |
| 107 | 113 |
| 108 // Access active web contents. | 114 // Access active web contents. |
| 109 content::WebContents* web_contents(); | 115 content::WebContents* web_contents(); |
| 110 | 116 |
| 117 // The profile. Weak. | |
| 118 content::BrowserContext* browser_context_; | |
| 119 | |
| 111 // Where the overlay is placed. Weak. | 120 // Where the overlay is placed. Weak. |
| 112 ContentsContainer* contents_container_; | 121 ContentsContainer* contents_container_; |
| 113 | 122 |
| 114 // Weak. | 123 // Weak. |
| 115 LocationBarContainer* location_bar_container_; | 124 LocationBarContainer* location_bar_container_; |
| 116 | 125 |
| 117 State state_; | 126 State state_; |
| 118 | 127 |
| 119 // The active TabContents. Weak. May be NULL. | 128 // The active TabContents. Weak. May be NULL. |
| 120 TabContents* tab_contents_; | 129 TabContents* tab_contents_; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 143 // * - the LocationBarContainer gets positioned here, but it is not a child | 152 // * - the LocationBarContainer gets positioned here, but it is not a child |
| 144 // of any of these views. | 153 // of any of these views. |
| 145 // | 154 // |
| 146 // NTPView and OmniboxPopupViewParent are siblings. When on the NTP the | 155 // NTPView and OmniboxPopupViewParent are siblings. When on the NTP the |
| 147 // OmniboxPopupViewParent is obscured by the NTPView. When on a search page | 156 // OmniboxPopupViewParent is obscured by the NTPView. When on a search page |
| 148 // the NTPView is hidden. | 157 // the NTPView is hidden. |
| 149 // | 158 // |
| 150 // | 159 // |
| 151 views::View* search_container_; | 160 views::View* search_container_; |
| 152 views::View* ntp_view_; | 161 views::View* ntp_view_; |
| 153 views::View* logo_view_; | 162 // The default provider's name label, used if an image is unavailable. |
|
Peter Kasting
2012/08/16 03:52:41
Nit: Might be clearer to write as:
// The defau
msw
2012/08/16 08:29:08
Done.
| |
| 154 | 163 views::Label* logo_label_; |
| 164 // The default provider's logo image, used if an image is available. | |
| 165 views::ImageView* logo_image_; | |
| 155 // An alias to |contents_container_->active()|, but reparented within | 166 // An alias to |contents_container_->active()|, but reparented within |
| 156 // |ntp_view_| when in the NTP state. | 167 // |ntp_view_| when in the NTP state. |
| 157 views::WebView* content_view_; | 168 views::WebView* content_view_; |
| 158 | 169 |
| 159 OmniboxPopupViewParent* omnibox_popup_view_parent_; | 170 OmniboxPopupViewParent* omnibox_popup_view_parent_; |
| 160 | 171 |
| 161 DISALLOW_COPY_AND_ASSIGN(SearchViewController); | 172 DISALLOW_COPY_AND_ASSIGN(SearchViewController); |
| 162 }; | 173 }; |
| 163 | 174 |
| 164 #endif // CHROME_BROWSER_UI_VIEWS_SEARCH_VIEW_CONTROLLER_H_ | 175 #endif // CHROME_BROWSER_UI_VIEWS_SEARCH_VIEW_CONTROLLER_H_ |
| OLD | NEW |