Commit 2aa4095d authored by jennyz@google.com's avatar jennyz@google.com

Show fixed arrow for uber tray bubble if shelf alignment is vertical.

BUG=127577
TEST=NONE

Review URL: https://chromiumcodereview.appspot.com/10417013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138360 0039d316-1c4b-4281-b951-d872f2087c98
parent e3e3fc28
...@@ -453,7 +453,8 @@ void SystemTray::ShowItems(const std::vector<SystemTrayItem*>& items, ...@@ -453,7 +453,8 @@ void SystemTray::ShowItems(const std::vector<SystemTrayItem*>& items,
ash::Shell::GetInstance()->tray_delegate(); ash::Shell::GetInstance()->tray_delegate();
views::View* anchor = tray_container_; views::View* anchor = tray_container_;
SystemTrayBubble::InitParams init_params( SystemTrayBubble::InitParams init_params(
SystemTrayBubble::ANCHOR_TYPE_TRAY); SystemTrayBubble::ANCHOR_TYPE_TRAY,
shelf_alignment());
init_params.anchor = anchor; init_params.anchor = anchor;
init_params.can_activate = can_activate; init_params.can_activate = can_activate;
init_params.login_status = delegate->GetUserLoginStatus(); init_params.login_status = delegate->GetUserLoginStatus();
...@@ -496,7 +497,7 @@ void SystemTray::UpdateNotificationBubble() { ...@@ -496,7 +497,7 @@ void SystemTray::UpdateNotificationBubble() {
anchor = tray_container_; anchor = tray_container_;
anchor_type = SystemTrayBubble::ANCHOR_TYPE_TRAY; anchor_type = SystemTrayBubble::ANCHOR_TYPE_TRAY;
} }
SystemTrayBubble::InitParams init_params(anchor_type); SystemTrayBubble::InitParams init_params(anchor_type, shelf_alignment());
init_params.anchor = anchor; init_params.anchor = anchor;
init_params.login_status = init_params.login_status =
ash::Shell::GetInstance()->tray_delegate()->GetUserLoginStatus(); ash::Shell::GetInstance()->tray_delegate()->GetUserLoginStatus();
...@@ -539,8 +540,6 @@ bool SystemTray::PerformAction(const views::Event& event) { ...@@ -539,8 +540,6 @@ bool SystemTray::PerformAction(const views::Event& event) {
if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM)
arrow_offset = base::i18n::IsRTL() ? arrow_offset = base::i18n::IsRTL() ?
located_event.x() : tray_container_->width() - located_event.x(); located_event.x() : tray_container_->width() - located_event.x();
else
arrow_offset = tray_container_->height() - located_event.y();
} }
ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset);
} }
......
...@@ -43,6 +43,7 @@ const int kSystemTrayBubbleVerticalInset = 1; ...@@ -43,6 +43,7 @@ const int kSystemTrayBubbleVerticalInset = 1;
const int kArrowHeight = 10; const int kArrowHeight = 10;
const int kArrowWidth = 20; const int kArrowWidth = 20;
const int kArrowPaddingFromRight = 20; const int kArrowPaddingFromRight = 20;
const int kArrowPaddingFromBottom = 17;
const int kMinArrowOffset = 12; const int kMinArrowOffset = 12;
const int kAnimationDurationForPopupMS = 200; const int kAnimationDurationForPopupMS = 200;
...@@ -350,12 +351,16 @@ void SystemTrayBubbleView::OnMouseExited(const views::MouseEvent& event) { ...@@ -350,12 +351,16 @@ void SystemTrayBubbleView::OnMouseExited(const views::MouseEvent& event) {
// SystemTrayBubble::InitParams // SystemTrayBubble::InitParams
SystemTrayBubble::InitParams::InitParams( SystemTrayBubble::InitParams::InitParams(
SystemTrayBubble::AnchorType anchor_type) SystemTrayBubble::AnchorType anchor_type,
ShelfAlignment shelf_alignment)
: anchor(NULL), : anchor(NULL),
anchor_type(anchor_type), anchor_type(anchor_type),
can_activate(false), can_activate(false),
login_status(ash::user::LOGGED_IN_NONE), login_status(ash::user::LOGGED_IN_NONE),
arrow_offset(kArrowPaddingFromRight + kArrowWidth / 2) { arrow_offset(
(shelf_alignment == SHELF_ALIGNMENT_BOTTOM ?
kArrowPaddingFromRight : kArrowPaddingFromBottom)
+ kArrowWidth / 2) {
} }
// SystemTrayBubble // SystemTrayBubble
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#pragma once #pragma once
#include "ash/system/user/login_status.h" #include "ash/system/user/login_status.h"
#include "ash/wm/shelf_auto_hide_behavior.h"
#include "base/base_export.h" #include "base/base_export.h"
#include "base/message_pump_observer.h" #include "base/message_pump_observer.h"
#include "base/timer.h" #include "base/timer.h"
...@@ -74,7 +75,7 @@ class SystemTrayBubble : public base::MessagePumpObserver, ...@@ -74,7 +75,7 @@ class SystemTrayBubble : public base::MessagePumpObserver,
}; };
struct InitParams { struct InitParams {
InitParams(AnchorType anchor_type); InitParams(AnchorType anchor_type, ShelfAlignment shelf_alignmen);
views::View* anchor; views::View* anchor;
AnchorType anchor_type; AnchorType anchor_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment