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

Side by Side Diff: app/gtk_dnd_util.cc

Issue 548067: Allow link drags from the star, bookmarks bar, and bookmark bar menus (Closed)
Patch Set: Created 10 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/gtk/bookmark_bar_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/gtk_dnd_util.h" 5 #include "app/gtk_dnd_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 pickle.WriteString(UTF16ToUTF8(title)); 147 pickle.WriteString(UTF16ToUTF8(title));
148 pickle.WriteString(url.spec()); 148 pickle.WriteString(url.spec());
149 gtk_selection_data_set( 149 gtk_selection_data_set(
150 selection_data, 150 selection_data,
151 GetAtomForTarget(GtkDndUtil::CHROME_NAMED_URL), 151 GetAtomForTarget(GtkDndUtil::CHROME_NAMED_URL),
152 kBitsPerByte, 152 kBitsPerByte,
153 reinterpret_cast<const guchar*>(pickle.data()), 153 reinterpret_cast<const guchar*>(pickle.data()),
154 pickle.size()); 154 pickle.size());
155 break; 155 break;
156 } 156 }
157 case NETSCAPE_URL: {
158 // _NETSCAPE_URL format is URL + \n + title.
159 std::string utf8_text = url.spec() + "\n" + UTF16ToUTF8(title);
160 gtk_selection_data_set(selection_data,
161 selection_data->target,
162 kBitsPerByte,
163 reinterpret_cast<const guchar*>(utf8_text.c_str()),
164 utf8_text.length());
165 break;
166 }
167
157 default: { 168 default: {
158 NOTREACHED(); 169 NOTREACHED();
159 break; 170 break;
160 } 171 }
161 } 172 }
162 } 173 }
163 174
164 // static 175 // static
165 bool GtkDndUtil::ExtractNamedURL(GtkSelectionData* selection_data, 176 bool GtkDndUtil::ExtractNamedURL(GtkSelectionData* selection_data,
166 GURL* url, 177 GURL* url,
(...skipping 25 matching lines...) Expand all
192 203
193 for (size_t i = 0; uris[i] != NULL; ++i) { 204 for (size_t i = 0; uris[i] != NULL; ++i) {
194 GURL url(uris[i]); 205 GURL url(uris[i]);
195 if (url.is_valid()) 206 if (url.is_valid())
196 urls->push_back(url); 207 urls->push_back(url);
197 } 208 }
198 209
199 g_strfreev(uris); 210 g_strfreev(uris);
200 return true; 211 return true;
201 } 212 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/bookmark_bar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698