| 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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 ui::Range selection_range; | 721 ui::Range selection_range; |
| 722 textfield_->GetSelectedRange(&selection_range); | 722 textfield_->GetSelectedRange(&selection_range); |
| 723 ui::Clipboard* cb = views::ViewsDelegate::views_delegate->GetClipboard(); | 723 ui::Clipboard* cb = views::ViewsDelegate::views_delegate->GetClipboard(); |
| 724 string16 selected_text; | 724 string16 selected_text; |
| 725 cb->ReadText(ui::Clipboard::BUFFER_STANDARD, &selected_text); | 725 cb->ReadText(ui::Clipboard::BUFFER_STANDARD, &selected_text); |
| 726 const string16 text = textfield_->text(); | 726 const string16 text = textfield_->text(); |
| 727 GURL url; | 727 GURL url; |
| 728 bool write_url; | 728 bool write_url; |
| 729 model_->AdjustTextForCopy(selection_range.start(), selected_text == text, | 729 model_->AdjustTextForCopy(selection_range.start(), selected_text == text, |
| 730 &selected_text, &url, &write_url); | 730 &selected_text, &url, &write_url); |
| 731 ui::ScopedClipboardWriter scw(cb); | 731 ui::ScopedClipboardWriter scw(cb, ui::Clipboard::BUFFER_STANDARD); |
| 732 scw.WriteText(selected_text); | 732 scw.WriteText(selected_text); |
| 733 if (write_url) { | 733 if (write_url) { |
| 734 BookmarkNodeData data; | 734 BookmarkNodeData data; |
| 735 data.ReadFromTuple(url, text); | 735 data.ReadFromTuple(url, text); |
| 736 data.WriteToClipboard(NULL); | 736 data.WriteToClipboard(NULL); |
| 737 } | 737 } |
| 738 } | 738 } |
| 739 | 739 |
| 740 void OmniboxViewViews::OnWriteDragData(ui::OSExchangeData* data) { | 740 void OmniboxViewViews::OnWriteDragData(ui::OSExchangeData* data) { |
| 741 ui::Range selection_range; | 741 ui::Range selection_range; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 OmniboxViewViews* omnibox_view = new OmniboxViewViews(controller, | 853 OmniboxViewViews* omnibox_view = new OmniboxViewViews(controller, |
| 854 toolbar_model, | 854 toolbar_model, |
| 855 profile, | 855 profile, |
| 856 command_updater, | 856 command_updater, |
| 857 popup_window_mode, | 857 popup_window_mode, |
| 858 location_bar); | 858 location_bar); |
| 859 omnibox_view->Init(); | 859 omnibox_view->Init(); |
| 860 return omnibox_view; | 860 return omnibox_view; |
| 861 } | 861 } |
| 862 #endif | 862 #endif |
| OLD | NEW |