| 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 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 OnBeforePossibleChange(); | 753 OnBeforePossibleChange(); |
| 754 } | 754 } |
| 755 | 755 |
| 756 void OmniboxViewViews::OnAfterUserAction(views::Textfield* sender) { | 756 void OmniboxViewViews::OnAfterUserAction(views::Textfield* sender) { |
| 757 OnAfterPossibleChange(); | 757 OnAfterPossibleChange(); |
| 758 } | 758 } |
| 759 | 759 |
| 760 void OmniboxViewViews::OnAfterCutOrCopy() { | 760 void OmniboxViewViews::OnAfterCutOrCopy() { |
| 761 ui::Range selection_range; | 761 ui::Range selection_range; |
| 762 textfield_->GetSelectedRange(&selection_range); | 762 textfield_->GetSelectedRange(&selection_range); |
| 763 ui::Clipboard* cb = views::ViewsDelegate::views_delegate->GetClipboard(); | 763 ui::Clipboard* cb = ui::Clipboard::GetForCurrentThread(); |
| 764 string16 selected_text; | 764 string16 selected_text; |
| 765 cb->ReadText(ui::Clipboard::BUFFER_STANDARD, &selected_text); | 765 cb->ReadText(ui::Clipboard::BUFFER_STANDARD, &selected_text); |
| 766 const string16 text = textfield_->text(); | 766 const string16 text = textfield_->text(); |
| 767 GURL url; | 767 GURL url; |
| 768 bool write_url; | 768 bool write_url; |
| 769 model()->AdjustTextForCopy(selection_range.GetMin(), selected_text == text, | 769 model()->AdjustTextForCopy(selection_range.GetMin(), selected_text == text, |
| 770 &selected_text, &url, &write_url); | 770 &selected_text, &url, &write_url); |
| 771 ui::ScopedClipboardWriter scw(cb, ui::Clipboard::BUFFER_STANDARD); | 771 ui::ScopedClipboardWriter scw(cb, ui::Clipboard::BUFFER_STANDARD); |
| 772 scw.WriteText(selected_text); | 772 scw.WriteText(selected_text); |
| 773 if (write_url) { | 773 if (write_url) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 const ui::Range& range) { | 898 const ui::Range& range) { |
| 899 if (text != GetText()) | 899 if (text != GetText()) |
| 900 textfield_->SetText(text); | 900 textfield_->SetText(text); |
| 901 textfield_->SelectRange(range); | 901 textfield_->SelectRange(range); |
| 902 } | 902 } |
| 903 | 903 |
| 904 string16 OmniboxViewViews::GetSelectedText() const { | 904 string16 OmniboxViewViews::GetSelectedText() const { |
| 905 // TODO(oshima): Support instant, IME. | 905 // TODO(oshima): Support instant, IME. |
| 906 return textfield_->GetSelectedText(); | 906 return textfield_->GetSelectedText(); |
| 907 } | 907 } |
| OLD | NEW |