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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 #include "ui/base/dragdrop/gtk_dnd_util.h" | 63 #include "ui/base/dragdrop/gtk_dnd_util.h" |
64 #include "ui/base/gtk/gtk_hig_constants.h" | 64 #include "ui/base/gtk/gtk_hig_constants.h" |
65 #include "ui/base/l10n/l10n_util.h" | 65 #include "ui/base/l10n/l10n_util.h" |
66 #include "ui/base/resource/resource_bundle.h" | 66 #include "ui/base/resource/resource_bundle.h" |
67 #include "ui/gfx/canvas_skia_paint.h" | 67 #include "ui/gfx/canvas_skia_paint.h" |
68 #include "ui/gfx/font.h" | 68 #include "ui/gfx/font.h" |
69 #include "ui/gfx/gtk_util.h" | 69 #include "ui/gfx/gtk_util.h" |
70 #include "ui/gfx/image/image.h" | 70 #include "ui/gfx/image/image.h" |
71 #include "webkit/glue/window_open_disposition.h" | 71 #include "webkit/glue/window_open_disposition.h" |
72 | 72 |
| 73 using content::NavigationEntry; |
73 using content::OpenURLParams; | 74 using content::OpenURLParams; |
74 | 75 |
75 namespace { | 76 namespace { |
76 | 77 |
77 // We are positioned with a little bit of extra space that we don't use now. | 78 // We are positioned with a little bit of extra space that we don't use now. |
78 const int kTopMargin = 1; | 79 const int kTopMargin = 1; |
79 const int kBottomMargin = 1; | 80 const int kBottomMargin = 1; |
80 const int kLeftMargin = 1; | 81 const int kLeftMargin = 1; |
81 const int kRightMargin = 1; | 82 const int kRightMargin = 1; |
82 // We draw a border on the top and bottom (but not on left or right). | 83 // We draw a border on the top and bottom (but not on left or right). |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 // Do not show page info if the user has been editing the location | 1041 // Do not show page info if the user has been editing the location |
1041 // bar, or the location bar is at the NTP. | 1042 // bar, or the location bar is at the NTP. |
1042 if (location_entry()->IsEditingOrEmpty()) | 1043 if (location_entry()->IsEditingOrEmpty()) |
1043 return FALSE; | 1044 return FALSE; |
1044 | 1045 |
1045 // (0,0) event coordinates indicates that the release came at the end of | 1046 // (0,0) event coordinates indicates that the release came at the end of |
1046 // a drag. | 1047 // a drag. |
1047 if (event->x == 0 && event->y == 0) | 1048 if (event->x == 0 && event->y == 0) |
1048 return FALSE; | 1049 return FALSE; |
1049 | 1050 |
1050 content::NavigationEntry* nav_entry = tab->GetController().GetActiveEntry(); | 1051 NavigationEntry* nav_entry = tab->GetController().GetActiveEntry(); |
1051 if (!nav_entry) { | 1052 if (!nav_entry) { |
1052 NOTREACHED(); | 1053 NOTREACHED(); |
1053 return FALSE; | 1054 return FALSE; |
1054 } | 1055 } |
1055 tab->ShowPageInfo(nav_entry->GetURL(), nav_entry->GetSSL(), true); | 1056 tab->ShowPageInfo(nav_entry->GetURL(), nav_entry->GetSSL(), true); |
1056 return TRUE; | 1057 return TRUE; |
1057 } else if (event->button == 2) { | 1058 } else if (event->button == 2) { |
1058 // When the user middle clicks on the location icon, try to open the | 1059 // When the user middle clicks on the location icon, try to open the |
1059 // contents of the PRIMARY selection in the current tab. | 1060 // contents of the PRIMARY selection in the current tab. |
1060 // If the click was outside our bounds, do nothing. | 1061 // If the click was outside our bounds, do nothing. |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1651 | 1652 |
1652 std::string badge_text = page_action_->GetBadgeText(tab_id); | 1653 std::string badge_text = page_action_->GetBadgeText(tab_id); |
1653 if (badge_text.empty()) | 1654 if (badge_text.empty()) |
1654 return FALSE; | 1655 return FALSE; |
1655 | 1656 |
1656 gfx::CanvasSkiaPaint canvas(event, false); | 1657 gfx::CanvasSkiaPaint canvas(event, false); |
1657 gfx::Rect bounding_rect(widget->allocation); | 1658 gfx::Rect bounding_rect(widget->allocation); |
1658 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); | 1659 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); |
1659 return FALSE; | 1660 return FALSE; |
1660 } | 1661 } |
OLD | NEW |