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 #include "ui/app_list/views/app_list_view.h" | 5 #include "ui/app_list/views/app_list_view.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "ui/app_list/app_list_constants.h" | 8 #include "ui/app_list/app_list_constants.h" |
9 #include "ui/app_list/app_list_model.h" | 9 #include "ui/app_list/app_list_model.h" |
10 #include "ui/app_list/app_list_view_delegate.h" | 10 #include "ui/app_list/app_list_view_delegate.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 SizeToContents(); // Repositions view relative to the anchor. | 121 SizeToContents(); // Repositions view relative to the anchor. |
122 } | 122 } |
123 | 123 |
124 void AppListView::ShowWhenReady() { | 124 void AppListView::ShowWhenReady() { |
125 app_list_main_view_->ShowAppListWhenReady(); | 125 app_list_main_view_->ShowAppListWhenReady(); |
126 } | 126 } |
127 | 127 |
128 void AppListView::Close() { | 128 void AppListView::Close() { |
129 app_list_main_view_->Close(); | 129 app_list_main_view_->Close(); |
130 | 130 |
131 if (delegate_.get()) | 131 if (delegate_) |
132 delegate_->Dismiss(); | 132 delegate_->Dismiss(); |
133 else | 133 else |
134 GetWidget()->Close(); | 134 GetWidget()->Close(); |
135 } | 135 } |
136 | 136 |
137 void AppListView::UpdateBounds() { | 137 void AppListView::UpdateBounds() { |
138 SizeToContents(); | 138 SizeToContents(); |
139 } | 139 } |
140 | 140 |
141 gfx::Size AppListView::GetPreferredSize() { | 141 gfx::Size AppListView::GetPreferredSize() { |
(...skipping 14 matching lines...) Expand all Loading... |
156 | 156 |
157 signin_view_->SetVisible(needs_signin); | 157 signin_view_->SetVisible(needs_signin); |
158 app_list_main_view_->SetVisible(!needs_signin); | 158 app_list_main_view_->SetVisible(!needs_signin); |
159 } | 159 } |
160 | 160 |
161 views::View* AppListView::GetInitiallyFocusedView() { | 161 views::View* AppListView::GetInitiallyFocusedView() { |
162 return app_list_main_view_->search_box_view()->search_box(); | 162 return app_list_main_view_->search_box_view()->search_box(); |
163 } | 163 } |
164 | 164 |
165 gfx::ImageSkia AppListView::GetWindowIcon() { | 165 gfx::ImageSkia AppListView::GetWindowIcon() { |
166 if (delegate_.get()) | 166 if (delegate_) |
167 return delegate_->GetWindowIcon(); | 167 return delegate_->GetWindowIcon(); |
168 | 168 |
169 return gfx::ImageSkia(); | 169 return gfx::ImageSkia(); |
170 } | 170 } |
171 | 171 |
172 bool AppListView::WidgetHasHitTestMask() const { | 172 bool AppListView::WidgetHasHitTestMask() const { |
173 return true; | 173 return true; |
174 } | 174 } |
175 | 175 |
176 void AppListView::GetWidgetHitTestMask(gfx::Path* mask) const { | 176 void AppListView::GetWidgetHitTestMask(gfx::Path* mask) const { |
(...skipping 13 matching lines...) Expand all Loading... |
190 } | 190 } |
191 | 191 |
192 void AppListView::Layout() { | 192 void AppListView::Layout() { |
193 const gfx::Rect contents_bounds = GetContentsBounds(); | 193 const gfx::Rect contents_bounds = GetContentsBounds(); |
194 app_list_main_view_->SetBoundsRect(contents_bounds); | 194 app_list_main_view_->SetBoundsRect(contents_bounds); |
195 signin_view_->SetBoundsRect(contents_bounds); | 195 signin_view_->SetBoundsRect(contents_bounds); |
196 } | 196 } |
197 | 197 |
198 void AppListView::OnWidgetDestroying(views::Widget* widget) { | 198 void AppListView::OnWidgetDestroying(views::Widget* widget) { |
199 BubbleDelegateView::OnWidgetDestroying(widget); | 199 BubbleDelegateView::OnWidgetDestroying(widget); |
200 if (delegate_.get() && widget == GetWidget()) | 200 if (delegate_ && widget == GetWidget()) |
201 delegate_->ViewClosing(); | 201 delegate_->ViewClosing(); |
202 } | 202 } |
203 | 203 |
204 void AppListView::OnWidgetActivationChanged(views::Widget* widget, | 204 void AppListView::OnWidgetActivationChanged(views::Widget* widget, |
205 bool active) { | 205 bool active) { |
206 // Do not called inherited function as the bubble delegate auto close | 206 // Do not called inherited function as the bubble delegate auto close |
207 // functionality is not used. | 207 // functionality is not used. |
208 if (delegate_.get() && widget == GetWidget()) | 208 if (delegate_ && widget == GetWidget()) |
209 delegate_->ViewActivationChanged(active); | 209 delegate_->ViewActivationChanged(active); |
210 } | 210 } |
211 | 211 |
212 void AppListView::OnWidgetVisibilityChanged(views::Widget* widget, | 212 void AppListView::OnWidgetVisibilityChanged(views::Widget* widget, |
213 bool visible) { | 213 bool visible) { |
214 BubbleDelegateView::OnWidgetVisibilityChanged(widget, visible); | 214 BubbleDelegateView::OnWidgetVisibilityChanged(widget, visible); |
215 | 215 |
216 if (widget != GetWidget()) | 216 if (widget != GetWidget()) |
217 return; | 217 return; |
218 | 218 |
219 // Whether we need to signin or not may have changed since last time we were | 219 // Whether we need to signin or not may have changed since last time we were |
220 // shown. | 220 // shown. |
221 Layout(); | 221 Layout(); |
222 } | 222 } |
223 | 223 |
224 void AppListView::OnSigninSuccess() { | 224 void AppListView::OnSigninSuccess() { |
225 OnSigninStatusChanged(); | 225 OnSigninStatusChanged(); |
226 } | 226 } |
227 | 227 |
228 SigninDelegate* AppListView::GetSigninDelegate() { | 228 SigninDelegate* AppListView::GetSigninDelegate() { |
229 return delegate_ ? delegate_->GetSigninDelegate() : NULL; | 229 return delegate_ ? delegate_->GetSigninDelegate() : NULL; |
230 } | 230 } |
231 | 231 |
232 } // namespace app_list | 232 } // namespace app_list |
OLD | NEW |