| OLD | NEW |
| 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 #include "chrome/common/extensions/user_script.h" | 5 #include "chrome/common/extensions/user_script.h" |
| 6 | 6 |
| 7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void UserScript::Pickle(::Pickle* pickle) const { | 77 void UserScript::Pickle(::Pickle* pickle) const { |
| 78 // Write the run location. | 78 // Write the run location. |
| 79 pickle->WriteInt(run_location()); | 79 pickle->WriteInt(run_location()); |
| 80 | 80 |
| 81 // Write the extension id. | 81 // Write the extension id. |
| 82 pickle->WriteString(extension_id()); | 82 pickle->WriteString(extension_id()); |
| 83 | 83 |
| 84 // Write Greasemonkey emulation. | 84 // Write Greasemonkey emulation. |
| 85 pickle->WriteBool(emulate_greasemonkey()); | 85 pickle->WriteBool(emulate_greasemonkey()); |
| 86 | 86 |
| 87 // Write match all frames |
| 88 pickle->WriteBool(match_all_frames()); |
| 89 |
| 87 // Write globs. | 90 // Write globs. |
| 88 std::vector<std::string>::const_iterator glob; | 91 std::vector<std::string>::const_iterator glob; |
| 89 pickle->WriteSize(globs_.size()); | 92 pickle->WriteSize(globs_.size()); |
| 90 for (glob = globs_.begin(); glob != globs_.end(); ++glob) { | 93 for (glob = globs_.begin(); glob != globs_.end(); ++glob) { |
| 91 pickle->WriteString(*glob); | 94 pickle->WriteString(*glob); |
| 92 } | 95 } |
| 93 pickle->WriteSize(exclude_globs_.size()); | 96 pickle->WriteSize(exclude_globs_.size()); |
| 94 for (glob = exclude_globs_.begin(); glob != exclude_globs_.end(); ++glob) { | 97 for (glob = exclude_globs_.begin(); glob != exclude_globs_.end(); ++glob) { |
| 95 pickle->WriteString(*glob); | 98 pickle->WriteString(*glob); |
| 96 } | 99 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 123 CHECK(pickle.ReadInt(iter, &run_location)); | 126 CHECK(pickle.ReadInt(iter, &run_location)); |
| 124 CHECK(run_location >= 0 && run_location < RUN_LOCATION_LAST); | 127 CHECK(run_location >= 0 && run_location < RUN_LOCATION_LAST); |
| 125 run_location_ = static_cast<RunLocation>(run_location); | 128 run_location_ = static_cast<RunLocation>(run_location); |
| 126 | 129 |
| 127 // Read the extension ID. | 130 // Read the extension ID. |
| 128 CHECK(pickle.ReadString(iter, &extension_id_)); | 131 CHECK(pickle.ReadString(iter, &extension_id_)); |
| 129 | 132 |
| 130 // Read Greasemonkey emulation. | 133 // Read Greasemonkey emulation. |
| 131 CHECK(pickle.ReadBool(iter, &emulate_greasemonkey_)); | 134 CHECK(pickle.ReadBool(iter, &emulate_greasemonkey_)); |
| 132 | 135 |
| 136 // Read match all frames |
| 137 CHECK(pickle.ReadBool(iter, &match_all_frames_)); |
| 138 |
| 133 // Read globs. | 139 // Read globs. |
| 134 size_t num_globs = 0; | 140 size_t num_globs = 0; |
| 135 CHECK(pickle.ReadSize(iter, &num_globs)); | 141 CHECK(pickle.ReadSize(iter, &num_globs)); |
| 136 globs_.clear(); | 142 globs_.clear(); |
| 137 for (size_t i = 0; i < num_globs; ++i) { | 143 for (size_t i = 0; i < num_globs; ++i) { |
| 138 std::string glob; | 144 std::string glob; |
| 139 CHECK(pickle.ReadString(iter, &glob)); | 145 CHECK(pickle.ReadString(iter, &glob)); |
| 140 globs_.push_back(glob); | 146 globs_.push_back(glob); |
| 141 } | 147 } |
| 142 | 148 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // Read css scripts. | 180 // Read css scripts. |
| 175 size_t num_css_files = 0; | 181 size_t num_css_files = 0; |
| 176 CHECK(pickle.ReadSize(iter, &num_css_files)); | 182 CHECK(pickle.ReadSize(iter, &num_css_files)); |
| 177 css_scripts_.clear(); | 183 css_scripts_.clear(); |
| 178 for (size_t i = 0; i < num_css_files; ++i) { | 184 for (size_t i = 0; i < num_css_files; ++i) { |
| 179 File file; | 185 File file; |
| 180 file.Unpickle(pickle, iter); | 186 file.Unpickle(pickle, iter); |
| 181 css_scripts_.push_back(file); | 187 css_scripts_.push_back(file); |
| 182 } | 188 } |
| 183 } | 189 } |
| OLD | NEW |