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

Side by Side Diff: chrome/browser/bookmarks/bookmark_drag_data.cc

Issue 31008: Coalesce more hardcoded schemes to using predefined constants. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/bookmarks/bookmark_drag_data.h" 5 #include "chrome/browser/bookmarks/bookmark_drag_data.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h" 10 #include "chrome/browser/bookmarks/bookmark_model.h"
11 #include "chrome/browser/profile.h" 11 #include "chrome/browser/profile.h"
12 #include "chrome/common/url_constants.h"
12 13
13 // TODO(port): Port this file. 14 // TODO(port): Port this file.
14 #if defined(OS_WIN) 15 #if defined(OS_WIN)
15 #include "chrome/common/os_exchange_data.h" 16 #include "chrome/common/os_exchange_data.h"
16 #else 17 #else
17 #include "chrome/common/temp_scaffolding_stubs.h" 18 #include "chrome/common/temp_scaffolding_stubs.h"
18 #endif 19 #endif
19 20
20 #if defined(OS_WIN) 21 #if defined(OS_WIN)
21 static CLIPFORMAT clipboard_format = 0; 22 static CLIPFORMAT clipboard_format = 0;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 89 }
89 90
90 void BookmarkDragData::Write(Profile* profile, OSExchangeData* data) const { 91 void BookmarkDragData::Write(Profile* profile, OSExchangeData* data) const {
91 RegisterFormat(); 92 RegisterFormat();
92 93
93 DCHECK(data); 94 DCHECK(data);
94 95
95 // If there is only one element and it is a URL, write the URL to the 96 // If there is only one element and it is a URL, write the URL to the
96 // clipboard. 97 // clipboard.
97 if (elements.size() == 1 && elements[0].is_url) { 98 if (elements.size() == 1 && elements[0].is_url) {
98 if (elements[0].url.SchemeIs("javascript")) { 99 if (elements[0].url.SchemeIs(chrome::kJavaScriptScheme)) {
99 data->SetString(ASCIIToWide(elements[0].url.spec())); 100 data->SetString(ASCIIToWide(elements[0].url.spec()));
100 } else { 101 } else {
101 data->SetURL(elements[0].url, elements[0].title); 102 data->SetURL(elements[0].url, elements[0].title);
102 } 103 }
103 } 104 }
104 105
105 Pickle data_pickle; 106 Pickle data_pickle;
106 data_pickle.WriteWString( 107 data_pickle.WriteWString(
107 profile ? profile->GetPath().ToWStringHack() : std::wstring()); 108 profile ? profile->GetPath().ToWStringHack() : std::wstring());
108 data_pickle.WriteSize(elements.size()); 109 data_pickle.WriteSize(elements.size());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 BookmarkNode* BookmarkDragData::GetFirstNode(Profile* profile) const { 183 BookmarkNode* BookmarkDragData::GetFirstNode(Profile* profile) const {
183 std::vector<BookmarkNode*> nodes = GetNodes(profile); 184 std::vector<BookmarkNode*> nodes = GetNodes(profile);
184 return nodes.size() == 1 ? nodes[0] : NULL; 185 return nodes.size() == 1 ? nodes[0] : NULL;
185 } 186 }
186 187
187 bool BookmarkDragData::IsFromProfile(Profile* profile) const { 188 bool BookmarkDragData::IsFromProfile(Profile* profile) const {
188 // An empty path means the data is not associated with any profile. 189 // An empty path means the data is not associated with any profile.
189 return (!profile_path_.empty() && 190 return (!profile_path_.empty() &&
190 profile->GetPath().ToWStringHack() == profile_path_); 191 profile->GetPath().ToWStringHack() == profile_path_);
191 } 192 }
OLDNEW
« no previous file with comments | « chrome/browser/back_forward_menu_model_unittest.cc ('k') | chrome/browser/browser_about_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698