OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 SetTextAndSelectedRange(text, range); | 493 SetTextAndSelectedRange(text, range); |
494 | 494 |
495 if (update_popup) | 495 if (update_popup) |
496 UpdatePopup(); | 496 UpdatePopup(); |
497 | 497 |
498 if (notify_text_changed) | 498 if (notify_text_changed) |
499 TextChanged(); | 499 TextChanged(); |
500 } | 500 } |
501 | 501 |
502 void OmniboxViewGtk::SetForcedQuery() { | 502 void OmniboxViewGtk::SetForcedQuery() { |
503 const string16 current_text(GetText()); | 503 const base::string16 current_text(GetText()); |
504 const size_t start = current_text.find_first_not_of(kWhitespaceUTF16); | 504 const size_t start = current_text.find_first_not_of(base::kWhitespaceUTF16); |
505 if (start == string16::npos || (current_text[start] != '?')) { | 505 if (start == string16::npos || (current_text[start] != '?')) { |
506 SetUserText(ASCIIToUTF16("?")); | 506 SetUserText(ASCIIToUTF16("?")); |
507 } else { | 507 } else { |
508 StartUpdatingHighlightedText(); | 508 StartUpdatingHighlightedText(); |
509 SetSelectedRange(CharRange(current_text.size(), start + 1)); | 509 SetSelectedRange(CharRange(current_text.size(), start + 1)); |
510 FinishUpdatingHighlightedText(); | 510 FinishUpdatingHighlightedText(); |
511 } | 511 } |
512 } | 512 } |
513 | 513 |
514 bool OmniboxViewGtk::IsSelectAll() const { | 514 bool OmniboxViewGtk::IsSelectAll() const { |
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 void OmniboxViewGtk::AdjustVerticalAlignmentOfGrayTextView() { | 2126 void OmniboxViewGtk::AdjustVerticalAlignmentOfGrayTextView() { |
2127 // By default, GtkTextView layouts an anchored child widget just above the | 2127 // By default, GtkTextView layouts an anchored child widget just above the |
2128 // baseline, so we need to move the |gray_text_view_| down to make sure it | 2128 // baseline, so we need to move the |gray_text_view_| down to make sure it |
2129 // has the same baseline as the |text_view_|. | 2129 // has the same baseline as the |text_view_|. |
2130 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(gray_text_view_)); | 2130 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(gray_text_view_)); |
2131 int height; | 2131 int height; |
2132 pango_layout_get_size(layout, NULL, &height); | 2132 pango_layout_get_size(layout, NULL, &height); |
2133 int baseline = pango_layout_get_baseline(layout); | 2133 int baseline = pango_layout_get_baseline(layout); |
2134 g_object_set(gray_text_anchor_tag_, "rise", baseline - height, NULL); | 2134 g_object_set(gray_text_anchor_tag_, "rise", baseline - height, NULL); |
2135 } | 2135 } |
OLD | NEW |