Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc

Issue 23804002: Make OmniboxEditModel::UpdatePermanentText() fetch the new text itself rather (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 // previously-saved offsets (but preserve PRIMARY). 462 // previously-saved offsets (but preserve PRIMARY).
463 StartUpdatingHighlightedText(); 463 StartUpdatingHighlightedText();
464 SetSelectedRange(state->view_state.selection_range); 464 SetSelectedRange(state->view_state.selection_range);
465 FinishUpdatingHighlightedText(); 465 FinishUpdatingHighlightedText();
466 } 466 }
467 } 467 }
468 468
469 void OmniboxViewGtk::Update() { 469 void OmniboxViewGtk::Update() {
470 const ToolbarModel::SecurityLevel old_security_level = security_level_; 470 const ToolbarModel::SecurityLevel old_security_level = security_level_;
471 security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false); 471 security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false);
472 if (model()->UpdatePermanentText( 472 if (model()->UpdatePermanentText())
473 controller()->GetToolbarModel()->GetText(true)))
474 RevertAll(); 473 RevertAll();
475 else if (old_security_level != security_level_) 474 else if (old_security_level != security_level_)
476 EmphasizeURLComponents(); 475 EmphasizeURLComponents();
477 } 476 }
478 477
479 string16 OmniboxViewGtk::GetText() const { 478 string16 OmniboxViewGtk::GetText() const {
480 GtkTextIter start, end; 479 GtkTextIter start, end;
481 GetTextBufferBounds(&start, &end); 480 GetTextBufferBounds(&start, &end);
482 gchar* utf8 = gtk_text_buffer_get_text(text_buffer_, &start, &end, false); 481 gchar* utf8 = gtk_text_buffer_get_text(text_buffer_, &start, &end, false);
483 string16 out(UTF8ToUTF16(utf8)); 482 string16 out(UTF8ToUTF16(utf8));
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 void OmniboxViewGtk::AdjustVerticalAlignmentOfGrayTextView() { 2135 void OmniboxViewGtk::AdjustVerticalAlignmentOfGrayTextView() {
2137 // By default, GtkTextView layouts an anchored child widget just above the 2136 // By default, GtkTextView layouts an anchored child widget just above the
2138 // baseline, so we need to move the |gray_text_view_| down to make sure it 2137 // baseline, so we need to move the |gray_text_view_| down to make sure it
2139 // has the same baseline as the |text_view_|. 2138 // has the same baseline as the |text_view_|.
2140 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(gray_text_view_)); 2139 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(gray_text_view_));
2141 int height; 2140 int height;
2142 pango_layout_get_size(layout, NULL, &height); 2141 pango_layout_get_size(layout, NULL, &height);
2143 int baseline = pango_layout_get_baseline(layout); 2142 int baseline = pango_layout_get_baseline(layout);
2144 g_object_set(gray_text_anchor_tag_, "rise", baseline - height, NULL); 2143 g_object_set(gray_text_anchor_tag_, "rise", baseline - height, NULL);
2145 } 2144 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm ('k') | chrome/browser/ui/omnibox/omnibox_edit_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698