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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 base::string16 selected_text = GetSelectedText(); | 861 base::string16 selected_text = GetSelectedText(); |
862 GURL url; | 862 GURL url; |
863 bool write_url; | 863 bool write_url; |
864 model()->AdjustTextForCopy(GetSelectedRange().GetMin(), IsSelectAll(), | 864 model()->AdjustTextForCopy(GetSelectedRange().GetMin(), IsSelectAll(), |
865 &selected_text, &url, &write_url); | 865 &selected_text, &url, &write_url); |
866 if (write_url) | 866 if (write_url) |
867 *drag_operations |= ui::DragDropTypes::DRAG_LINK; | 867 *drag_operations |= ui::DragDropTypes::DRAG_LINK; |
868 } | 868 } |
869 | 869 |
870 void OmniboxViewViews::OnWriteDragData(ui::OSExchangeData* data) { | 870 void OmniboxViewViews::OnWriteDragData(ui::OSExchangeData* data) { |
871 base::string16 selected_text = GetSelectedText(); | |
872 GURL url; | 871 GURL url; |
873 bool write_url; | 872 bool write_url; |
874 bool is_all_selected = IsSelectAll(); | 873 bool is_all_selected = IsSelectAll(); |
| 874 base::string16 selected_text = GetSelectedText(); |
875 model()->AdjustTextForCopy(GetSelectedRange().GetMin(), is_all_selected, | 875 model()->AdjustTextForCopy(GetSelectedRange().GetMin(), is_all_selected, |
876 &selected_text, &url, &write_url); | 876 &selected_text, &url, &write_url); |
877 data->SetString(selected_text); | 877 data->SetString(selected_text); |
878 if (write_url) { | 878 if (write_url) { |
879 gfx::Image favicon; | 879 gfx::Image favicon; |
880 base::string16 title = selected_text; | 880 base::string16 title = selected_text; |
881 if (is_all_selected) | 881 if (is_all_selected) |
882 model()->GetDataForURLExport(&url, &title, &favicon); | 882 model()->GetDataForURLExport(&url, &title, &favicon); |
883 button_drag_utils::SetURLAndDragImage(url, title, favicon.AsImageSkia(), | 883 button_drag_utils::SetURLAndDragImage(url, title, favicon.AsImageSkia(), |
884 data, GetWidget()); | 884 data, GetWidget()); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 const base::string16 text(GetClipboardText()); | 1019 const base::string16 text(GetClipboardText()); |
1020 if (!text.empty()) { | 1020 if (!text.empty()) { |
1021 // Record this paste, so we can do different behavior. | 1021 // Record this paste, so we can do different behavior. |
1022 model()->OnPaste(); | 1022 model()->OnPaste(); |
1023 // Force a Paste operation to trigger the text_changed code in | 1023 // Force a Paste operation to trigger the text_changed code in |
1024 // OnAfterPossibleChange(), even if identical contents are pasted. | 1024 // OnAfterPossibleChange(), even if identical contents are pasted. |
1025 text_before_change_.clear(); | 1025 text_before_change_.clear(); |
1026 InsertOrReplaceText(text); | 1026 InsertOrReplaceText(text); |
1027 } | 1027 } |
1028 } | 1028 } |
OLD | NEW |