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/tabs/tab_strip_gtk.h" | 5 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 &match, NULL); | 1759 &match, NULL); |
1760 url = match.destination_url; | 1760 url = match.destination_url; |
1761 } else { | 1761 } else { |
1762 std::string url_string(reinterpret_cast<char*>(data)); | 1762 std::string url_string(reinterpret_cast<char*>(data)); |
1763 url = GURL(url_string.substr(0, url_string.find_first_of('\n'))); | 1763 url = GURL(url_string.substr(0, url_string.find_first_of('\n'))); |
1764 } | 1764 } |
1765 if (!url.is_valid()) | 1765 if (!url.is_valid()) |
1766 return false; | 1766 return false; |
1767 | 1767 |
1768 browser::NavigateParams params(window()->browser(), url, | 1768 browser::NavigateParams params(window()->browser(), url, |
1769 PageTransition::LINK); | 1769 content::PAGE_TRANSITION_LINK); |
1770 params.tabstrip_index = drop_index; | 1770 params.tabstrip_index = drop_index; |
1771 | 1771 |
1772 if (drop_before) { | 1772 if (drop_before) { |
1773 params.disposition = NEW_FOREGROUND_TAB; | 1773 params.disposition = NEW_FOREGROUND_TAB; |
1774 } else { | 1774 } else { |
1775 params.disposition = CURRENT_TAB; | 1775 params.disposition = CURRENT_TAB; |
1776 params.source_contents = model_->GetTabContentsAt(drop_index); | 1776 params.source_contents = model_->GetTabContentsAt(drop_index); |
1777 } | 1777 } |
1778 | 1778 |
1779 browser::Navigate(¶ms); | 1779 browser::Navigate(¶ms); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2130 break; | 2130 break; |
2131 case 2: { | 2131 case 2: { |
2132 // On middle-click, try to parse the PRIMARY selection as a URL and load | 2132 // On middle-click, try to parse the PRIMARY selection as a URL and load |
2133 // it instead of creating a blank page. | 2133 // it instead of creating a blank page. |
2134 GURL url; | 2134 GURL url; |
2135 if (!gtk_util::URLFromPrimarySelection(model_->profile(), &url)) | 2135 if (!gtk_util::URLFromPrimarySelection(model_->profile(), &url)) |
2136 return; | 2136 return; |
2137 | 2137 |
2138 Browser* browser = window_->browser(); | 2138 Browser* browser = window_->browser(); |
2139 DCHECK(browser); | 2139 DCHECK(browser); |
2140 browser->AddSelectedTabWithURL(url, PageTransition::TYPED); | 2140 browser->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); |
2141 break; | 2141 break; |
2142 } | 2142 } |
2143 default: | 2143 default: |
2144 NOTREACHED() << "Got click on new tab button with unhandled mouse " | 2144 NOTREACHED() << "Got click on new tab button with unhandled mouse " |
2145 << "button " << mouse_button; | 2145 << "button " << mouse_button; |
2146 } | 2146 } |
2147 } | 2147 } |
2148 | 2148 |
2149 void TabStripGtk::SetTabBounds(TabGtk* tab, const gfx::Rect& bounds) { | 2149 void TabStripGtk::SetTabBounds(TabGtk* tab, const gfx::Rect& bounds) { |
2150 gfx::Rect bds = bounds; | 2150 gfx::Rect bds = bounds; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2186 | 2186 |
2187 // Let the middle mouse button initiate clicks as well. | 2187 // Let the middle mouse button initiate clicks as well. |
2188 gtk_util::SetButtonTriggersNavigation(button->widget()); | 2188 gtk_util::SetButtonTriggersNavigation(button->widget()); |
2189 g_signal_connect(button->widget(), "clicked", | 2189 g_signal_connect(button->widget(), "clicked", |
2190 G_CALLBACK(OnNewTabClickedThunk), this); | 2190 G_CALLBACK(OnNewTabClickedThunk), this); |
2191 gtk_widget_set_can_focus(button->widget(), FALSE); | 2191 gtk_widget_set_can_focus(button->widget(), FALSE); |
2192 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); | 2192 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); |
2193 | 2193 |
2194 return button; | 2194 return button; |
2195 } | 2195 } |
OLD | NEW |