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/views/omnibox/omnibox_view_win.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <locale> | 8 #include <locale> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 CHARRANGE selection; | 555 CHARRANGE selection; |
556 GetSelection(selection); | 556 GetSelection(selection); |
557 GetStateAccessor()->SetProperty(tab->GetPropertyBag(), | 557 GetStateAccessor()->SetProperty(tab->GetPropertyBag(), |
558 AutocompleteEditState( | 558 AutocompleteEditState( |
559 model_state, | 559 model_state, |
560 State(selection, saved_selection_for_focus_change_))); | 560 State(selection, saved_selection_for_focus_change_))); |
561 } | 561 } |
562 | 562 |
563 void OmniboxViewWin::Update(const WebContents* tab_for_state_restoring) { | 563 void OmniboxViewWin::Update(const WebContents* tab_for_state_restoring) { |
564 const bool visibly_changed_permanent_text = | 564 const bool visibly_changed_permanent_text = |
565 model()->UpdatePermanentText(toolbar_model()->GetText()); | 565 model()->UpdatePermanentText(toolbar_model()->GetText(true)); |
566 | 566 |
567 const ToolbarModel::SecurityLevel security_level = | 567 const ToolbarModel::SecurityLevel security_level = |
568 toolbar_model()->GetSecurityLevel(); | 568 toolbar_model()->GetSecurityLevel(); |
569 const bool changed_security_level = (security_level != security_level_); | 569 const bool changed_security_level = (security_level != security_level_); |
570 | 570 |
571 // Bail early when no visible state will actually change (prevents an | 571 // Bail early when no visible state will actually change (prevents an |
572 // unnecessary ScopedFreeze, and thus UpdateWindow()). | 572 // unnecessary ScopedFreeze, and thus UpdateWindow()). |
573 if (!changed_security_level && !visibly_changed_permanent_text && | 573 if (!changed_security_level && !visibly_changed_permanent_text && |
574 !tab_for_state_restoring) | 574 !tab_for_state_restoring) |
575 return; | 575 return; |
(...skipping 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2635 return (rect.left - client_rect.left) + (client_rect.right - rect.right); | 2635 return (rect.left - client_rect.left) + (client_rect.right - rect.right); |
2636 } | 2636 } |
2637 | 2637 |
2638 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { | 2638 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { |
2639 // Use font_.GetStringWidth() instead of | 2639 // Use font_.GetStringWidth() instead of |
2640 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is | 2640 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is |
2641 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, | 2641 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, |
2642 // PosFromChar(i) might return 0 when i is greater than 1. | 2642 // PosFromChar(i) might return 0 when i is greater than 1. |
2643 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2643 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
2644 } | 2644 } |
OLD | NEW |