OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ash/common/shelf/shelf_widget.h" | 5 #include "ash/common/shelf/shelf_widget.h" |
6 | 6 |
7 #include "ash/common/focus_cycler.h" | 7 #include "ash/common/focus_cycler.h" |
8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
10 #include "ash/common/shelf/app_list_button.h" | 10 #include "ash/common/shelf/app_list_button.h" |
11 #include "ash/common/shelf/shelf_background_animator_observer.h" | 11 #include "ash/common/shelf/shelf_background_animator_observer.h" |
12 #include "ash/common/shelf/shelf_constants.h" | 12 #include "ash/common/shelf/shelf_constants.h" |
13 #include "ash/common/shelf/shelf_delegate.h" | 13 #include "ash/common/shelf/shelf_delegate.h" |
14 #include "ash/common/shelf/shelf_layout_manager.h" | 14 #include "ash/common/shelf/shelf_layout_manager.h" |
15 #include "ash/common/shelf/shelf_view.h" | 15 #include "ash/common/shelf/shelf_view.h" |
16 #include "ash/common/shelf/wm_shelf.h" | 16 #include "ash/common/shelf/wm_shelf.h" |
17 #include "ash/common/shelf/wm_shelf_util.h" | 17 #include "ash/common/shelf/wm_shelf_util.h" |
| 18 #include "ash/common/system/chromeos/network/sms_observer.h" |
18 #include "ash/common/system/status_area_layout_manager.h" | 19 #include "ash/common/system/status_area_layout_manager.h" |
19 #include "ash/common/system/status_area_widget.h" | 20 #include "ash/common/system/status_area_widget.h" |
20 #include "ash/common/wm_lookup.h" | 21 #include "ash/common/wm_lookup.h" |
21 #include "ash/common/wm_shell.h" | 22 #include "ash/common/wm_shell.h" |
22 #include "ash/common/wm_window.h" | 23 #include "ash/common/wm_window.h" |
23 #include "ash/common/wm_window_property.h" | 24 #include "ash/common/wm_window_property.h" |
24 #include "ash/root_window_controller.h" | 25 #include "ash/root_window_controller.h" |
25 #include "base/memory/ptr_util.h" | 26 #include "base/memory/ptr_util.h" |
26 #include "grit/ash_resources.h" | 27 #include "grit/ash_resources.h" |
27 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 216 |
216 ShelfWidget::ShelfWidget(WmWindow* shelf_container, WmShelf* wm_shelf) | 217 ShelfWidget::ShelfWidget(WmWindow* shelf_container, WmShelf* wm_shelf) |
217 : wm_shelf_(wm_shelf), | 218 : wm_shelf_(wm_shelf), |
218 status_area_widget_(nullptr), | 219 status_area_widget_(nullptr), |
219 delegate_view_(new DelegateView(wm_shelf, this)), | 220 delegate_view_(new DelegateView(wm_shelf, this)), |
220 shelf_view_(nullptr), | 221 shelf_view_(nullptr), |
221 background_animator_(SHELF_BACKGROUND_DEFAULT, wm_shelf_), | 222 background_animator_(SHELF_BACKGROUND_DEFAULT, wm_shelf_), |
222 activating_as_fallback_(false) { | 223 activating_as_fallback_(false) { |
223 background_animator_.AddObserver(this); | 224 background_animator_.AddObserver(this); |
224 background_animator_.AddObserver(delegate_view_); | 225 background_animator_.AddObserver(delegate_view_); |
| 226 sms_observer_.reset(new SmsObserver()); |
225 | 227 |
226 views::Widget::InitParams params( | 228 views::Widget::InitParams params( |
227 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 229 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
228 params.name = "ShelfWidget"; | 230 params.name = "ShelfWidget"; |
229 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 231 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
230 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 232 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
231 params.delegate = delegate_view_; | 233 params.delegate = delegate_view_; |
232 shelf_container->GetRootWindowController() | 234 shelf_container->GetRootWindowController() |
233 ->ConfigureWidgetInitParamsForContainer( | 235 ->ConfigureWidgetInitParamsForContainer( |
234 this, shelf_container->GetShellWindowId(), ¶ms); | 236 this, shelf_container->GetShellWindowId(), ¶ms); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 // access it later in shutdown. | 379 // access it later in shutdown. |
378 if (shelf_layout_manager_) | 380 if (shelf_layout_manager_) |
379 shelf_layout_manager_->PrepareForShutdown(); | 381 shelf_layout_manager_->PrepareForShutdown(); |
380 | 382 |
381 if (status_area_widget_) { | 383 if (status_area_widget_) { |
382 background_animator_.RemoveObserver(status_area_widget_); | 384 background_animator_.RemoveObserver(status_area_widget_); |
383 WmShell::Get()->focus_cycler()->RemoveWidget(status_area_widget_); | 385 WmShell::Get()->focus_cycler()->RemoveWidget(status_area_widget_); |
384 status_area_widget_->Shutdown(); | 386 status_area_widget_->Shutdown(); |
385 status_area_widget_ = nullptr; | 387 status_area_widget_ = nullptr; |
386 } | 388 } |
387 | |
388 CloseNow(); | 389 CloseNow(); |
389 } | 390 } |
390 | 391 |
391 void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) { | 392 void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) { |
392 if (!shelf_view_) | 393 if (!shelf_view_) |
393 return; | 394 return; |
394 | 395 |
395 WmWindow* shelf_window = WmLookup::Get()->GetWindowForWidget(this); | 396 WmWindow* shelf_window = WmLookup::Get()->GetWindowForWidget(this); |
396 shelf_view_->UpdatePanelIconPosition( | 397 shelf_view_->UpdatePanelIconPosition( |
397 panel->GetIntProperty(WmWindowProperty::SHELF_ID), | 398 panel->GetIntProperty(WmWindowProperty::SHELF_ID), |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 if (shelf_view_) | 437 if (shelf_view_) |
437 shelf_view_->UpdateShelfItemBackground(alpha); | 438 shelf_view_->UpdateShelfItemBackground(alpha); |
438 } | 439 } |
439 | 440 |
440 void ShelfWidget::WillDeleteShelfLayoutManager() { | 441 void ShelfWidget::WillDeleteShelfLayoutManager() { |
441 shelf_layout_manager_->RemoveObserver(this); | 442 shelf_layout_manager_->RemoveObserver(this); |
442 shelf_layout_manager_ = nullptr; | 443 shelf_layout_manager_ = nullptr; |
443 } | 444 } |
444 | 445 |
445 } // namespace ash | 446 } // namespace ash |
OLD | NEW |