Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: ash/common/shelf/shelf_widget.cc

Issue 2690543003: Send notification to users upon receiving sms messages (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/session/session_state_delegate.h" 8 #include "ash/common/session/session_state_delegate.h"
9 #include "ash/common/shelf/app_list_button.h" 9 #include "ash/common/shelf/app_list_button.h"
10 #include "ash/common/shelf/shelf_background_animator_observer.h" 10 #include "ash/common/shelf/shelf_background_animator_observer.h"
11 #include "ash/common/shelf/shelf_constants.h" 11 #include "ash/common/shelf/shelf_constants.h"
12 #include "ash/common/shelf/shelf_delegate.h" 12 #include "ash/common/shelf/shelf_delegate.h"
13 #include "ash/common/shelf/shelf_layout_manager.h" 13 #include "ash/common/shelf/shelf_layout_manager.h"
14 #include "ash/common/shelf/shelf_view.h" 14 #include "ash/common/shelf/shelf_view.h"
15 #include "ash/common/shelf/wm_shelf.h" 15 #include "ash/common/shelf/wm_shelf.h"
16 #include "ash/common/shelf/wm_shelf_util.h" 16 #include "ash/common/shelf/wm_shelf_util.h"
17 #include "ash/common/system/chromeos/network/sms_observer.h"
17 #include "ash/common/system/status_area_layout_manager.h" 18 #include "ash/common/system/status_area_layout_manager.h"
18 #include "ash/common/system/status_area_widget.h" 19 #include "ash/common/system/status_area_widget.h"
19 #include "ash/common/wm_lookup.h" 20 #include "ash/common/wm_lookup.h"
20 #include "ash/common/wm_shell.h" 21 #include "ash/common/wm_shell.h"
21 #include "ash/common/wm_window.h" 22 #include "ash/common/wm_window.h"
22 #include "ash/common/wm_window_property.h" 23 #include "ash/common/wm_window_property.h"
23 #include "ash/root_window_controller.h" 24 #include "ash/root_window_controller.h"
24 #include "base/memory/ptr_util.h" 25 #include "base/memory/ptr_util.h"
25 #include "ui/compositor/layer.h" 26 #include "ui/compositor/layer.h"
26 #include "ui/compositor/scoped_layer_animation_settings.h" 27 #include "ui/compositor/scoped_layer_animation_settings.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 ShelfWidget::ShelfWidget(WmWindow* shelf_container, WmShelf* wm_shelf) 132 ShelfWidget::ShelfWidget(WmWindow* shelf_container, WmShelf* wm_shelf)
132 : wm_shelf_(wm_shelf), 133 : wm_shelf_(wm_shelf),
133 status_area_widget_(nullptr), 134 status_area_widget_(nullptr),
134 delegate_view_(new DelegateView(this)), 135 delegate_view_(new DelegateView(this)),
135 shelf_view_(nullptr), 136 shelf_view_(nullptr),
136 background_animator_(SHELF_BACKGROUND_DEFAULT, wm_shelf_), 137 background_animator_(SHELF_BACKGROUND_DEFAULT, wm_shelf_),
137 activating_as_fallback_(false) { 138 activating_as_fallback_(false) {
138 DCHECK(wm_shelf_); 139 DCHECK(wm_shelf_);
139 background_animator_.AddObserver(this); 140 background_animator_.AddObserver(this);
140 background_animator_.AddObserver(delegate_view_); 141 background_animator_.AddObserver(delegate_view_);
142 sms_observer_.reset(new SmsObserver());
141 143
142 views::Widget::InitParams params( 144 views::Widget::InitParams params(
143 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 145 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
144 params.name = "ShelfWidget"; 146 params.name = "ShelfWidget";
145 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 147 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
146 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 148 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
147 params.delegate = delegate_view_; 149 params.delegate = delegate_view_;
148 shelf_container->GetRootWindowController() 150 shelf_container->GetRootWindowController()
149 ->ConfigureWidgetInitParamsForContainer( 151 ->ConfigureWidgetInitParamsForContainer(
150 this, shelf_container->GetShellWindowId(), &params); 152 this, shelf_container->GetShellWindowId(), &params);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // access it later in shutdown. 292 // access it later in shutdown.
291 if (shelf_layout_manager_) 293 if (shelf_layout_manager_)
292 shelf_layout_manager_->PrepareForShutdown(); 294 shelf_layout_manager_->PrepareForShutdown();
293 295
294 if (status_area_widget_) { 296 if (status_area_widget_) {
295 background_animator_.RemoveObserver(status_area_widget_); 297 background_animator_.RemoveObserver(status_area_widget_);
296 WmShell::Get()->focus_cycler()->RemoveWidget(status_area_widget_); 298 WmShell::Get()->focus_cycler()->RemoveWidget(status_area_widget_);
297 status_area_widget_->Shutdown(); 299 status_area_widget_->Shutdown();
298 status_area_widget_ = nullptr; 300 status_area_widget_ = nullptr;
299 } 301 }
300
301 CloseNow(); 302 CloseNow();
302 } 303 }
303 304
304 void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) { 305 void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) {
305 if (!shelf_view_) 306 if (!shelf_view_)
306 return; 307 return;
307 308
308 WmWindow* shelf_window = WmLookup::Get()->GetWindowForWidget(this); 309 WmWindow* shelf_window = WmLookup::Get()->GetWindowForWidget(this);
309 shelf_view_->UpdatePanelIconPosition( 310 shelf_view_->UpdatePanelIconPosition(
310 panel->GetIntProperty(WmWindowProperty::SHELF_ID), 311 panel->GetIntProperty(WmWindowProperty::SHELF_ID),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 if (shelf_view_) 350 if (shelf_view_)
350 shelf_view_->UpdateShelfItemBackground(alpha); 351 shelf_view_->UpdateShelfItemBackground(alpha);
351 } 352 }
352 353
353 void ShelfWidget::WillDeleteShelfLayoutManager() { 354 void ShelfWidget::WillDeleteShelfLayoutManager() {
354 shelf_layout_manager_->RemoveObserver(this); 355 shelf_layout_manager_->RemoveObserver(this);
355 shelf_layout_manager_ = nullptr; 356 shelf_layout_manager_ = nullptr;
356 } 357 }
357 358
358 } // namespace ash 359 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698