OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/browser_actions_container.h" | 5 #include "chrome/browser/views/browser_actions_container.h" |
6 | 6 |
7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 return; | 372 return; |
373 | 373 |
374 gfx::Point origin; | 374 gfx::Point origin; |
375 View::ConvertPointToScreen(button, &origin); | 375 View::ConvertPointToScreen(button, &origin); |
376 gfx::Rect rect = button->bounds(); | 376 gfx::Rect rect = button->bounds(); |
377 rect.set_x(origin.x()); | 377 rect.set_x(origin.x()); |
378 rect.set_y(origin.y()); | 378 rect.set_y(origin.y()); |
379 popup_ = ExtensionPopup::Show(browser_action->popup_url(), | 379 popup_ = ExtensionPopup::Show(browser_action->popup_url(), |
380 toolbar_->browser(), | 380 toolbar_->browser(), |
381 rect, | 381 rect, |
382 BubbleBorder::TOP_RIGHT); | 382 BubbleBorder::TOP_RIGHT, |
| 383 true); // Activate the popup window. |
383 popup_->set_delegate(this); | 384 popup_->set_delegate(this); |
384 popup_button_ = button; | 385 popup_button_ = button; |
385 popup_button_->PopupDidShow(); | 386 popup_button_->PopupDidShow(); |
386 return; | 387 return; |
387 } | 388 } |
388 | 389 |
389 // Otherwise, we send the action to the extension. | 390 // Otherwise, we send the action to the extension. |
390 ExtensionBrowserEventRouter::GetInstance()->BrowserActionExecuted( | 391 ExtensionBrowserEventRouter::GetInstance()->BrowserActionExecuted( |
391 profile_, browser_action->extension_id(), toolbar_->browser()); | 392 profile_, browser_action->extension_id(), toolbar_->browser()); |
392 } | 393 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 std::min(static_cast<int>(browser_action_views_.size()), | 495 std::min(static_cast<int>(browser_action_views_.size()), |
495 kMinimumNumberOfVisibleBrowserActions) * kButtonSize; | 496 kMinimumNumberOfVisibleBrowserActions) * kButtonSize; |
496 | 497 |
497 // Even if available_width is <= 0, we still return at least the |min_width|. | 498 // Even if available_width is <= 0, we still return at least the |min_width|. |
498 if (available_width <= 0) | 499 if (available_width <= 0) |
499 return min_width; | 500 return min_width; |
500 | 501 |
501 return std::max(min_width, available_width - available_width % kButtonSize + | 502 return std::max(min_width, available_width - available_width % kButtonSize + |
502 kHorizontalPadding * 2); | 503 kHorizontalPadding * 2); |
503 } | 504 } |
OLD | NEW |