| 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/gtk/location_bar_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1514 page_action_->extension_id(), | 1514 page_action_->extension_id(), |
| 1515 page_action_->id(), | 1515 page_action_->id(), |
| 1516 current_tab_id_, | 1516 current_tab_id_, |
| 1517 current_url_.spec(), | 1517 current_url_.spec(), |
| 1518 event->button.button); | 1518 event->button.button); |
| 1519 } | 1519 } |
| 1520 } else { | 1520 } else { |
| 1521 const Extension* extension = profile_->GetExtensionService()-> | 1521 const Extension* extension = profile_->GetExtensionService()-> |
| 1522 GetExtensionById(page_action()->extension_id(), false); | 1522 GetExtensionById(page_action()->extension_id(), false); |
| 1523 | 1523 |
| 1524 context_menu_model_ = | 1524 if (extension->ShowConfigureContextMenus()) { |
| 1525 new ExtensionContextMenuModel(extension, owner_->browser_, this); | 1525 context_menu_model_ = |
| 1526 context_menu_.reset( | 1526 new ExtensionContextMenuModel(extension, owner_->browser_, this); |
| 1527 new MenuGtk(NULL, context_menu_model_.get())); | 1527 context_menu_.reset( |
| 1528 context_menu_->Popup(sender, event); | 1528 new MenuGtk(NULL, context_menu_model_.get())); |
| 1529 context_menu_->Popup(sender, event); |
| 1530 } |
| 1529 } | 1531 } |
| 1530 | 1532 |
| 1531 return TRUE; | 1533 return TRUE; |
| 1532 } | 1534 } |
| 1533 | 1535 |
| 1534 gboolean LocationBarViewGtk::PageActionViewGtk::OnExposeEvent( | 1536 gboolean LocationBarViewGtk::PageActionViewGtk::OnExposeEvent( |
| 1535 GtkWidget* widget, GdkEventExpose* event) { | 1537 GtkWidget* widget, GdkEventExpose* event) { |
| 1536 TabContents* contents = owner_->GetTabContents(); | 1538 TabContents* contents = owner_->GetTabContents(); |
| 1537 if (!contents) | 1539 if (!contents) |
| 1538 return FALSE; | 1540 return FALSE; |
| 1539 | 1541 |
| 1540 int tab_id = ExtensionTabUtil::GetTabId(contents); | 1542 int tab_id = ExtensionTabUtil::GetTabId(contents); |
| 1541 if (tab_id < 0) | 1543 if (tab_id < 0) |
| 1542 return FALSE; | 1544 return FALSE; |
| 1543 | 1545 |
| 1544 std::string badge_text = page_action_->GetBadgeText(tab_id); | 1546 std::string badge_text = page_action_->GetBadgeText(tab_id); |
| 1545 if (badge_text.empty()) | 1547 if (badge_text.empty()) |
| 1546 return FALSE; | 1548 return FALSE; |
| 1547 | 1549 |
| 1548 gfx::CanvasSkiaPaint canvas(event, false); | 1550 gfx::CanvasSkiaPaint canvas(event, false); |
| 1549 gfx::Rect bounding_rect(widget->allocation); | 1551 gfx::Rect bounding_rect(widget->allocation); |
| 1550 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); | 1552 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); |
| 1551 return FALSE; | 1553 return FALSE; |
| 1552 } | 1554 } |
| OLD | NEW |