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

Side by Side Diff: ash/system/web_notification/web_notification_tray.cc

Issue 2831233003: Remove ShouldBlockShelfAutoHide(). (Closed)
Patch Set: rename and rebase Created 3 years, 8 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
« no previous file with comments | « ash/system/status_area_widget.cc ('k') | ui/views/bubble/tray_bubble_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/system/web_notification/web_notification_tray.h" 5 #include "ash/system/web_notification/web_notification_tray.h"
6 6
7 #include "ash/public/cpp/shell_window_ids.h" 7 #include "ash/public/cpp/shell_window_ids.h"
8 #include "ash/resources/vector_icons/vector_icons.h" 8 #include "ash/resources/vector_icons/vector_icons.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/session/session_controller.h" 10 #include "ash/session/session_controller.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 DISALLOW_COPY_AND_ASSIGN(WebNotificationLabel); 267 DISALLOW_COPY_AND_ASSIGN(WebNotificationLabel);
268 }; 268 };
269 269
270 WebNotificationTray::WebNotificationTray(WmShelf* shelf, 270 WebNotificationTray::WebNotificationTray(WmShelf* shelf,
271 WmWindow* status_area_window, 271 WmWindow* status_area_window,
272 SystemTray* system_tray) 272 SystemTray* system_tray)
273 : TrayBackgroundView(shelf), 273 : TrayBackgroundView(shelf),
274 status_area_window_(status_area_window), 274 status_area_window_(status_area_window),
275 system_tray_(system_tray), 275 system_tray_(system_tray),
276 show_message_center_on_unlock_(false), 276 show_message_center_on_unlock_(false),
277 should_update_tray_content_(false), 277 should_update_tray_content_(false) {
278 should_block_shelf_auto_hide_(false) {
279 DCHECK(shelf); 278 DCHECK(shelf);
280 DCHECK(status_area_window_); 279 DCHECK(status_area_window_);
281 DCHECK(system_tray_); 280 DCHECK(system_tray_);
282 281
283 SetInkDropMode(InkDropMode::ON); 282 SetInkDropMode(InkDropMode::ON);
284 gfx::ImageSkia bell_image = 283 gfx::ImageSkia bell_image =
285 CreateVectorIcon(kShelfNotificationsIcon, kShelfIconColor); 284 CreateVectorIcon(kShelfNotificationsIcon, kShelfIconColor);
286 bell_icon_.reset( 285 bell_icon_.reset(
287 new WebNotificationImage(bell_image, animation_container_.get(), this)); 286 new WebNotificationImage(bell_image, animation_container_.get(), this));
288 tray_container()->AddChildView(bell_icon_.get()); 287 tray_container()->AddChildView(bell_icon_.get());
(...skipping 27 matching lines...) Expand all
316 void WebNotificationTray::DisableAnimationsForTest(bool disable) { 315 void WebNotificationTray::DisableAnimationsForTest(bool disable) {
317 disable_animations_for_test = disable; 316 disable_animations_for_test = disable;
318 } 317 }
319 318
320 // Public methods. 319 // Public methods.
321 320
322 bool WebNotificationTray::ShowMessageCenterInternal(bool show_settings) { 321 bool WebNotificationTray::ShowMessageCenterInternal(bool show_settings) {
323 if (!ShouldShowMessageCenter()) 322 if (!ShouldShowMessageCenter())
324 return false; 323 return false;
325 324
326 should_block_shelf_auto_hide_ = true;
327 message_center::MessageCenterBubble* message_center_bubble = 325 message_center::MessageCenterBubble* message_center_bubble =
328 new message_center::MessageCenterBubble(message_center(), 326 new message_center::MessageCenterBubble(message_center(),
329 message_center_tray_.get()); 327 message_center_tray_.get());
330 328
331 // In the horizontal case, message center starts from the top of the shelf. 329 // In the horizontal case, message center starts from the top of the shelf.
332 // In the vertical case, it starts from the bottom of WebNotificationTray. 330 // In the vertical case, it starts from the bottom of WebNotificationTray.
333 const int max_height = shelf()->IsHorizontalAlignment() 331 const int max_height = shelf()->IsHorizontalAlignment()
334 ? shelf()->GetIdealBounds().y() 332 ? shelf()->GetIdealBounds().y()
335 : GetBoundsInScreen().bottom(); 333 : GetBoundsInScreen().bottom();
336 message_center_bubble->SetMaxHeight(max_height); 334 message_center_bubble->SetMaxHeight(max_height);
(...skipping 20 matching lines...) Expand all
357 355
358 bool WebNotificationTray::ShowMessageCenter() { 356 bool WebNotificationTray::ShowMessageCenter() {
359 return ShowMessageCenterInternal(false /* show_settings */); 357 return ShowMessageCenterInternal(false /* show_settings */);
360 } 358 }
361 359
362 void WebNotificationTray::HideMessageCenter() { 360 void WebNotificationTray::HideMessageCenter() {
363 if (!message_center_bubble()) 361 if (!message_center_bubble())
364 return; 362 return;
365 SetIsActive(false); 363 SetIsActive(false);
366 message_center_bubble_.reset(); 364 message_center_bubble_.reset();
367 should_block_shelf_auto_hide_ = false;
368 show_message_center_on_unlock_ = false; 365 show_message_center_on_unlock_ = false;
369 shelf()->UpdateAutoHideState(); 366 shelf()->UpdateAutoHideState();
370 } 367 }
371 368
372 void WebNotificationTray::SetTrayBubbleHeight(int height) { 369 void WebNotificationTray::SetTrayBubbleHeight(int height) {
373 popup_alignment_delegate_->SetTrayBubbleHeight(height); 370 popup_alignment_delegate_->SetTrayBubbleHeight(height);
374 } 371 }
375 372
376 int WebNotificationTray::tray_bubble_height_for_test() const { 373 int WebNotificationTray::tray_bubble_height_for_test() const {
377 return popup_alignment_delegate_->tray_bubble_height_for_test(); 374 return popup_alignment_delegate_->tray_bubble_height_for_test();
(...skipping 12 matching lines...) Expand all
390 popup_collection_->MarkAllPopupsShown(); 387 popup_collection_->MarkAllPopupsShown();
391 } 388 }
392 389
393 // Private methods. 390 // Private methods.
394 391
395 bool WebNotificationTray::ShouldShowMessageCenter() const { 392 bool WebNotificationTray::ShouldShowMessageCenter() const {
396 // Hidden at login screen, during supervised user creation, etc. 393 // Hidden at login screen, during supervised user creation, etc.
397 return Shell::Get()->session_controller()->ShouldShowNotificationTray(); 394 return Shell::Get()->session_controller()->ShouldShowNotificationTray();
398 } 395 }
399 396
400 bool WebNotificationTray::ShouldBlockShelfAutoHide() const {
401 return should_block_shelf_auto_hide_;
402 }
403
404 bool WebNotificationTray::IsMessageCenterBubbleVisible() const { 397 bool WebNotificationTray::IsMessageCenterBubbleVisible() const {
405 return (message_center_bubble() && 398 return (message_center_bubble() &&
406 message_center_bubble()->bubble()->IsVisible()); 399 message_center_bubble()->bubble()->IsVisible());
407 } 400 }
408 401
409 void WebNotificationTray::ShowMessageCenterBubble() { 402 void WebNotificationTray::ShowMessageCenterBubble() {
410 if (!IsMessageCenterBubbleVisible()) 403 if (!IsMessageCenterBubbleVisible())
411 message_center_tray_->ShowMessageCenterBubble(); 404 message_center_tray_->ShowMessageCenterBubble();
412 } 405 }
413 406
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 609
617 message_center::MessageCenterBubble* 610 message_center::MessageCenterBubble*
618 WebNotificationTray::GetMessageCenterBubbleForTest() { 611 WebNotificationTray::GetMessageCenterBubbleForTest() {
619 if (!message_center_bubble()) 612 if (!message_center_bubble())
620 return nullptr; 613 return nullptr;
621 return static_cast<message_center::MessageCenterBubble*>( 614 return static_cast<message_center::MessageCenterBubble*>(
622 message_center_bubble()->bubble()); 615 message_center_bubble()->bubble());
623 } 616 }
624 617
625 } // namespace ash 618 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/status_area_widget.cc ('k') | ui/views/bubble/tray_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698