| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 "chrome/browser/extensions/extension_browser_event_router.h" | 10 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 bool same_showing = popup_ && button == popup_button_; | 325 bool same_showing = popup_ && button == popup_button_; |
| 326 | 326 |
| 327 // Always hide the current popup, even if it's not the same. | 327 // Always hide the current popup, even if it's not the same. |
| 328 // Only one popup should be visible at a time. | 328 // Only one popup should be visible at a time. |
| 329 HidePopup(); | 329 HidePopup(); |
| 330 | 330 |
| 331 if (same_showing) | 331 if (same_showing) |
| 332 return; | 332 return; |
| 333 | 333 |
| 334 gfx::Point origin; | 334 gfx::Point origin; |
| 335 View::ConvertPointToWidget(button, &origin); | 335 View::ConvertPointToScreen(button, &origin); |
| 336 gfx::Rect rect = bounds(); | 336 gfx::Rect rect = button->bounds(); |
| 337 rect.set_x(origin.x()); | 337 rect.set_x(origin.x()); |
| 338 rect.set_y(origin.y()); | 338 rect.set_y(origin.y()); |
| 339 popup_ = ExtensionPopup::Show(browser_action.popup_url(), | 339 popup_ = ExtensionPopup::Show(browser_action.popup_url(), |
| 340 toolbar_->browser(), | 340 toolbar_->browser(), |
| 341 rect, | 341 rect, |
| 342 browser_action.popup_height()); | 342 browser_action.popup_height()); |
| 343 popup_->set_delegate(this); | 343 popup_->set_delegate(this); |
| 344 popup_button_ = button; | 344 popup_button_ = button; |
| 345 popup_button_->PopupDidShow(); | 345 popup_button_->PopupDidShow(); |
| 346 return; | 346 return; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 // text was too large. | 489 // text was too large. |
| 490 rect.fLeft += kPadding; | 490 rect.fLeft += kPadding; |
| 491 rect.fRight -= kPadding; | 491 rect.fRight -= kPadding; |
| 492 canvas->clipRect(rect); | 492 canvas->clipRect(rect); |
| 493 canvas->drawText(text.c_str(), text.size(), | 493 canvas->drawText(text.c_str(), text.size(), |
| 494 rect.fLeft + (rect.width() - text_width) / 2, | 494 rect.fLeft + (rect.width() - text_width) / 2, |
| 495 rect.fTop + kTextSize + 1, | 495 rect.fTop + kTextSize + 1, |
| 496 text_paint); | 496 text_paint); |
| 497 canvas->restore(); | 497 canvas->restore(); |
| 498 } | 498 } |
| OLD | NEW |