| 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_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 std::string OmniboxViewViews::GetClassName() const { | 433 std::string OmniboxViewViews::GetClassName() const { |
| 434 return kViewClassName; | 434 return kViewClassName; |
| 435 } | 435 } |
| 436 | 436 |
| 437 void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 437 void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
| 438 if (popup_view_->IsOpen()) | 438 if (popup_view_->IsOpen()) |
| 439 popup_view_->UpdatePopupAppearance(); | 439 popup_view_->UpdatePopupAppearance(); |
| 440 } | 440 } |
| 441 | 441 |
| 442 //////////////////////////////////////////////////////////////////////////////// | 442 //////////////////////////////////////////////////////////////////////////////// |
| 443 // OmniboxViewViews, AutocopmleteEditView implementation: | 443 // OmniboxViewViews, AutocompleteEditView implementation: |
| 444 | 444 |
| 445 void OmniboxViewViews::SaveStateToTab(WebContents* tab) { | 445 void OmniboxViewViews::SaveStateToTab(WebContents* tab) { |
| 446 DCHECK(tab); | 446 DCHECK(tab); |
| 447 | 447 |
| 448 // We don't want to keep the IME status, so force quit the current | 448 // We don't want to keep the IME status, so force quit the current |
| 449 // session here. It may affect the selection status, so order is | 449 // session here. It may affect the selection status, so order is |
| 450 // also important. | 450 // also important. |
| 451 if (textfield_->IsIMEComposing()) { | 451 if (textfield_->IsIMEComposing()) { |
| 452 textfield_->GetTextInputClient()->ConfirmCompositionText(); | 452 textfield_->GetTextInputClient()->ConfirmCompositionText(); |
| 453 textfield_->GetInputMethod()->CancelComposition(textfield_); | 453 textfield_->GetInputMethod()->CancelComposition(textfield_); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 sel.GetMax() < GetTextLength() || textfield_->IsIMEComposing(); | 566 sel.GetMax() < GetTextLength() || textfield_->IsIMEComposing(); |
| 567 | 567 |
| 568 model()->StartAutocomplete(!sel.is_empty(), no_inline_autocomplete); | 568 model()->StartAutocomplete(!sel.is_empty(), no_inline_autocomplete); |
| 569 } | 569 } |
| 570 | 570 |
| 571 void OmniboxViewViews::SetFocus() { | 571 void OmniboxViewViews::SetFocus() { |
| 572 // In views-implementation, the focus is on textfield rather than OmniboxView. | 572 // In views-implementation, the focus is on textfield rather than OmniboxView. |
| 573 textfield_->RequestFocus(); | 573 textfield_->RequestFocus(); |
| 574 } | 574 } |
| 575 | 575 |
| 576 void OmniboxViewViews::SetInvisibleFocus() { |
| 577 // TODO(mathp): implement for Aura. |
| 578 NOTIMPLEMENTED(); |
| 579 } |
| 580 |
| 576 void OmniboxViewViews::OnTemporaryTextMaybeChanged( | 581 void OmniboxViewViews::OnTemporaryTextMaybeChanged( |
| 577 const string16& display_text, | 582 const string16& display_text, |
| 578 bool save_original_selection) { | 583 bool save_original_selection) { |
| 579 if (save_original_selection) | 584 if (save_original_selection) |
| 580 textfield_->GetSelectedRange(&saved_temporary_selection_); | 585 textfield_->GetSelectedRange(&saved_temporary_selection_); |
| 581 | 586 |
| 582 SetWindowTextAndCaretPos(display_text, display_text.length(), false, true); | 587 SetWindowTextAndCaretPos(display_text, display_text.length(), false, true); |
| 583 } | 588 } |
| 584 | 589 |
| 585 bool OmniboxViewViews::OnInlineAutocompleteTextMaybeChanged( | 590 bool OmniboxViewViews::OnInlineAutocompleteTextMaybeChanged( |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 if (!text.empty()) { | 934 if (!text.empty()) { |
| 930 // Record this paste, so we can do different behavior. | 935 // Record this paste, so we can do different behavior. |
| 931 model()->on_paste(); | 936 model()->on_paste(); |
| 932 // Force a Paste operation to trigger the text_changed code in | 937 // Force a Paste operation to trigger the text_changed code in |
| 933 // OnAfterPossibleChange(), even if identical contents are pasted into the | 938 // OnAfterPossibleChange(), even if identical contents are pasted into the |
| 934 // text box. | 939 // text box. |
| 935 text_before_change_.clear(); | 940 text_before_change_.clear(); |
| 936 textfield_->ReplaceSelection(text); | 941 textfield_->ReplaceSelection(text); |
| 937 } | 942 } |
| 938 } | 943 } |
| OLD | NEW |