| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/views/infobars/extension_infobar.h" | 5 #include "chrome/browser/ui/views/infobars/extension_infobar.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_context_menu_model.h" | 7 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| 8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
| 9 #include "chrome/browser/extensions/extension_infobar_delegate.h" | 9 #include "chrome/browser/extensions/extension_infobar_delegate.h" |
| 10 #include "chrome/browser/platform_util.h" | 10 #include "chrome/browser/platform_util.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 void ExtensionInfoBar::Layout() { | 61 void ExtensionInfoBar::Layout() { |
| 62 InfoBarView::Layout(); | 62 InfoBarView::Layout(); |
| 63 | 63 |
| 64 gfx::Size menu_size = menu_->GetPreferredSize(); | 64 gfx::Size menu_size = menu_->GetPreferredSize(); |
| 65 menu_->SetBounds(StartX(), OffsetY(menu_size), menu_size.width(), | 65 menu_->SetBounds(StartX(), OffsetY(menu_size), menu_size.width(), |
| 66 menu_size.height()); | 66 menu_size.height()); |
| 67 | 67 |
| 68 GetDelegate()->extension_host()->view()->SetBounds( | 68 GetDelegate()->extension_host()->view()->SetBounds( |
| 69 menu_->bounds().right() + kMenuHorizontalMargin, 0, | 69 menu_->bounds().right() + kMenuHorizontalMargin, |
| 70 std::max(0, EndX() - StartX() - ContentMinimumWidth()), height()); | 70 arrow_height(), |
| 71 std::max(0, EndX() - StartX() - ContentMinimumWidth()), |
| 72 height() - arrow_height() - 1); |
| 71 } | 73 } |
| 72 | 74 |
| 73 void ExtensionInfoBar::ViewHierarchyChanged(bool is_add, | 75 void ExtensionInfoBar::ViewHierarchyChanged(bool is_add, |
| 74 View* parent, | 76 View* parent, |
| 75 View* child) { | 77 View* child) { |
| 76 if (!is_add || (child != this) || (menu_ != NULL)) { | 78 if (!is_add || (child != this) || (menu_ != NULL)) { |
| 77 InfoBarView::ViewHierarchyChanged(is_add, parent, child); | 79 InfoBarView::ViewHierarchyChanged(is_add, parent, child); |
| 78 return; | 80 return; |
| 79 } | 81 } |
| 80 | 82 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 gfx::Point screen_point; | 191 gfx::Point screen_point; |
| 190 views::View::ConvertPointToScreen(menu_, &screen_point); | 192 views::View::ConvertPointToScreen(menu_, &screen_point); |
| 191 options_menu.RunMenuAt(GetWidget()->GetNativeWindow(), menu_, | 193 options_menu.RunMenuAt(GetWidget()->GetNativeWindow(), menu_, |
| 192 gfx::Rect(screen_point, menu_->size()), views::MenuItemView::TOPLEFT, | 194 gfx::Rect(screen_point, menu_->size()), views::MenuItemView::TOPLEFT, |
| 193 true); | 195 true); |
| 194 } | 196 } |
| 195 | 197 |
| 196 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { | 198 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { |
| 197 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; | 199 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; |
| 198 } | 200 } |
| OLD | NEW |