| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome_frame/chrome_frame_npapi.h" | 5 #include "chrome_frame/chrome_frame_npapi.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } else if (LowerCaseEqualsASCII(argn[i], | 205 } else if (LowerCaseEqualsASCII(argn[i], |
| 206 kPluginOnPrivateMessageAttribute)) { | 206 kPluginOnPrivateMessageAttribute)) { |
| 207 onprivatemessage_arg = argv[i]; | 207 onprivatemessage_arg = argv[i]; |
| 208 } else if (LowerCaseEqualsASCII(argn[i], kPluginChromeExtraArguments)) { | 208 } else if (LowerCaseEqualsASCII(argn[i], kPluginChromeExtraArguments)) { |
| 209 chrome_extra_arguments_arg = argv[i]; | 209 chrome_extra_arguments_arg = argv[i]; |
| 210 } else if (LowerCaseEqualsASCII(argn[i], kPluginChromeProfileName)) { | 210 } else if (LowerCaseEqualsASCII(argn[i], kPluginChromeProfileName)) { |
| 211 chrome_profile_name_arg = argv[i]; | 211 chrome_profile_name_arg = argv[i]; |
| 212 } else if (LowerCaseEqualsASCII(argn[i], | 212 } else if (LowerCaseEqualsASCII(argn[i], |
| 213 kPluginChromeFunctionsAutomatedAttribute)) { | 213 kPluginChromeFunctionsAutomatedAttribute)) { |
| 214 functions_enabled_.clear(); | 214 functions_enabled_.clear(); |
| 215 // SplitString writes one empty entry for blank strings, so we need this | 215 // base::SplitString writes one empty entry for blank strings, so we need |
| 216 // to allow specifying zero automation of API functions. | 216 // this to allow specifying zero automation of API functions. |
| 217 if (argv[i][0] != '\0') | 217 if (argv[i][0] != '\0') |
| 218 SplitString(argv[i], ',', &functions_enabled_); | 218 base::SplitString(argv[i], ',', &functions_enabled_); |
| 219 } else if (LowerCaseEqualsASCII(argn[i], kPluginUseChromeNetwork)) { | 219 } else if (LowerCaseEqualsASCII(argn[i], kPluginUseChromeNetwork)) { |
| 220 chrome_network_arg_set = true; | 220 chrome_network_arg_set = true; |
| 221 chrome_network_arg = atoi(argv[i]) ? true : false; | 221 chrome_network_arg = atoi(argv[i]) ? true : false; |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 | 224 |
| 225 // Is the privileged mode requested? | 225 // Is the privileged mode requested? |
| 226 if (wants_privileged) { | 226 if (wants_privileged) { |
| 227 is_privileged_ = IsFireFoxPrivilegedInvocation(instance); | 227 is_privileged_ = IsFireFoxPrivilegedInvocation(instance); |
| 228 if (!is_privileged_) { | 228 if (!is_privileged_) { |
| (...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 // Empty by default e.g. if no arguments passed. | 1316 // Empty by default e.g. if no arguments passed. |
| 1317 std::vector<std::string> functions; | 1317 std::vector<std::string> functions; |
| 1318 | 1318 |
| 1319 if (arg_count == 1) { | 1319 if (arg_count == 1) { |
| 1320 const NPString& functions_str = args[0].value.stringValue; | 1320 const NPString& functions_str = args[0].value.stringValue; |
| 1321 std::string functions_a(functions_str.UTF8Characters, | 1321 std::string functions_a(functions_str.UTF8Characters, |
| 1322 functions_str.UTF8Length); | 1322 functions_str.UTF8Length); |
| 1323 | 1323 |
| 1324 // SplitString writes one empty entry for blank strings, so we need this | 1324 // base::SplitString writes one empty entry for blank strings, so we need |
| 1325 // to allow specifying zero automation of API functions. | 1325 // this to allow specifying zero automation of API functions. |
| 1326 if (functions_a[0] != '\0') | 1326 if (functions_a[0] != '\0') |
| 1327 SplitString(functions_a, ',', &functions); | 1327 base::SplitString(functions_a, ',', &functions); |
| 1328 } | 1328 } |
| 1329 | 1329 |
| 1330 automation_client_->tab()->SetEnableExtensionAutomation(functions); | 1330 automation_client_->tab()->SetEnableExtensionAutomation(functions); |
| 1331 // This function returns no result. | 1331 // This function returns no result. |
| 1332 | 1332 |
| 1333 return true; | 1333 return true; |
| 1334 } | 1334 } |
| 1335 | 1335 |
| 1336 bool ChromeFrameNPAPI::getEnabledExtensions(NPObject* npobject, | 1336 bool ChromeFrameNPAPI::getEnabledExtensions(NPObject* npobject, |
| 1337 const NPVariant* args, | 1337 const NPVariant* args, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 } | 1468 } |
| 1469 | 1469 |
| 1470 int32 ChromeFrameNPAPI::Write(NPStream* stream, int32 offset, int32 len, | 1470 int32 ChromeFrameNPAPI::Write(NPStream* stream, int32 offset, int32 len, |
| 1471 void* buffer) { | 1471 void* buffer) { |
| 1472 return url_fetcher_.Write(stream, offset, len, buffer); | 1472 return url_fetcher_.Write(stream, offset, len, buffer); |
| 1473 } | 1473 } |
| 1474 | 1474 |
| 1475 NPError ChromeFrameNPAPI::DestroyStream(NPStream* stream, NPReason reason) { | 1475 NPError ChromeFrameNPAPI::DestroyStream(NPStream* stream, NPReason reason) { |
| 1476 return url_fetcher_.DestroyStream(stream, reason); | 1476 return url_fetcher_.DestroyStream(stream, reason); |
| 1477 } | 1477 } |
| OLD | NEW |