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

Side by Side Diff: extensions/browser/api/guest_view/web_view/web_view_internal_api.cc

Issue 1058113002: Implement <webview>.addContentScript/removeContentScript API [3] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webui_api_1
Patch Set: Created 5 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
OLDNEW
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 "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/public/browser/render_process_host.h" 10 #include "content/public/browser/render_process_host.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 ExtensionResource resource = extension->GetResource(relative); 157 ExtensionResource resource = extension->GetResource(relative);
158 script->js_scripts().push_back(UserScript::File( 158 script->js_scripts().push_back(UserScript::File(
159 resource.extension_root(), resource.relative_path(), url)); 159 resource.extension_root(), resource.relative_path(), url));
160 } else { 160 } else {
161 script->js_scripts().push_back(extensions::UserScript::File( 161 script->js_scripts().push_back(extensions::UserScript::File(
162 base::FilePath(), base::FilePath(), url)); 162 base::FilePath(), base::FilePath(), url));
163 } 163 }
164 } 164 }
165 } 165 }
166 166
167 // code:
168 if (script_value.code) {
169 const std::vector<std::string>& codes = *(script_value.code.get());
170 for (const std::string& code : codes) {
171 extensions::UserScript::File file((base::FilePath()), (base::FilePath()),
172 GURL());
173 file.set_content(code);
Fady Samuel 2015/04/07 20:20:37 You should probably ask devlin@ or kalman@ whether
174 script->js_scripts().push_back(file);
175 }
176 }
177
167 // all_frames: 178 // all_frames:
168 if (script_value.all_frames) { 179 if (script_value.all_frames) {
169 script->set_match_all_frames(*(script_value.all_frames)); 180 script->set_match_all_frames(*(script_value.all_frames));
170 } 181 }
171 182
172 // include_globs: 183 // include_globs:
173 if (script_value.include_globs) { 184 if (script_value.include_globs) {
174 const std::vector<std::string>& include_globs = 185 const std::vector<std::string>& include_globs =
175 *(script_value.include_globs.get()); 186 *(script_value.include_globs.get());
176 for (const std::string& glob : include_globs) 187 for (const std::string& glob : include_globs)
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 // Will finish asynchronously. 889 // Will finish asynchronously.
879 return true; 890 return true;
880 } 891 }
881 892
882 void WebViewInternalClearDataFunction::ClearDataDone() { 893 void WebViewInternalClearDataFunction::ClearDataDone() {
883 Release(); // Balanced in RunAsync(). 894 Release(); // Balanced in RunAsync().
884 SendResponse(true); 895 SendResponse(true);
885 } 896 }
886 897
887 } // namespace extensions 898 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698