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/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 51 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
52 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 52 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
53 #include "ui/views/controls/textfield/native_textfield_views.h" | 53 #include "ui/views/controls/textfield/native_textfield_views.h" |
54 #include "ui/views/events/event.h" | 54 #include "ui/views/events/event.h" |
55 #else | 55 #else |
56 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 56 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
57 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" | 57 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
58 #include "chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h" | 58 #include "chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h" |
59 #endif | 59 #endif |
60 | 60 |
| 61 using content::WebContents; |
| 62 |
61 namespace { | 63 namespace { |
62 | 64 |
63 const gchar* kOmniboxViewGtkKey = "__OMNIBOX_VIEW_GTK__"; | 65 const gchar* kOmniboxViewGtkKey = "__OMNIBOX_VIEW_GTK__"; |
64 | 66 |
65 const char kTextBaseColor[] = "#808080"; | 67 const char kTextBaseColor[] = "#808080"; |
66 const char kSecureSchemeColor[] = "#079500"; | 68 const char kSecureSchemeColor[] = "#079500"; |
67 const char kSecurityErrorSchemeColor[] = "#a20000"; | 69 const char kSecurityErrorSchemeColor[] = "#a20000"; |
68 | 70 |
69 const double kStrikethroughStrokeRed = 162.0 / 256.0; | 71 const double kStrikethroughStrokeRed = 162.0 / 256.0; |
70 const double kStrikethroughStrokeWidth = 2.0; | 72 const double kStrikethroughStrokeWidth = 2.0; |
(...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 guint target_type, | 1581 guint target_type, |
1580 guint time) { | 1582 guint time) { |
1581 DCHECK(text_view_); | 1583 DCHECK(text_view_); |
1582 | 1584 |
1583 switch (target_type) { | 1585 switch (target_type) { |
1584 case GTK_TEXT_BUFFER_TARGET_INFO_TEXT: { | 1586 case GTK_TEXT_BUFFER_TARGET_INFO_TEXT: { |
1585 gtk_selection_data_set_text(selection_data, dragged_text_.c_str(), -1); | 1587 gtk_selection_data_set_text(selection_data, dragged_text_.c_str(), -1); |
1586 break; | 1588 break; |
1587 } | 1589 } |
1588 case ui::CHROME_NAMED_URL: { | 1590 case ui::CHROME_NAMED_URL: { |
1589 TabContents* current_tab = | 1591 WebContents* current_tab = |
1590 BrowserList::GetLastActive()->GetSelectedTabContents(); | 1592 BrowserList::GetLastActive()->GetSelectedWebContents(); |
1591 string16 tab_title = current_tab->GetTitle(); | 1593 string16 tab_title = current_tab->GetTitle(); |
1592 // Pass an empty string if user has edited the URL. | 1594 // Pass an empty string if user has edited the URL. |
1593 if (current_tab->GetURL().spec() != dragged_text_) | 1595 if (current_tab->GetURL().spec() != dragged_text_) |
1594 tab_title = string16(); | 1596 tab_title = string16(); |
1595 ui::WriteURLWithName(selection_data, GURL(dragged_text_), | 1597 ui::WriteURLWithName(selection_data, GURL(dragged_text_), |
1596 tab_title, target_type); | 1598 tab_title, target_type); |
1597 break; | 1599 break; |
1598 } | 1600 } |
1599 } | 1601 } |
1600 } | 1602 } |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2401 | 2403 |
2402 // Make all the children of the widget visible. NOTE: this won't display | 2404 // Make all the children of the widget visible. NOTE: this won't display |
2403 // anything, it just toggles the visible flag. | 2405 // anything, it just toggles the visible flag. |
2404 gtk_widget_show_all(omnibox_view->GetNativeView()); | 2406 gtk_widget_show_all(omnibox_view->GetNativeView()); |
2405 // Hide the widget. NativeViewHostGtk will make it visible again as necessary. | 2407 // Hide the widget. NativeViewHostGtk will make it visible again as necessary. |
2406 gtk_widget_hide(omnibox_view->GetNativeView()); | 2408 gtk_widget_hide(omnibox_view->GetNativeView()); |
2407 | 2409 |
2408 return omnibox_view; | 2410 return omnibox_view; |
2409 } | 2411 } |
2410 #endif | 2412 #endif |
OLD | NEW |