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 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 sender, this, | 1371 sender, this, |
1371 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 1372 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
1372 parent_->browser(), tab_contents, profile, | 1373 parent_->browser(), tab_contents, profile, |
1373 content_setting_image_model_->get_content_settings_type()), | 1374 content_setting_image_model_->get_content_settings_type()), |
1374 profile, tab_contents->tab_contents()); | 1375 profile, tab_contents->tab_contents()); |
1375 return TRUE; | 1376 return TRUE; |
1376 } | 1377 } |
1377 | 1378 |
1378 gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnExpose( | 1379 gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnExpose( |
1379 GtkWidget* sender, GdkEventExpose* event) { | 1380 GtkWidget* sender, GdkEventExpose* event) { |
| 1381 TRACE_EVENT0("ui::gtk", |
| 1382 "LocationBarViewGtk::ContentSettingImageViewGtk::OnExpose"); |
| 1383 |
1380 if (!(animation_.IsShowing() || animation_.IsClosing())) | 1384 if (!(animation_.IsShowing() || animation_.IsClosing())) |
1381 return FALSE; | 1385 return FALSE; |
1382 | 1386 |
1383 const int height = sender->allocation.height; | 1387 const int height = sender->allocation.height; |
1384 | 1388 |
1385 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); | 1389 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); |
1386 gdk_cairo_rectangle(cr, &event->area); | 1390 gdk_cairo_rectangle(cr, &event->area); |
1387 cairo_clip(cr); | 1391 cairo_clip(cr); |
1388 | 1392 |
1389 cairo_pattern_t* pattern = cairo_pattern_create_linear(0, 0, 0, height); | 1393 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... |
1614 context_menu_->PopupForWidget(sender, event->button, event->time); | 1618 context_menu_->PopupForWidget(sender, event->button, event->time); |
1615 } | 1619 } |
1616 } | 1620 } |
1617 | 1621 |
1618 return TRUE; | 1622 return TRUE; |
1619 } | 1623 } |
1620 | 1624 |
1621 gboolean LocationBarViewGtk::PageActionViewGtk::OnExposeEvent( | 1625 gboolean LocationBarViewGtk::PageActionViewGtk::OnExposeEvent( |
1622 GtkWidget* widget, | 1626 GtkWidget* widget, |
1623 GdkEventExpose* event) { | 1627 GdkEventExpose* event) { |
| 1628 TRACE_EVENT0("ui::gtk", "LocationBarViewGtk::PageActionViewGtk::OnExpose"); |
1624 TabContents* contents = owner_->GetTabContents(); | 1629 TabContents* contents = owner_->GetTabContents(); |
1625 if (!contents) | 1630 if (!contents) |
1626 return FALSE; | 1631 return FALSE; |
1627 | 1632 |
1628 int tab_id = ExtensionTabUtil::GetTabId(contents); | 1633 int tab_id = ExtensionTabUtil::GetTabId(contents); |
1629 if (tab_id < 0) | 1634 if (tab_id < 0) |
1630 return FALSE; | 1635 return FALSE; |
1631 | 1636 |
1632 std::string badge_text = page_action_->GetBadgeText(tab_id); | 1637 std::string badge_text = page_action_->GetBadgeText(tab_id); |
1633 if (badge_text.empty()) | 1638 if (badge_text.empty()) |
1634 return FALSE; | 1639 return FALSE; |
1635 | 1640 |
1636 gfx::CanvasSkiaPaint canvas(event, false); | 1641 gfx::CanvasSkiaPaint canvas(event, false); |
1637 gfx::Rect bounding_rect(widget->allocation); | 1642 gfx::Rect bounding_rect(widget->allocation); |
1638 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); | 1643 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); |
1639 return FALSE; | 1644 return FALSE; |
1640 } | 1645 } |
OLD | NEW |