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

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: Rebase and replace \" by \'. 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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 // Will finish asynchronously. 885 // Will finish asynchronously.
878 return true; 886 return true;
879 } 887 }
880 888
881 void WebViewInternalClearDataFunction::ClearDataDone() { 889 void WebViewInternalClearDataFunction::ClearDataDone() {
882 Release(); // Balanced in RunAsync(). 890 Release(); // Balanced in RunAsync().
883 SendResponse(true); 891 SendResponse(true);
884 } 892 }
885 893
886 } // namespace extensions 894 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698