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 <set> | 7 #include <set> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 model()->AdjustTextForCopy(GetSelectedRange().GetMin(), IsSelectAll(), | 946 model()->AdjustTextForCopy(GetSelectedRange().GetMin(), IsSelectAll(), |
947 &selected_text, &url, &write_url); | 947 &selected_text, &url, &write_url); |
948 if (IsSelectAll()) | 948 if (IsSelectAll()) |
949 UMA_HISTOGRAM_COUNTS(OmniboxEditModel::kCutOrCopyAllTextHistogram, 1); | 949 UMA_HISTOGRAM_COUNTS(OmniboxEditModel::kCutOrCopyAllTextHistogram, 1); |
950 | 950 |
951 if (write_url) { | 951 if (write_url) { |
952 BookmarkNodeData data; | 952 BookmarkNodeData data; |
953 data.ReadFromTuple(url, selected_text); | 953 data.ReadFromTuple(url, selected_text); |
954 data.WriteToClipboard(clipboard_type); | 954 data.WriteToClipboard(clipboard_type); |
955 } else { | 955 } else { |
956 ui::ScopedClipboardWriter scoped_clipboard_writer( | 956 ui::ScopedClipboardWriter scoped_clipboard_writer(clipboard_type); |
957 ui::Clipboard::GetForCurrentThread(), clipboard_type); | |
958 scoped_clipboard_writer.WriteText(selected_text); | 957 scoped_clipboard_writer.WriteText(selected_text); |
959 } | 958 } |
960 } | 959 } |
961 | 960 |
962 void OmniboxViewViews::OnWriteDragData(ui::OSExchangeData* data) { | 961 void OmniboxViewViews::OnWriteDragData(ui::OSExchangeData* data) { |
963 GURL url; | 962 GURL url; |
964 bool write_url; | 963 bool write_url; |
965 bool is_all_selected = IsSelectAll(); | 964 bool is_all_selected = IsSelectAll(); |
966 base::string16 selected_text = GetSelectedText(); | 965 base::string16 selected_text = GetSelectedText(); |
967 model()->AdjustTextForCopy(GetSelectedRange().GetMin(), is_all_selected, | 966 model()->AdjustTextForCopy(GetSelectedRange().GetMin(), is_all_selected, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 menu_contents->InsertItemWithStringIdAt( | 1037 menu_contents->InsertItemWithStringIdAt( |
1039 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); | 1038 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); |
1040 } | 1039 } |
1041 | 1040 |
1042 // Minor note: We use IDC_ for command id here while the underlying textfield | 1041 // Minor note: We use IDC_ for command id here while the underlying textfield |
1043 // is using IDS_ for all its command ids. This is because views cannot depend | 1042 // is using IDS_ for all its command ids. This is because views cannot depend |
1044 // on IDC_ for now. | 1043 // on IDC_ for now. |
1045 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1044 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
1046 IDS_EDIT_SEARCH_ENGINES); | 1045 IDS_EDIT_SEARCH_ENGINES); |
1047 } | 1046 } |
OLD | NEW |