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

Side by Side Diff: extensions/browser/api/execute_code_function.cc

Issue 1226353004: Generate all extension schema namespaces as "api" and instead vary the generated bundle names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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 #ifndef EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_IMPL_H_ 5 #ifndef EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_IMPL_H_
6 #define EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_IMPL_H_ 6 #define EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_IMPL_H_
7 7
8 #include "extensions/browser/api/execute_code_function.h" 8 #include "extensions/browser/api/execute_code_function.h"
9 9
10 #include "extensions/browser/component_extension_resource_manager.h" 10 #include "extensions/browser/component_extension_resource_manager.h"
(...skipping 15 matching lines...) Expand all
26 "Code and file should not be specified " 26 "Code and file should not be specified "
27 "at the same time in the second argument."; 27 "at the same time in the second argument.";
28 const char kBadFileEncodingError[] = 28 const char kBadFileEncodingError[] =
29 "Could not load file '*' for content script. It isn't UTF-8 encoded."; 29 "Could not load file '*' for content script. It isn't UTF-8 encoded.";
30 const char kLoadFileError[] = "Failed to load file: \"*\". "; 30 const char kLoadFileError[] = "Failed to load file: \"*\". ";
31 31
32 } 32 }
33 33
34 namespace extensions { 34 namespace extensions {
35 35
36 using core_api::extension_types::InjectDetails; 36 using api::extension_types::InjectDetails;
37 37
38 ExecuteCodeFunction::ExecuteCodeFunction() { 38 ExecuteCodeFunction::ExecuteCodeFunction() {
39 } 39 }
40 40
41 ExecuteCodeFunction::~ExecuteCodeFunction() { 41 ExecuteCodeFunction::~ExecuteCodeFunction() {
42 } 42 }
43 43
44 void ExecuteCodeFunction::DidLoadFile(bool success, const std::string& data) { 44 void ExecuteCodeFunction::DidLoadFile(bool success, const std::string& data) {
45 if (!success || !details_->file) { 45 if (!success || !details_->file) {
46 DidLoadAndLocalizeFile( 46 DidLoadAndLocalizeFile(
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 ? ScriptExecutor::ALL_FRAMES 142 ? ScriptExecutor::ALL_FRAMES
143 : ScriptExecutor::TOP_FRAME; 143 : ScriptExecutor::TOP_FRAME;
144 144
145 ScriptExecutor::MatchAboutBlank match_about_blank = 145 ScriptExecutor::MatchAboutBlank match_about_blank =
146 details_->match_about_blank.get() && *details_->match_about_blank 146 details_->match_about_blank.get() && *details_->match_about_blank
147 ? ScriptExecutor::MATCH_ABOUT_BLANK 147 ? ScriptExecutor::MATCH_ABOUT_BLANK
148 : ScriptExecutor::DONT_MATCH_ABOUT_BLANK; 148 : ScriptExecutor::DONT_MATCH_ABOUT_BLANK;
149 149
150 UserScript::RunLocation run_at = UserScript::UNDEFINED; 150 UserScript::RunLocation run_at = UserScript::UNDEFINED;
151 switch (details_->run_at) { 151 switch (details_->run_at) {
152 case core_api::extension_types::RUN_AT_NONE: 152 case api::extension_types::RUN_AT_NONE:
153 case core_api::extension_types::RUN_AT_DOCUMENT_IDLE: 153 case api::extension_types::RUN_AT_DOCUMENT_IDLE:
154 run_at = UserScript::DOCUMENT_IDLE; 154 run_at = UserScript::DOCUMENT_IDLE;
155 break; 155 break;
156 case core_api::extension_types::RUN_AT_DOCUMENT_START: 156 case api::extension_types::RUN_AT_DOCUMENT_START:
157 run_at = UserScript::DOCUMENT_START; 157 run_at = UserScript::DOCUMENT_START;
158 break; 158 break;
159 case core_api::extension_types::RUN_AT_DOCUMENT_END: 159 case api::extension_types::RUN_AT_DOCUMENT_END:
160 run_at = UserScript::DOCUMENT_END; 160 run_at = UserScript::DOCUMENT_END;
161 break; 161 break;
162 } 162 }
163 CHECK_NE(UserScript::UNDEFINED, run_at); 163 CHECK_NE(UserScript::UNDEFINED, run_at);
164 164
165 executor->ExecuteScript( 165 executor->ExecuteScript(
166 host_id_, 166 host_id_,
167 script_type, 167 script_type,
168 code_string, 168 code_string,
169 frame_scope, 169 frame_scope,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 const base::ListValue& result) { 243 const base::ListValue& result) {
244 if (!error.empty()) 244 if (!error.empty())
245 SetError(error); 245 SetError(error);
246 246
247 SendResponse(error.empty()); 247 SendResponse(error.empty());
248 } 248 }
249 249
250 } // namespace extensions 250 } // namespace extensions
251 251
252 #endif // EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_IMPL_H_ 252 #endif // EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698