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

Side by Side Diff: chrome/common/extensions/user_script.h

Issue 193072: Move StringPiece into the base namespace. It is colliding (Closed)
Patch Set: take 2 Created 11 years, 3 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 | « chrome/browser/views/sync/sync_setup_wizard.cc ('k') | chrome/common/jstemplate_builder.h » ('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 2009 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_
6 #define CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_ 6 #define CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_
7 7
8 #include <vector> 8 #include <vector>
9 #include <string> 9 #include <string>
10 10
(...skipping 30 matching lines...) Expand all
41 File() {} 41 File() {}
42 42
43 const FilePath& path() const { return path_; } 43 const FilePath& path() const { return path_; }
44 void set_path(const FilePath& path) { path_ = path; } 44 void set_path(const FilePath& path) { path_ = path; }
45 45
46 const GURL& url() const { return url_; } 46 const GURL& url() const { return url_; }
47 void set_url(const GURL& url) { url_ = url; } 47 void set_url(const GURL& url) { url_ = url; }
48 48
49 // If external_content_ is set returns it as content otherwise it returns 49 // If external_content_ is set returns it as content otherwise it returns
50 // content_ 50 // content_
51 const StringPiece GetContent() const { 51 const base::StringPiece GetContent() const {
52 if (external_content_.data()) 52 if (external_content_.data())
53 return external_content_; 53 return external_content_;
54 else 54 else
55 return content_; 55 return content_;
56 } 56 }
57 void set_external_content(const StringPiece& content) { 57 void set_external_content(const base::StringPiece& content) {
58 external_content_ = content; 58 external_content_ = content;
59 } 59 }
60 const void set_content(const StringPiece& content) { 60 const void set_content(const base::StringPiece& content) {
61 content_.assign(content.begin(), content.end()); 61 content_.assign(content.begin(), content.end());
62 } 62 }
63 63
64 // Serialization support. The content and path_ member will not be 64 // Serialization support. The content and path_ member will not be
65 // serialized! 65 // serialized!
66 void Pickle(::Pickle* pickle) const; 66 void Pickle(::Pickle* pickle) const;
67 void Unpickle(const ::Pickle& pickle, void** iter); 67 void Unpickle(const ::Pickle& pickle, void** iter);
68 68
69 private: 69 private:
70 // Where is the script file lives on the disk. 70 // Where is the script file lives on the disk.
71 FilePath path_; 71 FilePath path_;
72 72
73 // The url to this scipt file. 73 // The url to this scipt file.
74 GURL url_; 74 GURL url_;
75 75
76 // The script content. It can be set to either loaded_content_ or 76 // The script content. It can be set to either loaded_content_ or
77 // externally allocated string. 77 // externally allocated string.
78 StringPiece external_content_; 78 base::StringPiece external_content_;
79 79
80 // Set when the content is loaded by LoadContent 80 // Set when the content is loaded by LoadContent
81 std::string content_; 81 std::string content_;
82 }; 82 };
83 83
84 typedef std::vector<File> FileList; 84 typedef std::vector<File> FileList;
85 85
86 // Constructor. Default the run location to document end, which is like 86 // Constructor. Default the run location to document end, which is like
87 // Greasemonkey and probably more useful for typical scripts. 87 // Greasemonkey and probably more useful for typical scripts.
88 UserScript() : run_location_(DOCUMENT_END) {} 88 UserScript() : run_location_(DOCUMENT_END) {}
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 FileList css_scripts_; 150 FileList css_scripts_;
151 151
152 // The ID of the extension this script is a part of, if any. Can be empty if 152 // The ID of the extension this script is a part of, if any. Can be empty if
153 // the script is a "standlone" user script. 153 // the script is a "standlone" user script.
154 std::string extension_id_; 154 std::string extension_id_;
155 }; 155 };
156 156
157 typedef std::vector<UserScript> UserScriptList; 157 typedef std::vector<UserScript> UserScriptList;
158 158
159 #endif // CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_ 159 #endif // CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_
OLDNEW
« no previous file with comments | « chrome/browser/views/sync/sync_setup_wizard.cc ('k') | chrome/common/jstemplate_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698