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

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

Issue 1585013: Localize CSS files in content scripts (but don't localize JS files).... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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 | « chrome/chrome_tests.gypi ('k') | chrome/renderer/mock_render_thread.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 (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 #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
11 #include "base/file_path.h" 11 #include "base/file_path.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 const FilePath& extension_root() const { return extension_root_; } 56 const FilePath& extension_root() const { return extension_root_; }
57 const FilePath& relative_path() const { return relative_path_; } 57 const FilePath& relative_path() const { return relative_path_; }
58 58
59 const GURL& url() const { return url_; } 59 const GURL& url() const { return url_; }
60 void set_url(const GURL& url) { url_ = url; } 60 void set_url(const GURL& url) { url_ = url; }
61 61
62 // If external_content_ is set returns it as content otherwise it returns 62 // If external_content_ is set returns it as content otherwise it returns
63 // content_ 63 // content_
64 const base::StringPiece GetContent() const { 64 const base::StringPiece GetContent() const {
65 if (external_content_.data()) 65 if (!external_content_.empty())
66 return external_content_; 66 return external_content_;
67 else 67 else
68 return content_; 68 return content_;
69 } 69 }
70 void set_external_content(const base::StringPiece& content) { 70 void set_external_content(const base::StringPiece& content) {
71 external_content_ = content; 71 external_content_.assign(content.begin(), content.end());
72 } 72 }
73 void set_content(const base::StringPiece& content) { 73 void set_content(const base::StringPiece& content) {
74 content_.assign(content.begin(), content.end()); 74 content_.assign(content.begin(), content.end());
75 } 75 }
76 76
77 // Serialization support. The content and FilePath members will not be 77 // Serialization support. The content and FilePath members will not be
78 // serialized! 78 // serialized!
79 void Pickle(::Pickle* pickle) const; 79 void Pickle(::Pickle* pickle) const;
80 void Unpickle(const ::Pickle& pickle, void** iter); 80 void Unpickle(const ::Pickle& pickle, void** iter);
81 81
82 private: 82 private:
83 // Where the script file lives on the disk. We keep the path split so that 83 // Where the script file lives on the disk. We keep the path split so that
84 // it can be localized at will. 84 // it can be localized at will.
85 FilePath extension_root_; 85 FilePath extension_root_;
86 FilePath relative_path_; 86 FilePath relative_path_;
87 87
88 // The url to this scipt file. 88 // The url to this scipt file.
89 GURL url_; 89 GURL url_;
90 90
91 // The script content. It can be set to either loaded_content_ or 91 // The script content. It can be set to either loaded_content_ or
92 // externally allocated string. 92 // externally allocated string.
93 base::StringPiece external_content_; 93 std::string external_content_;
94 94
95 // Set when the content is loaded by LoadContent 95 // Set when the content is loaded by LoadContent
96 std::string content_; 96 std::string content_;
97 }; 97 };
98 98
99 typedef std::vector<File> FileList; 99 typedef std::vector<File> FileList;
100 100
101 // Constructor. Default the run location to document end, which is like 101 // Constructor. Default the run location to document end, which is like
102 // Greasemonkey and probably more useful for typical scripts. 102 // Greasemonkey and probably more useful for typical scripts.
103 UserScript() 103 UserScript()
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // Defaults to false. 221 // Defaults to false.
222 bool match_all_frames_; 222 bool match_all_frames_;
223 223
224 // True if the script should be injected into an incognito tab. 224 // True if the script should be injected into an incognito tab.
225 bool incognito_enabled_; 225 bool incognito_enabled_;
226 }; 226 };
227 227
228 typedef std::vector<UserScript> UserScriptList; 228 typedef std::vector<UserScript> UserScriptList;
229 229
230 #endif // CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_ 230 #endif // CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/renderer/mock_render_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698