| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/omnibox/omnibox_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1474 guint target_type, | 1474 guint target_type, |
| 1475 guint time) { | 1475 guint time) { |
| 1476 DCHECK(text_view_); | 1476 DCHECK(text_view_); |
| 1477 | 1477 |
| 1478 switch (target_type) { | 1478 switch (target_type) { |
| 1479 case GTK_TEXT_BUFFER_TARGET_INFO_TEXT: { | 1479 case GTK_TEXT_BUFFER_TARGET_INFO_TEXT: { |
| 1480 gtk_selection_data_set_text(selection_data, dragged_text_.c_str(), -1); | 1480 gtk_selection_data_set_text(selection_data, dragged_text_.c_str(), -1); |
| 1481 break; | 1481 break; |
| 1482 } | 1482 } |
| 1483 case ui::CHROME_NAMED_URL: { | 1483 case ui::CHROME_NAMED_URL: { |
| 1484 WebContents* current_tab = browser_->GetSelectedWebContents(); | 1484 WebContents* current_tab = browser_->GetActiveWebContents(); |
| 1485 string16 tab_title = current_tab->GetTitle(); | 1485 string16 tab_title = current_tab->GetTitle(); |
| 1486 // Pass an empty string if user has edited the URL. | 1486 // Pass an empty string if user has edited the URL. |
| 1487 if (current_tab->GetURL().spec() != dragged_text_) | 1487 if (current_tab->GetURL().spec() != dragged_text_) |
| 1488 tab_title = string16(); | 1488 tab_title = string16(); |
| 1489 ui::WriteURLWithName(selection_data, GURL(dragged_text_), | 1489 ui::WriteURLWithName(selection_data, GURL(dragged_text_), |
| 1490 tab_title, target_type); | 1490 tab_title, target_type); |
| 1491 break; | 1491 break; |
| 1492 } | 1492 } |
| 1493 } | 1493 } |
| 1494 } | 1494 } |
| (...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2247 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { | 2247 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { |
| 2248 // By default, GtkTextView layouts an anchored child widget just above the | 2248 // By default, GtkTextView layouts an anchored child widget just above the |
| 2249 // baseline, so we need to move the |instant_view_| down to make sure it | 2249 // baseline, so we need to move the |instant_view_| down to make sure it |
| 2250 // has the same baseline as the |text_view_|. | 2250 // has the same baseline as the |text_view_|. |
| 2251 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2251 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
| 2252 int height; | 2252 int height; |
| 2253 pango_layout_get_size(layout, NULL, &height); | 2253 pango_layout_get_size(layout, NULL, &height); |
| 2254 int baseline = pango_layout_get_baseline(layout); | 2254 int baseline = pango_layout_get_baseline(layout); |
| 2255 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2255 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
| 2256 } | 2256 } |
| OLD | NEW |