| Index: chrome/browser/ui/views/browser_action_view.cc
|
| diff --git a/chrome/browser/ui/views/browser_action_view.cc b/chrome/browser/ui/views/browser_action_view.cc
|
| index 3043ea463ebdc15deb50378cd9ba697e60350165..56470c2ab271c132b6f0ee2e3a2fe9e12d0c0046 100644
|
| --- a/chrome/browser/ui/views/browser_action_view.cc
|
| +++ b/chrome/browser/ui/views/browser_action_view.cc
|
| @@ -10,6 +10,7 @@
|
| #include "chrome/browser/extensions/extension_context_menu_model.h"
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/views/browser_actions_container.h"
|
| +#include "chrome/browser/ui/views/browser_actions_host_delegate.h"
|
| #include "chrome/browser/ui/views/toolbar_view.h"
|
| #include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/common/extensions/extension.h"
|
| @@ -29,7 +30,7 @@ using extensions::Extension;
|
| // BrowserActionButton
|
|
|
| BrowserActionButton::BrowserActionButton(const Extension* extension,
|
| - BrowserActionsContainer* panel)
|
| + BrowserActionsHostDelegate* panel)
|
| : ALLOW_THIS_IN_INITIALIZER_LIST(
|
| MenuButton(this, string16(), NULL, false)),
|
| browser_action_(extension->browser_action()),
|
| @@ -48,8 +49,8 @@ BrowserActionButton::BrowserActionButton(const Extension* extension,
|
| }
|
|
|
| void BrowserActionButton::Destroy() {
|
| - if (keybinding_.get() && panel_->GetFocusManager())
|
| - panel_->GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this);
|
| + if (keybinding_.get() && GetFocusManager())
|
| + GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this);
|
|
|
| if (context_menu_) {
|
| context_menu_->Cancel();
|
| @@ -83,7 +84,7 @@ void BrowserActionButton::ViewHierarchyChanged(
|
|
|
| extensions::CommandService* command_service =
|
| extensions::CommandServiceFactory::GetForProfile(
|
| - panel_->browser()->profile());
|
| + panel_->GetBrowser()->profile());
|
| const extensions::Command* browser_action_command =
|
| command_service->GetBrowserActionCommand(
|
| extension_->id(),
|
| @@ -91,7 +92,7 @@ void BrowserActionButton::ViewHierarchyChanged(
|
| if (browser_action_command) {
|
| keybinding_.reset(new ui::Accelerator(
|
| browser_action_command->accelerator()));
|
| - panel_->GetFocusManager()->RegisterAccelerator(
|
| + GetFocusManager()->RegisterAccelerator(
|
| *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this);
|
| }
|
| }
|
| @@ -248,7 +249,7 @@ void BrowserActionButton::ShowContextMenu(const gfx::Point& p,
|
|
|
| // Reconstructs the menu every time because the menu's contents are dynamic.
|
| scoped_refptr<ExtensionContextMenuModel> context_menu_contents_(
|
| - new ExtensionContextMenuModel(extension(), panel_->browser()));
|
| + new ExtensionContextMenuModel(extension(), panel_->GetBrowser()));
|
| views::MenuModelAdapter menu_model_adapter(context_menu_contents_.get());
|
| views::MenuRunner menu_runner(menu_model_adapter.CreateMenu());
|
|
|
| @@ -287,12 +288,14 @@ BrowserActionButton::~BrowserActionButton() {
|
| // BrowserActionView
|
|
|
| BrowserActionView::BrowserActionView(const Extension* extension,
|
| - BrowserActionsContainer* panel)
|
| + BrowserActionsHostDelegate* panel)
|
| : panel_(panel) {
|
| - button_ = new BrowserActionButton(extension, panel);
|
| + button_ = new BrowserActionButton(extension, panel_);
|
| button_->set_drag_controller(panel_);
|
| AddChildView(button_);
|
| button_->UpdateState();
|
| + set_border(views::Border::CreateSolidBorder(1,
|
| + SkColorSetRGB(0x00, 0x00, 0x00))); // REMOVE ME
|
| }
|
|
|
| BrowserActionView::~BrowserActionView() {
|
| @@ -325,7 +328,8 @@ void BrowserActionView::Layout() {
|
| // since the bounds don't change). So instead of setting the height from the
|
| // button's preferred size, we use IconHeight(), since that's how big the
|
| // button should be regardless of what it's displaying.
|
| - button_->SetBounds(0, ToolbarView::kVertSpacing, width(),
|
| + gfx::Size size = panel_->GetContentOffset();
|
| + button_->SetBounds(size.width(), size.height(), width(),
|
| BrowserActionsContainer::IconHeight());
|
| }
|
|
|
| @@ -335,6 +339,11 @@ void BrowserActionView::GetAccessibleState(ui::AccessibleViewState* state) {
|
| state->role = ui::AccessibilityTypes::ROLE_GROUPING;
|
| }
|
|
|
| +gfx::Size BrowserActionView::GetPreferredSize() {
|
| + return gfx::Size(Extension::kBrowserActionIconMaxSize+10, // FIXME
|
| + Extension::kBrowserActionIconMaxSize+10);
|
| +}
|
| +
|
| void BrowserActionView::PaintChildren(gfx::Canvas* canvas) {
|
| View::PaintChildren(canvas);
|
| ExtensionAction* action = button()->browser_action();
|
|
|