diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-03 20:36:06 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-03 20:36:06 +0000 |
commit | 41939cf6e1b288242c2345793235cf1ab0bd98d9 (patch) | |
tree | 046ba41d9afc0733c89a9c2e552b4ece7853f687 /chrome | |
parent | 924b5b4fca09230ddde4191dc03beac7d6f8a370 (diff) | |
download | chromium_src-41939cf6e1b288242c2345793235cf1ab0bd98d9.zip chromium_src-41939cf6e1b288242c2345793235cf1ab0bd98d9.tar.gz chromium_src-41939cf6e1b288242c2345793235cf1ab0bd98d9.tar.bz2 |
Align avatar bubble with edge of anchor control
Currently when showing the avatar bubble the tip of the bubble points to the middle of the anchor control.
This can look weird so I'm changing it to be aligned with the edge of the anchor control.
BUG=98884
TEST=
Review URL: http://codereview.chromium.org/8439064
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108537 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
19 files changed, 48 insertions, 22 deletions
diff --git a/chrome/browser/chromeos/login/message_bubble.cc b/chrome/browser/chromeos/login/message_bubble.cc index 074494ff..3304705 100644 --- a/chrome/browser/chromeos/login/message_bubble.cc +++ b/chrome/browser/chromeos/login/message_bubble.cc @@ -150,6 +150,7 @@ MessageBubble* MessageBubble::ShowWithLinks( views::Widget::InitParams::TYPE_POPUP, parent, image, text, links, true, delegate); bubble->InitBubble(parent, position_relative_to, arrow_location, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bubble->text_->parent(), delegate); return bubble; } @@ -171,6 +172,7 @@ MessageBubble* MessageBubble::ShowNoGrab( views::Widget::InitParams::TYPE_CONTROL, parent, image, text, links, false, delegate); bubble->InitBubble(parent, position_relative_to, arrow_location, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bubble->text_->parent(), delegate); return bubble; } diff --git a/chrome/browser/chromeos/status/caps_lock_menu_button.cc b/chrome/browser/chromeos/status/caps_lock_menu_button.cc index 7dc5e3e..73f2876 100644 --- a/chrome/browser/chromeos/status/caps_lock_menu_button.cc +++ b/chrome/browser/chromeos/status/caps_lock_menu_button.cc @@ -316,12 +316,12 @@ void CapsLockMenuButton::CreateAndShowBubble() { gfx::Rect button_bounds = GetScreenBounds(); button_bounds.set_y(button_bounds.y() + 1); // See login/message_bubble.cc. - bubble_ = Bubble::ShowFocusless(GetWidget(), - button_bounds, - views::BubbleBorder::TOP_RIGHT, - new CapsLockMenuButton::StatusView(this), - NULL /* no delegate */, - true /* show_while_screen_is_locked */); + bubble_ = Bubble::ShowFocusless(GetWidget(), button_bounds, + views::BubbleBorder::TOP_RIGHT, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, + new CapsLockMenuButton::StatusView(this), + NULL /* no delegate */, + true /* show_while_screen_is_locked */); } void CapsLockMenuButton::HideBubble() { diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 5d6bc58..e442a32 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -603,6 +603,7 @@ void ExternalTabContainer::ShowPageInfo(Profile* profile, ssl, show_history); Bubble* bubble = Bubble::Show(GetWidget(), bounds, views::BubbleBorder::TOP_LEFT, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, page_info_bubble, page_info_bubble); page_info_bubble->set_bubble(bubble); } diff --git a/chrome/browser/resources/ntp4/new_tab.css b/chrome/browser/resources/ntp4/new_tab.css index f0b037d..ceec95c 100644 --- a/chrome/browser/resources/ntp4/new_tab.css +++ b/chrome/browser/resources/ntp4/new_tab.css @@ -177,8 +177,10 @@ html[dir='rtl'] #attribution { cursor: pointer; font-size: 13px; /* Leave room for the scrollbar. */ + margin-left: 13px; margin-right: 13px; margin-top: 5px; + padding: 0; position: fixed; right: 0; text-align: right; diff --git a/chrome/browser/speech/speech_input_bubble_views.cc b/chrome/browser/speech/speech_input_bubble_views.cc index f8c0646..26f8bc1 100644 --- a/chrome/browser/speech/speech_input_bubble_views.cc +++ b/chrome/browser/speech/speech_input_bubble_views.cc @@ -364,8 +364,9 @@ void SpeechInputBubbleImpl::Show() { } bubble_ = Bubble::Show(toplevel_widget, target_rect, - views::BubbleBorder::TOP_LEFT, bubble_content_, - this); + views::BubbleBorder::TOP_LEFT, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, + bubble_content_, this); // We don't want fade outs when closing because it makes speech recognition // appear slower than it is. Also setting it to false allows |Close| to // destroy the bubble immediately instead of waiting for the fade animation diff --git a/chrome/browser/ui/confirm_bubble_model.cc b/chrome/browser/ui/confirm_bubble_model.cc index 9501b2b..edc379f 100644 --- a/chrome/browser/ui/confirm_bubble_model.cc +++ b/chrome/browser/ui/confirm_bubble_model.cc @@ -52,6 +52,7 @@ void ConfirmBubbleModel::Show(gfx::NativeView view, ConfirmBubbleView* bubble_view = new ConfirmBubbleView(model); Bubble* bubble = Bubble::Show(parent, gfx::Rect(origin, gfx::Size()), views::BubbleBorder::NONE, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bubble_view, bubble_view); bubble->SizeToContents(); #else diff --git a/chrome/browser/ui/views/avatar_menu_button.cc b/chrome/browser/ui/views/avatar_menu_button.cc index 36a899d..6640ca6 100644 --- a/chrome/browser/ui/views/avatar_menu_button.cc +++ b/chrome/browser/ui/views/avatar_menu_button.cc @@ -158,7 +158,8 @@ void AvatarMenuButton::ShowAvatarBubble() { AvatarMenuBubbleView* bubble_view = new AvatarMenuBubbleView(browser_); // Bubble::Show() takes ownership of the view. bubble_ = Bubble::Show(browser_view->GetWidget(), bounds, - views::BubbleBorder::TOP_LEFT, bubble_view, bubble_view); + views::BubbleBorder::TOP_LEFT, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bubble_view, bubble_view); bubble_->AddObserver(this); } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc index 462b84a..b9a76af 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc @@ -91,7 +91,8 @@ void BookmarkBubbleView::Show(views::Widget* parent, bookmark_bubble_ = new BookmarkBubbleView(delegate, profile, url, newly_bookmarked); Bubble* bubble = Bubble::Show( - parent, bounds, views::BubbleBorder::TOP_RIGHT, bookmark_bubble_, + parent, bounds, views::BubbleBorder::TOP_RIGHT, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bookmark_bubble_, bookmark_bubble_); // |bubble_| can be set to NULL in BubbleClosing when we close the bubble // asynchronously. However, that can happen during the Show call above if the diff --git a/chrome/browser/ui/views/bubble/bubble.cc b/chrome/browser/ui/views/bubble/bubble.cc index f972eb0..f16c03f 100644 --- a/chrome/browser/ui/views/bubble/bubble.cc +++ b/chrome/browser/ui/views/bubble/bubble.cc @@ -50,10 +50,11 @@ string16 BubbleDelegate::GetAccessibleName() { Bubble* Bubble::Show(views::Widget* parent, const gfx::Rect& position_relative_to, views::BubbleBorder::ArrowLocation arrow_location, + views::BubbleBorder::BubbleAlignment alignment, views::View* contents, BubbleDelegate* delegate) { Bubble* bubble = new Bubble; - bubble->InitBubble(parent, position_relative_to, arrow_location, + bubble->InitBubble(parent, position_relative_to, arrow_location, alignment, contents, delegate); // Register the Escape accelerator for closing. @@ -71,12 +72,13 @@ Bubble* Bubble::ShowFocusless( views::Widget* parent, const gfx::Rect& position_relative_to, views::BubbleBorder::ArrowLocation arrow_location, + views::BubbleBorder::BubbleAlignment alignment, views::View* contents, BubbleDelegate* delegate, bool show_while_screen_is_locked) { Bubble* bubble = new Bubble(views::Widget::InitParams::TYPE_POPUP, show_while_screen_is_locked); - bubble->InitBubble(parent, position_relative_to, arrow_location, + bubble->InitBubble(parent, position_relative_to, arrow_location, alignment, contents, delegate); return bubble; } @@ -186,6 +188,7 @@ Bubble::~Bubble() { void Bubble::InitBubble(views::Widget* parent, const gfx::Rect& position_relative_to, views::BubbleBorder::ArrowLocation arrow_location, + views::BubbleBorder::BubbleAlignment alignment, views::View* contents, BubbleDelegate* delegate) { delegate_ = delegate; @@ -223,6 +226,7 @@ void Bubble::InitBubble(views::Widget* parent, border_->InitBorderWidgetWin(CreateBorderContents(), parent->GetNativeView()); border_->border_contents()->SetBackgroundColor(kBackgroundColor); + border_->border_contents()->SetAlignment(alignment); // We make the BorderWidgetWin the owner of the Bubble HWND, so that the // latter is displayed on top of the former. @@ -288,6 +292,7 @@ void Bubble::InitBubble(views::Widget* parent, border_contents_ = CreateBorderContents(); border_contents_->Init(); border_contents_->SetBackgroundColor(kBackgroundColor); + border_contents_->SetAlignment(alignment); gfx::Rect contents_bounds; border_contents_->SizeAndGetBounds(position_relative_to, arrow_location, false, contents->GetPreferredSize(), diff --git a/chrome/browser/ui/views/bubble/bubble.h b/chrome/browser/ui/views/bubble/bubble.h index 22402c5..b6093d1 100644 --- a/chrome/browser/ui/views/bubble/bubble.h +++ b/chrome/browser/ui/views/bubble/bubble.h @@ -112,6 +112,7 @@ class Bubble static Bubble* Show(views::Widget* parent, const gfx::Rect& position_relative_to, views::BubbleBorder::ArrowLocation arrow_location, + views::BubbleBorder::BubbleAlignment alignment, views::View* contents, BubbleDelegate* delegate); @@ -126,6 +127,7 @@ class Bubble views::Widget* parent, const gfx::Rect& position_relative_to, views::BubbleBorder::ArrowLocation arrow_location, + views::BubbleBorder::BubbleAlignment alignment, views::View* contents, BubbleDelegate* delegate, bool show_while_screen_is_locked); @@ -181,6 +183,7 @@ class Bubble virtual void InitBubble(views::Widget* parent, const gfx::Rect& position_relative_to, views::BubbleBorder::ArrowLocation arrow_location, + views::BubbleBorder::BubbleAlignment alignment, views::View* contents, BubbleDelegate* delegate); diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc index c8962f8..adb2520 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc @@ -410,7 +410,9 @@ void ExtensionInstalledBubble::ShowInternal() { bubble_content_ = new InstalledBubbleContent( browser_, extension_, type_, &icon_); Bubble* bubble = Bubble::Show(browser_view->GetWidget(), bounds, - arrow_location, bubble_content_, this); + arrow_location, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, + bubble_content_, this); bubble_content_->set_bubble(bubble); } diff --git a/chrome/browser/ui/views/first_run_bubble.cc b/chrome/browser/ui/views/first_run_bubble.cc index 349257a..ea925db 100644 --- a/chrome/browser/ui/views/first_run_bubble.cc +++ b/chrome/browser/ui/views/first_run_bubble.cc @@ -510,7 +510,8 @@ FirstRunBubble* FirstRunBubble::Show( } bubble->set_view(view); bubble->InitBubble( - parent, position_relative_to, arrow_location, view, bubble); + parent, position_relative_to, arrow_location, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, view, bubble); bubble->GetWidget()->GetFocusManager()->AddFocusChangeListener(view); view->BubbleShown(); return bubble; diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 3c4efd5..d359085 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -2601,15 +2601,14 @@ BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { void BrowserView::ShowAvatarBubble(TabContents* tab_contents, const gfx::Rect& rect) { - gfx::Point origin(rect.right(), rect.bottom()); + gfx::Point origin(rect.origin()); views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); - gfx::Rect bounds; - bounds.set_origin(origin); + gfx::Rect bounds(origin, rect.size()); AvatarMenuBubbleView* bubble_view = new AvatarMenuBubbleView(browser_.get()); // Bubble::Show() takes ownership of the view. - Bubble::Show(this->GetWidget(), bounds, - views::BubbleBorder::TOP_RIGHT, + Bubble::Show(this->GetWidget(), bounds, views::BubbleBorder::TOP_RIGHT, + views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bubble_view, bubble_view); } diff --git a/chrome/browser/ui/views/global_error_bubble_view.cc b/chrome/browser/ui/views/global_error_bubble_view.cc index 4db3ffe..a0cf75e 100644 --- a/chrome/browser/ui/views/global_error_bubble_view.cc +++ b/chrome/browser/ui/views/global_error_bubble_view.cc @@ -171,7 +171,8 @@ void GlobalError::ShowBubbleView(Browser* browser, GlobalError* error) { new GlobalErrorBubbleView(browser, error); // Bubble::Show() takes ownership of the view. Bubble* bubble = Bubble::Show( - browser_view->GetWidget(), bounds, - views::BubbleBorder::TOP_RIGHT, bubble_view, bubble_view); + browser_view->GetWidget(), bounds, views::BubbleBorder::TOP_RIGHT, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bubble_view, + bubble_view); bubble_view->set_bubble(bubble); } diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc index 11c1835..d6cebb2 100644 --- a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc +++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc @@ -144,6 +144,7 @@ void ContentSettingImageView::OnMouseReleased(const views::MouseEvent& event) { profile, tab_contents->tab_contents()); bubble_ = Bubble::Show(GetWidget(), screen_bounds, views::BubbleBorder::TOP_RIGHT, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bubble_contents, this); bubble_contents->set_bubble(bubble_); } diff --git a/chrome/browser/ui/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc index 16033d9..9a6dbed 100644 --- a/chrome/browser/ui/views/page_info_bubble_view.cc +++ b/chrome/browser/ui/views/page_info_bubble_view.cc @@ -502,6 +502,7 @@ void ShowPageInfoBubble(BrowserView* browser_view, Bubble* bubble = Bubble::Show(browser_view->GetWidget(), bounds, views::BubbleBorder::TOP_LEFT, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, page_info_bubble, page_info_bubble); page_info_bubble->set_bubble(bubble); } diff --git a/chrome/browser/ui/views/pinned_contents_info_bubble.cc b/chrome/browser/ui/views/pinned_contents_info_bubble.cc index 6d85672..a87d1eb 100644 --- a/chrome/browser/ui/views/pinned_contents_info_bubble.cc +++ b/chrome/browser/ui/views/pinned_contents_info_bubble.cc @@ -44,6 +44,7 @@ PinnedContentsInfoBubble* PinnedContentsInfoBubble::Show( PinnedContentsInfoBubble* bubble = new PinnedContentsInfoBubble(bubble_anchor); bubble->InitBubble(parent, position_relative_to, arrow_location, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, contents, delegate); return bubble; } diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index c792bb1f..4616302 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -731,6 +731,7 @@ void ToolbarView::ShowCriticalNotification() { Bubble* bubble = Bubble::Show(GetWidget(), gfx::Rect(screen_loc, app_menu_->size()), views::BubbleBorder::TOP_RIGHT, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, critical_notification_bubble, critical_notification_bubble); bubble->set_close_on_deactivate(false); diff --git a/chrome/browser/ui/views/web_intent_picker_view.cc b/chrome/browser/ui/views/web_intent_picker_view.cc index 9f01250..14fce13 100644 --- a/chrome/browser/ui/views/web_intent_picker_view.cc +++ b/chrome/browser/ui/views/web_intent_picker_view.cc @@ -168,7 +168,9 @@ WebIntentPickerView::WebIntentPickerView(Browser* browser, bounds.set_width(kIconHorizontalOffset); bubble_ = Bubble::Show(browser_view->GetWidget(), bounds, - views::BubbleBorder::TOP_LEFT, this, this); + views::BubbleBorder::TOP_LEFT, + views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, + this, this); } WebIntentPickerView::~WebIntentPickerView() { |