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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
438 std::string OmniboxViewViews::GetClassName() const { | 438 std::string OmniboxViewViews::GetClassName() const { |
439 return kViewClassName; | 439 return kViewClassName; |
440 } | 440 } |
441 | 441 |
442 void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 442 void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
443 if (popup_view_->IsOpen()) | 443 if (popup_view_->IsOpen()) |
444 popup_view_->UpdatePopupAppearance(); | 444 popup_view_->UpdatePopupAppearance(); |
445 } | 445 } |
446 | 446 |
447 //////////////////////////////////////////////////////////////////////////////// | 447 //////////////////////////////////////////////////////////////////////////////// |
448 // OmniboxViewViews, AutocopmleteEditView implementation: | 448 // OmniboxViewViews, AutocompleteEditView implementation: |
Peter Kasting
2012/12/01 03:49:58
Actually this class is called "OmniboxView" now an
samarth
2012/12/03 06:46:15
Done.
| |
449 | 449 |
450 void OmniboxViewViews::SaveStateToTab(WebContents* tab) { | 450 void OmniboxViewViews::SaveStateToTab(WebContents* tab) { |
451 DCHECK(tab); | 451 DCHECK(tab); |
452 | 452 |
453 // We don't want to keep the IME status, so force quit the current | 453 // We don't want to keep the IME status, so force quit the current |
454 // session here. It may affect the selection status, so order is | 454 // session here. It may affect the selection status, so order is |
455 // also important. | 455 // also important. |
456 if (textfield_->IsIMEComposing()) { | 456 if (textfield_->IsIMEComposing()) { |
457 textfield_->GetTextInputClient()->ConfirmCompositionText(); | 457 textfield_->GetTextInputClient()->ConfirmCompositionText(); |
458 textfield_->GetInputMethod()->CancelComposition(textfield_); | 458 textfield_->GetInputMethod()->CancelComposition(textfield_); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
571 sel.GetMax() < GetTextLength() || textfield_->IsIMEComposing(); | 571 sel.GetMax() < GetTextLength() || textfield_->IsIMEComposing(); |
572 | 572 |
573 model()->StartAutocomplete(!sel.is_empty(), no_inline_autocomplete); | 573 model()->StartAutocomplete(!sel.is_empty(), no_inline_autocomplete); |
574 } | 574 } |
575 | 575 |
576 void OmniboxViewViews::SetFocus() { | 576 void OmniboxViewViews::SetFocus() { |
577 // In views-implementation, the focus is on textfield rather than OmniboxView. | 577 // In views-implementation, the focus is on textfield rather than OmniboxView. |
578 textfield_->RequestFocus(); | 578 textfield_->RequestFocus(); |
579 } | 579 } |
580 | 580 |
581 void OmniboxViewViews::SetInvisibleFocus() { | |
582 // TODO(mathp): implement for Aura. | |
583 NOTIMPLEMENTED(); | |
584 } | |
585 | |
581 void OmniboxViewViews::OnTemporaryTextMaybeChanged( | 586 void OmniboxViewViews::OnTemporaryTextMaybeChanged( |
582 const string16& display_text, | 587 const string16& display_text, |
583 bool save_original_selection) { | 588 bool save_original_selection) { |
584 if (save_original_selection) | 589 if (save_original_selection) |
585 textfield_->GetSelectedRange(&saved_temporary_selection_); | 590 textfield_->GetSelectedRange(&saved_temporary_selection_); |
586 | 591 |
587 SetWindowTextAndCaretPos(display_text, display_text.length(), false, true); | 592 SetWindowTextAndCaretPos(display_text, display_text.length(), false, true); |
588 } | 593 } |
589 | 594 |
590 bool OmniboxViewViews::OnInlineAutocompleteTextMaybeChanged( | 595 bool OmniboxViewViews::OnInlineAutocompleteTextMaybeChanged( |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
934 if (!text.empty()) { | 939 if (!text.empty()) { |
935 // Record this paste, so we can do different behavior. | 940 // Record this paste, so we can do different behavior. |
936 model()->on_paste(); | 941 model()->on_paste(); |
937 // Force a Paste operation to trigger the text_changed code in | 942 // Force a Paste operation to trigger the text_changed code in |
938 // OnAfterPossibleChange(), even if identical contents are pasted into the | 943 // OnAfterPossibleChange(), even if identical contents are pasted into the |
939 // text box. | 944 // text box. |
940 text_before_change_.clear(); | 945 text_before_change_.clear(); |
941 textfield_->ReplaceSelection(text); | 946 textfield_->ReplaceSelection(text); |
942 } | 947 } |
943 } | 948 } |
OLD | NEW |