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

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: nits. 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/browser_context.h" 10 #include "content/public/browser/browser_context.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 ExtensionResource resource = extension->GetResource(relative); 167 ExtensionResource resource = extension->GetResource(relative);
168 script->js_scripts().push_back(UserScript::File( 168 script->js_scripts().push_back(UserScript::File(
169 resource.extension_root(), resource.relative_path(), url)); 169 resource.extension_root(), resource.relative_path(), url));
170 } else { 170 } else {
171 script->js_scripts().push_back(extensions::UserScript::File( 171 script->js_scripts().push_back(extensions::UserScript::File(
172 base::FilePath(), base::FilePath(), url)); 172 base::FilePath(), base::FilePath(), url));
173 } 173 }
174 } 174 }
175 } 175 }
176 176
177 // code:
178 if (script_value.code) {
179 extensions::UserScript::File file((base::FilePath()), (base::FilePath()),
180 GURL());
181 file.set_content(*(script_value.code.get()));
182 script->js_scripts().push_back(file);
183 }
184
177 // all_frames: 185 // all_frames:
178 if (script_value.all_frames) 186 if (script_value.all_frames)
179 script->set_match_all_frames(*(script_value.all_frames)); 187 script->set_match_all_frames(*(script_value.all_frames));
180 188
181 // include_globs: 189 // include_globs:
182 if (script_value.include_globs) { 190 if (script_value.include_globs) {
183 for (const std::string& glob : *(script_value.include_globs.get())) 191 for (const std::string& glob : *(script_value.include_globs.get()))
184 script->add_glob(glob); 192 script->add_glob(glob);
185 } 193 }
186 194
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 // Will finish asynchronously. 886 // Will finish asynchronously.
879 return true; 887 return true;
880 } 888 }
881 889
882 void WebViewInternalClearDataFunction::ClearDataDone() { 890 void WebViewInternalClearDataFunction::ClearDataDone() {
883 Release(); // Balanced in RunAsync(). 891 Release(); // Balanced in RunAsync().
884 SendResponse(true); 892 SendResponse(true);
885 } 893 }
886 894
887 } // namespace extensions 895 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/test/data/webui/webview_execute_script_test.js ('k') | extensions/common/api/web_view_internal.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698