Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/guest_view/web_view/web_view_internal_api.h" | 5 #include "extensions/browser/api/guest_view/web_view/web_view_internal_api.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 // exclude_globs: | 202 // exclude_globs: |
| 203 if (script_value.exclude_globs) { | 203 if (script_value.exclude_globs) { |
| 204 for (const std::string& glob : *script_value.exclude_globs) | 204 for (const std::string& glob : *script_value.exclude_globs) |
| 205 script->add_exclude_glob(glob); | 205 script->add_exclude_glob(glob); |
| 206 } | 206 } |
| 207 | 207 |
| 208 return true; | 208 return true; |
| 209 } | 209 } |
| 210 | 210 |
| 211 bool ParseContentScripts( | 211 bool ParseContentScripts( |
| 212 std::vector<linked_ptr<ContentScriptDetails>> content_script_list, | 212 const std::vector<ContentScriptDetails>& content_script_list, |
|
lazyboy
2016/03/30 21:28:33
Nice fix!
| |
| 213 const extensions::Extension* extension, | 213 const extensions::Extension* extension, |
| 214 const HostID& host_id, | 214 const HostID& host_id, |
| 215 bool incognito_enabled, | 215 bool incognito_enabled, |
| 216 const GURL& owner_base_url, | 216 const GURL& owner_base_url, |
| 217 std::set<UserScript>* result, | 217 std::set<UserScript>* result, |
| 218 std::string* error) { | 218 std::string* error) { |
| 219 if (content_script_list.empty()) | 219 if (content_script_list.empty()) |
| 220 return false; | 220 return false; |
| 221 | 221 |
| 222 std::set<std::string> names; | 222 std::set<std::string> names; |
| 223 for (const linked_ptr<ContentScriptDetails> script_value : | 223 for (const ContentScriptDetails& script_value : content_script_list) { |
| 224 content_script_list) { | 224 const std::string& name = script_value.name; |
| 225 const std::string& name = script_value->name; | |
| 226 if (!names.insert(name).second) { | 225 if (!names.insert(name).second) { |
| 227 // The name was already in the list. | 226 // The name was already in the list. |
| 228 *error = kDuplicatedContentScriptNamesError; | 227 *error = kDuplicatedContentScriptNamesError; |
| 229 return false; | 228 return false; |
| 230 } | 229 } |
| 231 | 230 |
| 232 UserScript script; | 231 UserScript script; |
| 233 if (!ParseContentScript(*script_value, extension, owner_base_url, &script, | 232 if (!ParseContentScript(script_value, extension, owner_base_url, &script, |
| 234 error)) | 233 error)) |
| 235 return false; | 234 return false; |
| 236 | 235 |
| 237 script.set_id(UserScript::GenerateUserScriptID()); | 236 script.set_id(UserScript::GenerateUserScriptID()); |
| 238 script.set_name(name); | 237 script.set_name(name); |
| 239 script.set_incognito_enabled(incognito_enabled); | 238 script.set_incognito_enabled(incognito_enabled); |
| 240 script.set_host_id(host_id); | 239 script.set_host_id(host_id); |
| 241 script.set_consumer_instance_type(UserScript::WEBVIEW); | 240 script.set_consumer_instance_type(UserScript::WEBVIEW); |
| 242 result->insert(script); | 241 result->insert(script); |
| 243 } | 242 } |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 952 // Will finish asynchronously. | 951 // Will finish asynchronously. |
| 953 return true; | 952 return true; |
| 954 } | 953 } |
| 955 | 954 |
| 956 void WebViewInternalClearDataFunction::ClearDataDone() { | 955 void WebViewInternalClearDataFunction::ClearDataDone() { |
| 957 Release(); // Balanced in RunAsync(). | 956 Release(); // Balanced in RunAsync(). |
| 958 SendResponse(true); | 957 SendResponse(true); |
| 959 } | 958 } |
| 960 | 959 |
| 961 } // namespace extensions | 960 } // namespace extensions |
| OLD | NEW |