diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 23:48:54 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 23:48:54 +0000 |
commit | 706197adc80edd1b1b73a6eea38a5b080609b103 (patch) | |
tree | 9b5ed9d55107366ad484ec1802ab938a51e13a22 /chrome/browser/views/info_bubble.cc | |
parent | fd01250e35bb184937b3fe439d2d7ffc0d96c15f (diff) | |
download | chromium_src-706197adc80edd1b1b73a6eea38a5b080609b103.zip chromium_src-706197adc80edd1b1b73a6eea38a5b080609b103.tar.gz chromium_src-706197adc80edd1b1b73a6eea38a5b080609b103.tar.bz2 |
Revert 31322 - Extension Installed InfoBubble
This creates UI feedback upon successful installation of an extension. An InfoBubble is shown containing the install icon and some information about how to manage extensions.
TEST=Install a packaged extension. Verify the InfoBubble is shown, with the install icon and some description. The InfoBubble should disappear when the bubble looses focus (click elsewhere). For a browserAction, the bubble should point to the browserAction icon. For a pageAction **that has a "default_icon" set in it's manifest (see the samples/subscribe_page_action in this CL)**, it should point to a temporarily shown pageAction icon that will be hidden when the bubble closes. Otherwise it should point to the wrench menu.
BUG=21412
Review URL: http://codereview.chromium.org/362022
TBR=rafaelw@chromium.org
Review URL: http://codereview.chromium.org/375019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31326 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/info_bubble.cc')
-rw-r--r-- | chrome/browser/views/info_bubble.cc | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc index 4f39ba9..1218f46 100644 --- a/chrome/browser/views/info_bubble.cc +++ b/chrome/browser/views/info_bubble.cc @@ -35,16 +35,17 @@ class BorderContents : public views::View { // Given the size of the contents and the rect to point at, initializes the // bubble and returns the bounds of both the border // and the contents inside the bubble. - // |prefer_arrow_on_right| specifies the preferred location for the arrow - // anchor. If the bubble does not fit on the monitor, the arrow location may - // changed so it can. + // |is_rtl| is true if the UI is RTL and thus the arrow should default to the + // right side of the bubble; otherwise it defaults to the left top corner, and + // then is moved as necessary to try and fit the whole bubble on the same + // monitor as the rect being pointed to. // // TODO(pkasting): Maybe this should use mirroring transformations instead, // which would hopefully simplify this code. void InitAndGetBounds( const gfx::Rect& position_relative_to, // In screen coordinates const gfx::Size& contents_size, - bool prefer_arrow_on_right, + bool is_rtl, gfx::Rect* contents_bounds, // Returned in window coordinates gfx::Rect* window_bounds); // Returned in screen coordinates @@ -60,7 +61,7 @@ class BorderContents : public views::View { void BorderContents::InitAndGetBounds( const gfx::Rect& position_relative_to, const gfx::Size& contents_size, - bool prefer_arrow_on_right, + bool is_rtl, gfx::Rect* contents_bounds, gfx::Rect* window_bounds) { // Margins between the contents and the inside of the border, in pixels. @@ -79,9 +80,8 @@ void BorderContents::InitAndGetBounds( local_contents_size.Enlarge(kLeftMargin + kRightMargin, kTopMargin + kBottomMargin); - // Try putting the arrow in its initial location, and calculating the - // bounds. - BubbleBorder::ArrowLocation arrow_location(prefer_arrow_on_right ? + // Try putting the arrow in its default location, and calculating the bounds. + BubbleBorder::ArrowLocation arrow_location(is_rtl ? BubbleBorder::TOP_RIGHT : BubbleBorder::TOP_LEFT); bubble_border->set_arrow_location(arrow_location); *window_bounds = @@ -94,9 +94,9 @@ void BorderContents::InitAndGetBounds( monitor_provider->GetMonitorWorkAreaMatching(position_relative_to)); if (!monitor_bounds.IsEmpty() && !monitor_bounds.Contains(*window_bounds)) { // The bounds don't fit. Move the arrow to try and improve things. - bool arrow_on_left = prefer_arrow_on_right ? - (window_bounds->x() < monitor_bounds.x()) : - (window_bounds->right() <= monitor_bounds.right()); + bool arrow_on_left = + (is_rtl ? (window_bounds->x() < monitor_bounds.x()) : + (window_bounds->right() <= monitor_bounds.right())); if (window_bounds->bottom() > monitor_bounds.bottom()) { arrow_location = arrow_on_left ? BubbleBorder::BOTTOM_LEFT : BubbleBorder::BOTTOM_RIGHT; @@ -155,14 +155,13 @@ gfx::Rect BorderWidget::InitAndGetBounds( HWND owner, const gfx::Rect& position_relative_to, const gfx::Size& contents_size, - bool prefer_arrow_on_right) { + bool is_rtl) { // Set up the border view and ask it to calculate our bounds (and our // contents'). BorderContents* border_contents = new BorderContents; gfx::Rect contents_bounds, window_bounds; - border_contents->InitAndGetBounds(position_relative_to, contents_size, - prefer_arrow_on_right, &contents_bounds, - &window_bounds); + border_contents->InitAndGetBounds(position_relative_to, contents_size, is_rtl, + &contents_bounds, &window_bounds); // Initialize ourselves. WidgetWin::Init(GetAncestor(owner, GA_ROOT), window_bounds); @@ -248,16 +247,12 @@ void InfoBubble::Init(views::Window* parent, // Calculate and set the bounds for all windows and views. gfx::Rect window_bounds; - - bool prefer_arrow_on_right = - (contents->UILayoutIsRightToLeft() == delegate->PreferOriginSideAnchor()); - #if defined(OS_WIN) border_.reset(new BorderWidget); // Initialize and position the border window. window_bounds = border_->InitAndGetBounds(GetNativeView(), position_relative_to, contents->GetPreferredSize(), - prefer_arrow_on_right); + contents->UILayoutIsRightToLeft()); // Make |contents| take up the entire contents view. contents_view->SetLayoutManager(new views::FillLayout); @@ -270,7 +265,7 @@ void InfoBubble::Init(views::Window* parent, BorderContents* border_contents = new BorderContents; gfx::Rect contents_bounds; border_contents->InitAndGetBounds(position_relative_to, - contents->GetPreferredSize(), prefer_arrow_on_right, + contents->GetPreferredSize(), contents->UILayoutIsRightToLeft(), &contents_bounds, &window_bounds); // This new view must be added before |contents| so it will paint under it. contents_view->AddChildView(0, border_contents); |