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

Side by Side Diff: ui/base/clipboard/clipboard_util_win.h

Issue 380553002: Add a unit test that filenames aren't unintentionally converted to URLs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 5 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
« no previous file with comments | « remoting/host/clipboard_win.cc ('k') | ui/base/clipboard/clipboard_util_win.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) 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 // Some helper functions for working with the clipboard and IDataObjects. 5 // Some helper functions for working with the clipboard and IDataObjects.
6 6
7 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ 7 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_
8 #define UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ 8 #define UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_
9 9
10 #include <shlobj.h> 10 #include <shlobj.h>
11 #include <map> 11 #include <map>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "ui/base/ui_base_export.h" 16 #include "ui/base/ui_base_export.h"
17 17
18 class GURL;
19
18 namespace ui { 20 namespace ui {
19 21
20 class UI_BASE_EXPORT ClipboardUtil { 22 class UI_BASE_EXPORT ClipboardUtil {
21 public: 23 public:
22 ///////////////////////////////////////////////////////////////////////////// 24 /////////////////////////////////////////////////////////////////////////////
23 // These methods check to see if |data_object| has the requested type. 25 // These methods check to see if |data_object| has the requested type.
24 // Returns true if it does. 26 // Returns true if it does.
25 static bool HasUrl(IDataObject* data_object, bool convert_filenames); 27 static bool HasUrl(IDataObject* data_object, bool convert_filenames);
26 static bool HasFilenames(IDataObject* data_object); 28 static bool HasFilenames(IDataObject* data_object);
27 static bool HasPlainText(IDataObject* data_object); 29 static bool HasPlainText(IDataObject* data_object);
28 static bool HasFileContents(IDataObject* data_object); 30 static bool HasFileContents(IDataObject* data_object);
29 static bool HasHtml(IDataObject* data_object); 31 static bool HasHtml(IDataObject* data_object);
30 32
31 ///////////////////////////////////////////////////////////////////////////// 33 /////////////////////////////////////////////////////////////////////////////
32 // Helper methods to extract information from an IDataObject. These methods 34 // Helper methods to extract information from an IDataObject. These methods
33 // return true if the requested data type is found in |data_object|. 35 // return true if the requested data type is found in |data_object|.
36
37 // Only returns true if url->is_valid() is true.
34 static bool GetUrl(IDataObject* data_object, 38 static bool GetUrl(IDataObject* data_object,
35 base::string16* url, 39 GURL* url,
36 base::string16* title, 40 base::string16* title,
37 bool convert_filenames); 41 bool convert_filenames);
38 static bool GetFilenames(IDataObject* data_object, 42 static bool GetFilenames(IDataObject* data_object,
39 std::vector<base::string16>* filenames); 43 std::vector<base::string16>* filenames);
40 static bool GetPlainText(IDataObject* data_object, 44 static bool GetPlainText(IDataObject* data_object,
41 base::string16* plain_text); 45 base::string16* plain_text);
42 static bool GetHtml(IDataObject* data_object, 46 static bool GetHtml(IDataObject* data_object,
43 base::string16* text_html, 47 base::string16* text_html,
44 std::string* base_url); 48 std::string* base_url);
45 static bool GetFileContents(IDataObject* data_object, 49 static bool GetFileContents(IDataObject* data_object,
(...skipping 17 matching lines...) Expand all
63 static void CFHtmlExtractMetadata(const std::string& cf_html, 67 static void CFHtmlExtractMetadata(const std::string& cf_html,
64 std::string* base_url, 68 std::string* base_url,
65 size_t* html_start, 69 size_t* html_start,
66 size_t* fragment_start, 70 size_t* fragment_start,
67 size_t* fragment_end); 71 size_t* fragment_end);
68 }; 72 };
69 73
70 } 74 }
71 75
72 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ 76 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_
OLDNEW
« no previous file with comments | « remoting/host/clipboard_win.cc ('k') | ui/base/clipboard/clipboard_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698