| 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 ui::Range selection_range; | 699 ui::Range selection_range; |
| 700 textfield_->GetSelectedRange(&selection_range); | 700 textfield_->GetSelectedRange(&selection_range); |
| 701 ui::Clipboard* cb = views::ViewsDelegate::views_delegate->GetClipboard(); | 701 ui::Clipboard* cb = views::ViewsDelegate::views_delegate->GetClipboard(); |
| 702 string16 selected_text; | 702 string16 selected_text; |
| 703 cb->ReadText(ui::Clipboard::BUFFER_STANDARD, &selected_text); | 703 cb->ReadText(ui::Clipboard::BUFFER_STANDARD, &selected_text); |
| 704 const string16 text = textfield_->text(); | 704 const string16 text = textfield_->text(); |
| 705 GURL url; | 705 GURL url; |
| 706 bool write_url; | 706 bool write_url; |
| 707 model_->AdjustTextForCopy(selection_range.start(), selected_text == text, | 707 model_->AdjustTextForCopy(selection_range.start(), selected_text == text, |
| 708 &selected_text, &url, &write_url); | 708 &selected_text, &url, &write_url); |
| 709 ui::ScopedClipboardWriter scw(cb); | 709 ui::ScopedClipboardWriter scw(cb, ui::Clipboard::BUFFER_STANDARD); |
| 710 scw.WriteText(selected_text); | 710 scw.WriteText(selected_text); |
| 711 if (write_url) { | 711 if (write_url) { |
| 712 BookmarkNodeData data; | 712 BookmarkNodeData data; |
| 713 data.ReadFromTuple(url, text); | 713 data.ReadFromTuple(url, text); |
| 714 data.WriteToClipboard(NULL); | 714 data.WriteToClipboard(NULL); |
| 715 } | 715 } |
| 716 } | 716 } |
| 717 | 717 |
| 718 void OmniboxViewViews::OnWriteDragData(ui::OSExchangeData* data) { | 718 void OmniboxViewViews::OnWriteDragData(ui::OSExchangeData* data) { |
| 719 ui::Range selection_range; | 719 ui::Range selection_range; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 OmniboxViewViews* omnibox_view = new OmniboxViewViews(controller, | 831 OmniboxViewViews* omnibox_view = new OmniboxViewViews(controller, |
| 832 toolbar_model, | 832 toolbar_model, |
| 833 profile, | 833 profile, |
| 834 command_updater, | 834 command_updater, |
| 835 popup_window_mode, | 835 popup_window_mode, |
| 836 location_bar); | 836 location_bar); |
| 837 omnibox_view->Init(); | 837 omnibox_view->Init(); |
| 838 return omnibox_view; | 838 return omnibox_view; |
| 839 } | 839 } |
| 840 #endif | 840 #endif |
| OLD | NEW |