Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 2750253002: Reland 4e4eae4cbe6136b538a: Make download item drags look like bookmark (Closed)
Patch Set: with fix Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 base::string16 selected_text = GetSelectedText(); 994 base::string16 selected_text = GetSelectedText();
995 model()->AdjustTextForCopy(GetSelectedRange().GetMin(), is_all_selected, 995 model()->AdjustTextForCopy(GetSelectedRange().GetMin(), is_all_selected,
996 &selected_text, &url, &write_url); 996 &selected_text, &url, &write_url);
997 data->SetString(selected_text); 997 data->SetString(selected_text);
998 if (write_url) { 998 if (write_url) {
999 gfx::Image favicon; 999 gfx::Image favicon;
1000 base::string16 title = selected_text; 1000 base::string16 title = selected_text;
1001 if (is_all_selected) 1001 if (is_all_selected)
1002 model()->GetDataForURLExport(&url, &title, &favicon); 1002 model()->GetDataForURLExport(&url, &title, &favicon);
1003 button_drag_utils::SetURLAndDragImage(url, title, favicon.AsImageSkia(), 1003 button_drag_utils::SetURLAndDragImage(url, title, favicon.AsImageSkia(),
1004 NULL, data, GetWidget()); 1004 nullptr, *GetWidget(), data);
1005 data->SetURL(url, title); 1005 data->SetURL(url, title);
1006 } 1006 }
1007 } 1007 }
1008 1008
1009 void OmniboxViewViews::OnGetDragOperationsForTextfield(int* drag_operations) { 1009 void OmniboxViewViews::OnGetDragOperationsForTextfield(int* drag_operations) {
1010 base::string16 selected_text = GetSelectedText(); 1010 base::string16 selected_text = GetSelectedText();
1011 GURL url; 1011 GURL url;
1012 bool write_url; 1012 bool write_url;
1013 model()->AdjustTextForCopy(GetSelectedRange().GetMin(), IsSelectAll(), 1013 model()->AdjustTextForCopy(GetSelectedRange().GetMin(), IsSelectAll(),
1014 &selected_text, &url, &write_url); 1014 &selected_text, &url, &write_url);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); 1058 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO);
1059 1059
1060 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); 1060 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR);
1061 1061
1062 // Minor note: We use IDC_ for command id here while the underlying textfield 1062 // Minor note: We use IDC_ for command id here while the underlying textfield
1063 // is using IDS_ for all its command ids. This is because views cannot depend 1063 // is using IDS_ for all its command ids. This is because views cannot depend
1064 // on IDC_ for now. 1064 // on IDC_ for now.
1065 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, 1065 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES,
1066 IDS_EDIT_SEARCH_ENGINES); 1066 IDS_EDIT_SEARCH_ENGINES);
1067 } 1067 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698