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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 // NOTE: GetStateForTabSwitch may affect GetSelection, so order is important. | 428 // NOTE: GetStateForTabSwitch may affect GetSelection, so order is important. |
429 OmniboxEditModel::State model_state = model()->GetStateForTabSwitch(); | 429 OmniboxEditModel::State model_state = model()->GetStateForTabSwitch(); |
430 GetStateAccessor()->SetProperty( | 430 GetStateAccessor()->SetProperty( |
431 tab->GetPropertyBag(), | 431 tab->GetPropertyBag(), |
432 AutocompleteEditState(model_state, ViewState(GetSelection()))); | 432 AutocompleteEditState(model_state, ViewState(GetSelection()))); |
433 } | 433 } |
434 | 434 |
435 void OmniboxViewGtk::Update(const WebContents* contents) { | 435 void OmniboxViewGtk::Update(const WebContents* contents) { |
436 // NOTE: We're getting the URL text here from the ToolbarModel. | 436 // NOTE: We're getting the URL text here from the ToolbarModel. |
437 bool visibly_changed_permanent_text = | 437 bool visibly_changed_permanent_text = |
438 model()->UpdatePermanentText(toolbar_model()->GetText()); | 438 model()->UpdatePermanentText(toolbar_model()->GetText(true)); |
439 | 439 |
440 ToolbarModel::SecurityLevel security_level = | 440 ToolbarModel::SecurityLevel security_level = |
441 toolbar_model()->GetSecurityLevel(); | 441 toolbar_model()->GetSecurityLevel(); |
442 bool changed_security_level = (security_level != security_level_); | 442 bool changed_security_level = (security_level != security_level_); |
443 security_level_ = security_level; | 443 security_level_ = security_level; |
444 | 444 |
445 if (contents) { | 445 if (contents) { |
446 selected_text_.clear(); | 446 selected_text_.clear(); |
447 RevertAll(); | 447 RevertAll(); |
448 const AutocompleteEditState* state = | 448 const AutocompleteEditState* state = |
(...skipping 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2174 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { | 2174 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { |
2175 // By default, GtkTextView layouts an anchored child widget just above the | 2175 // By default, GtkTextView layouts an anchored child widget just above the |
2176 // baseline, so we need to move the |instant_view_| down to make sure it | 2176 // baseline, so we need to move the |instant_view_| down to make sure it |
2177 // has the same baseline as the |text_view_|. | 2177 // has the same baseline as the |text_view_|. |
2178 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2178 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
2179 int height; | 2179 int height; |
2180 pango_layout_get_size(layout, NULL, &height); | 2180 pango_layout_get_size(layout, NULL, &height); |
2181 int baseline = pango_layout_get_baseline(layout); | 2181 int baseline = pango_layout_get_baseline(layout); |
2182 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2182 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
2183 } | 2183 } |
OLD | NEW |