| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/debug/trace_event.h" |
| 13 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 16 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 17 #include "chrome/app/chrome_command_ids.h" | 18 #include "chrome/app/chrome_command_ids.h" |
| 18 #include "chrome/browser/accessibility/accessibility_events.h" | 19 #include "chrome/browser/accessibility/accessibility_events.h" |
| 19 #include "chrome/browser/alternate_nav_url_fetcher.h" | 20 #include "chrome/browser/alternate_nav_url_fetcher.h" |
| 20 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 21 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 21 #include "chrome/browser/command_updater.h" | 22 #include "chrome/browser/command_updater.h" |
| 22 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 23 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| (...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1375 sender, this, | 1376 sender, this, |
| 1376 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 1377 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| 1377 parent_->browser(), tab_contents, profile, | 1378 parent_->browser(), tab_contents, profile, |
| 1378 content_setting_image_model_->get_content_settings_type()), | 1379 content_setting_image_model_->get_content_settings_type()), |
| 1379 profile, tab_contents->tab_contents()); | 1380 profile, tab_contents->tab_contents()); |
| 1380 return TRUE; | 1381 return TRUE; |
| 1381 } | 1382 } |
| 1382 | 1383 |
| 1383 gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnExpose( | 1384 gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnExpose( |
| 1384 GtkWidget* sender, GdkEventExpose* event) { | 1385 GtkWidget* sender, GdkEventExpose* event) { |
| 1386 TRACE_EVENT0("ui::gtk", |
| 1387 "LocationBarViewGtk::ContentSettingImageViewGtk::OnExpose"); |
| 1388 |
| 1385 if (!(animation_.IsShowing() || animation_.IsClosing())) | 1389 if (!(animation_.IsShowing() || animation_.IsClosing())) |
| 1386 return FALSE; | 1390 return FALSE; |
| 1387 | 1391 |
| 1388 const int height = sender->allocation.height; | 1392 const int height = sender->allocation.height; |
| 1389 | 1393 |
| 1390 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); | 1394 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); |
| 1391 gdk_cairo_rectangle(cr, &event->area); | 1395 gdk_cairo_rectangle(cr, &event->area); |
| 1392 cairo_clip(cr); | 1396 cairo_clip(cr); |
| 1393 | 1397 |
| 1394 cairo_pattern_t* pattern = cairo_pattern_create_linear(0, 0, 0, height); | 1398 cairo_pattern_t* pattern = cairo_pattern_create_linear(0, 0, 0, height); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 context_menu_->PopupForWidget(sender, event->button, event->time); | 1623 context_menu_->PopupForWidget(sender, event->button, event->time); |
| 1620 } | 1624 } |
| 1621 } | 1625 } |
| 1622 | 1626 |
| 1623 return TRUE; | 1627 return TRUE; |
| 1624 } | 1628 } |
| 1625 | 1629 |
| 1626 gboolean LocationBarViewGtk::PageActionViewGtk::OnExposeEvent( | 1630 gboolean LocationBarViewGtk::PageActionViewGtk::OnExposeEvent( |
| 1627 GtkWidget* widget, | 1631 GtkWidget* widget, |
| 1628 GdkEventExpose* event) { | 1632 GdkEventExpose* event) { |
| 1633 TRACE_EVENT0("ui::gtk", "LocationBarViewGtk::PageActionViewGtk::OnExpose"); |
| 1629 TabContents* contents = owner_->GetTabContents(); | 1634 TabContents* contents = owner_->GetTabContents(); |
| 1630 if (!contents) | 1635 if (!contents) |
| 1631 return FALSE; | 1636 return FALSE; |
| 1632 | 1637 |
| 1633 int tab_id = ExtensionTabUtil::GetTabId(contents); | 1638 int tab_id = ExtensionTabUtil::GetTabId(contents); |
| 1634 if (tab_id < 0) | 1639 if (tab_id < 0) |
| 1635 return FALSE; | 1640 return FALSE; |
| 1636 | 1641 |
| 1637 std::string badge_text = page_action_->GetBadgeText(tab_id); | 1642 std::string badge_text = page_action_->GetBadgeText(tab_id); |
| 1638 if (badge_text.empty()) | 1643 if (badge_text.empty()) |
| 1639 return FALSE; | 1644 return FALSE; |
| 1640 | 1645 |
| 1641 gfx::CanvasSkiaPaint canvas(event, false); | 1646 gfx::CanvasSkiaPaint canvas(event, false); |
| 1642 gfx::Rect bounding_rect(widget->allocation); | 1647 gfx::Rect bounding_rect(widget->allocation); |
| 1643 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); | 1648 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); |
| 1644 return FALSE; | 1649 return FALSE; |
| 1645 } | 1650 } |
| OLD | NEW |