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

Side by Side Diff: ash/system/tray/system_tray.cc

Issue 10417013: Show fixed arrow for uber tray bubble if shelf alignment is vertical. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/system/tray/system_tray_bubble.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/tray/system_tray.h" 5 #include "ash/system/tray/system_tray.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell/panel_window.h" 8 #include "ash/shell/panel_window.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/system/audio/tray_volume.h" 10 #include "ash/system/audio/tray_volume.h"
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 notification_bubble_.reset(); 446 notification_bubble_.reset();
447 447
448 if (bubble_.get() && creation_type == BUBBLE_USE_EXISTING) { 448 if (bubble_.get() && creation_type == BUBBLE_USE_EXISTING) {
449 bubble_->UpdateView(items, bubble_type); 449 bubble_->UpdateView(items, bubble_type);
450 } else { 450 } else {
451 bubble_.reset(new SystemTrayBubble(this, items, bubble_type)); 451 bubble_.reset(new SystemTrayBubble(this, items, bubble_type));
452 ash::SystemTrayDelegate* delegate = 452 ash::SystemTrayDelegate* delegate =
453 ash::Shell::GetInstance()->tray_delegate(); 453 ash::Shell::GetInstance()->tray_delegate();
454 views::View* anchor = tray_container_; 454 views::View* anchor = tray_container_;
455 SystemTrayBubble::InitParams init_params( 455 SystemTrayBubble::InitParams init_params(
456 SystemTrayBubble::ANCHOR_TYPE_TRAY); 456 SystemTrayBubble::ANCHOR_TYPE_TRAY,
457 shelf_alignment());
457 init_params.anchor = anchor; 458 init_params.anchor = anchor;
458 init_params.can_activate = can_activate; 459 init_params.can_activate = can_activate;
459 init_params.login_status = delegate->GetUserLoginStatus(); 460 init_params.login_status = delegate->GetUserLoginStatus();
460 if (arrow_offset >= 0) 461 if (arrow_offset >= 0)
461 init_params.arrow_offset = arrow_offset; 462 init_params.arrow_offset = arrow_offset;
462 bubble_->InitView(init_params); 463 bubble_->InitView(init_params);
463 } 464 }
464 465
465 if (detailed && items.size() > 0) 466 if (detailed && items.size() > 0)
466 detailed_item_ = items[0]; 467 detailed_item_ = items[0];
(...skipping 22 matching lines...) Expand all
489 SystemTrayBubble::BUBBLE_TYPE_NOTIFICATION)); 490 SystemTrayBubble::BUBBLE_TYPE_NOTIFICATION));
490 views::View* anchor; 491 views::View* anchor;
491 SystemTrayBubble::AnchorType anchor_type; 492 SystemTrayBubble::AnchorType anchor_type;
492 if (bubble_.get()) { 493 if (bubble_.get()) {
493 anchor = bubble_->bubble_view(); 494 anchor = bubble_->bubble_view();
494 anchor_type = SystemTrayBubble::ANCHOR_TYPE_BUBBLE; 495 anchor_type = SystemTrayBubble::ANCHOR_TYPE_BUBBLE;
495 } else { 496 } else {
496 anchor = tray_container_; 497 anchor = tray_container_;
497 anchor_type = SystemTrayBubble::ANCHOR_TYPE_TRAY; 498 anchor_type = SystemTrayBubble::ANCHOR_TYPE_TRAY;
498 } 499 }
499 SystemTrayBubble::InitParams init_params(anchor_type); 500 SystemTrayBubble::InitParams init_params(anchor_type, shelf_alignment());
500 init_params.anchor = anchor; 501 init_params.anchor = anchor;
501 init_params.login_status = 502 init_params.login_status =
502 ash::Shell::GetInstance()->tray_delegate()->GetUserLoginStatus(); 503 ash::Shell::GetInstance()->tray_delegate()->GetUserLoginStatus();
503 int arrow_offset = GetTrayXOffset(notification_items_[0]); 504 int arrow_offset = GetTrayXOffset(notification_items_[0]);
504 if (arrow_offset >= 0) 505 if (arrow_offset >= 0)
505 init_params.arrow_offset = arrow_offset; 506 init_params.arrow_offset = arrow_offset;
506 notification_bubble_->InitView(init_params); 507 notification_bubble_->InitView(init_params);
507 } 508 }
508 509
509 void SystemTray::UpdateNotificationAnchor() { 510 void SystemTray::UpdateNotificationAnchor() {
(...skipping 22 matching lines...) Expand all
532 bubble_->bubble_type() == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) { 533 bubble_->bubble_type() == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) {
533 bubble_->Close(); 534 bubble_->Close();
534 } else { 535 } else {
535 int arrow_offset = -1; 536 int arrow_offset = -1;
536 if (event.IsMouseEvent() || event.IsTouchEvent()) { 537 if (event.IsMouseEvent() || event.IsTouchEvent()) {
537 const views::LocatedEvent& located_event = 538 const views::LocatedEvent& located_event =
538 static_cast<const views::LocatedEvent&>(event); 539 static_cast<const views::LocatedEvent&>(event);
539 if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) 540 if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM)
540 arrow_offset = base::i18n::IsRTL() ? 541 arrow_offset = base::i18n::IsRTL() ?
541 located_event.x() : tray_container_->width() - located_event.x(); 542 located_event.x() : tray_container_->width() - located_event.x();
542 else
543 arrow_offset = tray_container_->height() - located_event.y();
544 } 543 }
545 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); 544 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset);
546 } 545 }
547 return true; 546 return true;
548 } 547 }
549 548
550 void SystemTray::OnMouseEntered(const views::MouseEvent& event) { 549 void SystemTray::OnMouseEntered(const views::MouseEvent& event) {
551 should_show_launcher_ = true; 550 should_show_launcher_ = true;
552 hover_background_animator_.SetPaintsBackground(true, 551 hover_background_animator_.SetPaintsBackground(true,
553 internal::BackgroundAnimator::CHANGE_ANIMATE); 552 internal::BackgroundAnimator::CHANGE_ANIMATE);
(...skipping 27 matching lines...) Expand all
581 canvas->DrawFocusRect(tray_container_->bounds()); 580 canvas->DrawFocusRect(tray_container_->bounds());
582 } 581 }
583 582
584 void SystemTray::UpdateBackground(int alpha) { 583 void SystemTray::UpdateBackground(int alpha) {
585 background_->set_alpha(hide_background_animator_.alpha() + 584 background_->set_alpha(hide_background_animator_.alpha() +
586 hover_background_animator_.alpha()); 585 hover_background_animator_.alpha());
587 SchedulePaint(); 586 SchedulePaint();
588 } 587 }
589 588
590 } // namespace ash 589 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/system/tray/system_tray_bubble.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698