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/property_bag.h" | 7 #include "base/property_bag.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 | 752 |
753 void OmniboxViewViews::OnAfterCutOrCopy() { | 753 void OmniboxViewViews::OnAfterCutOrCopy() { |
754 ui::Range selection_range; | 754 ui::Range selection_range; |
755 textfield_->GetSelectedRange(&selection_range); | 755 textfield_->GetSelectedRange(&selection_range); |
756 ui::Clipboard* cb = views::ViewsDelegate::views_delegate->GetClipboard(); | 756 ui::Clipboard* cb = views::ViewsDelegate::views_delegate->GetClipboard(); |
757 string16 selected_text; | 757 string16 selected_text; |
758 cb->ReadText(ui::Clipboard::BUFFER_STANDARD, &selected_text); | 758 cb->ReadText(ui::Clipboard::BUFFER_STANDARD, &selected_text); |
759 const string16 text = textfield_->text(); | 759 const string16 text = textfield_->text(); |
760 GURL url; | 760 GURL url; |
761 bool write_url; | 761 bool write_url; |
762 model_->AdjustTextForCopy(selection_range.start(), selected_text == text, | 762 model_->AdjustTextForCopy(selection_range.GetMin(), selected_text == text, |
763 &selected_text, &url, &write_url); | 763 &selected_text, &url, &write_url); |
764 ui::ScopedClipboardWriter scw(cb, ui::Clipboard::BUFFER_STANDARD); | 764 ui::ScopedClipboardWriter scw(cb, ui::Clipboard::BUFFER_STANDARD); |
765 scw.WriteText(selected_text); | 765 scw.WriteText(selected_text); |
766 if (write_url) { | 766 if (write_url) { |
767 BookmarkNodeData data; | 767 BookmarkNodeData data; |
768 data.ReadFromTuple(url, text); | 768 data.ReadFromTuple(url, text); |
769 data.WriteToClipboard(NULL); | 769 data.WriteToClipboard(NULL); |
770 } | 770 } |
771 } | 771 } |
772 | 772 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 OmniboxViewViews* omnibox_view = new OmniboxViewViews(controller, | 899 OmniboxViewViews* omnibox_view = new OmniboxViewViews(controller, |
900 toolbar_model, | 900 toolbar_model, |
901 profile, | 901 profile, |
902 command_updater, | 902 command_updater, |
903 popup_window_mode, | 903 popup_window_mode, |
904 location_bar); | 904 location_bar); |
905 omnibox_view->Init(); | 905 omnibox_view->Init(); |
906 return omnibox_view; | 906 return omnibox_view; |
907 } | 907 } |
908 #endif | 908 #endif |
OLD | NEW |