| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 if (argv[i][0] != '\0') | 223 if (argv[i][0] != '\0') |
| 224 base::SplitString(argv[i], ',', &functions_enabled_); | 224 base::SplitString(argv[i], ',', &functions_enabled_); |
| 225 } else if (LowerCaseEqualsASCII(argn[i], kPluginUseChromeNetwork)) { | 225 } else if (LowerCaseEqualsASCII(argn[i], kPluginUseChromeNetwork)) { |
| 226 chrome_network_arg_set = true; | 226 chrome_network_arg_set = true; |
| 227 chrome_network_arg = atoi(argv[i]) ? true : false; | 227 chrome_network_arg = atoi(argv[i]) ? true : false; |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 | 230 |
| 231 // Is the privileged mode requested? | 231 // Is the privileged mode requested? |
| 232 if (wants_privileged) { | 232 if (wants_privileged) { |
| 233 is_privileged_ = IsFireFoxPrivilegedInvocation(instance); | 233 set_is_privileged(IsFireFoxPrivilegedInvocation(instance)); |
| 234 if (!is_privileged_) { | 234 if (!is_privileged()) { |
| 235 DLOG(WARNING) << "Privileged mode requested in non-privileged context"; | 235 DLOG(WARNING) << "Privileged mode requested in non-privileged context"; |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 std::wstring extra_arguments; | 239 std::wstring extra_arguments; |
| 240 std::wstring profile_name(GetHostProcessName(false)); | 240 std::wstring profile_name(GetHostProcessName(false)); |
| 241 if (is_privileged_) { | 241 if (is_privileged()) { |
| 242 // Process any privileged mode-only arguments we were handed. | 242 // Process any privileged mode-only arguments we were handed. |
| 243 if (onprivatemessage_arg) | 243 if (onprivatemessage_arg) |
| 244 onprivatemessage_handler_ = JavascriptToNPObject(onprivatemessage_arg); | 244 onprivatemessage_handler_ = JavascriptToNPObject(onprivatemessage_arg); |
| 245 | 245 |
| 246 if (chrome_extra_arguments_arg) | 246 if (chrome_extra_arguments_arg) |
| 247 extra_arguments = UTF8ToWide(chrome_extra_arguments_arg); | 247 extra_arguments = UTF8ToWide(chrome_extra_arguments_arg); |
| 248 | 248 |
| 249 if (chrome_profile_name_arg) | 249 if (chrome_profile_name_arg) |
| 250 profile_name = UTF8ToWide(chrome_profile_name_arg); | 250 profile_name = UTF8ToWide(chrome_profile_name_arg); |
| 251 | 251 |
| 252 if (chrome_network_arg_set) | 252 if (chrome_network_arg_set) |
| 253 automation_client_->set_use_chrome_network(chrome_network_arg); | 253 automation_client_->set_use_chrome_network(chrome_network_arg); |
| 254 } | 254 } |
| 255 | 255 |
| 256 static const wchar_t kHandleTopLevelRequests[] = L"HandleTopLevelRequests"; | 256 static const wchar_t kHandleTopLevelRequests[] = L"HandleTopLevelRequests"; |
| 257 bool top_level_requests = GetConfigBool(true, kHandleTopLevelRequests); | 257 bool top_level_requests = GetConfigBool(true, kHandleTopLevelRequests); |
| 258 automation_client_->set_handle_top_level_requests(top_level_requests); | 258 automation_client_->set_handle_top_level_requests(top_level_requests); |
| 259 automation_client_->set_route_all_top_level_navigations(true); | 259 automation_client_->set_route_all_top_level_navigations(true); |
| 260 | 260 |
| 261 // Setup Url fetcher. | 261 // Setup Url fetcher. |
| 262 url_fetcher_.set_NPPInstance(instance_); | 262 url_fetcher_.set_NPPInstance(instance_); |
| 263 url_fetcher_.set_frame_busting(!is_privileged_); | 263 url_fetcher_.set_frame_busting(!is_privileged()); |
| 264 automation_client_->SetUrlFetcher(&url_fetcher_); | 264 automation_client_->SetUrlFetcher(&url_fetcher_); |
| 265 | 265 |
| 266 // TODO(joshia): Initialize navigation here and send proxy config as | 266 // TODO(joshia): Initialize navigation here and send proxy config as |
| 267 // part of LaunchSettings | 267 // part of LaunchSettings |
| 268 /* | 268 /* |
| 269 if (!src_.empty()) | 269 if (!src_.empty()) |
| 270 automation_client_->InitiateNavigation(src_, is_privileged_); | 270 automation_client_->InitiateNavigation(src_, is_privileged()); |
| 271 | 271 |
| 272 std::string proxy_settings; | 272 std::string proxy_settings; |
| 273 bool has_prefs = pref_service_->Initialize(instance_, | 273 bool has_prefs = pref_service_->Initialize(instance_, |
| 274 automation_client_.get()); | 274 automation_client_.get()); |
| 275 if (has_prefs && pref_service_->GetProxyValueJSONString(&proxy_settings)) { | 275 if (has_prefs && pref_service_->GetProxyValueJSONString(&proxy_settings)) { |
| 276 automation_client_->SetProxySettings(proxy_settings); | 276 automation_client_->SetProxySettings(proxy_settings); |
| 277 } | 277 } |
| 278 */ | 278 */ |
| 279 | 279 |
| 280 // We can't call SubscribeToFocusEvents here since | 280 // We can't call SubscribeToFocusEvents here since |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 void ChromeFrameNPAPI::OnAcceleratorPressed(int tab_handle, | 432 void ChromeFrameNPAPI::OnAcceleratorPressed(int tab_handle, |
| 433 const MSG& accel_message) { | 433 const MSG& accel_message) { |
| 434 DVLOG(1) << __FUNCTION__ | 434 DVLOG(1) << __FUNCTION__ |
| 435 << " msg:" << base::StringPrintf("0x%04X", accel_message.message) | 435 << " msg:" << base::StringPrintf("0x%04X", accel_message.message) |
| 436 << " key:" << accel_message.wParam; | 436 << " key:" << accel_message.wParam; |
| 437 | 437 |
| 438 // The host browser does call TranslateMessage on messages like WM_KEYDOWN | 438 // The host browser does call TranslateMessage on messages like WM_KEYDOWN |
| 439 // WM_KEYUP, etc, which will result in messages like WM_CHAR, WM_SYSCHAR, etc | 439 // WM_KEYUP, etc, which will result in messages like WM_CHAR, WM_SYSCHAR, etc |
| 440 // being posted to the message queue. We don't post these messages here to | 440 // being posted to the message queue. We don't post these messages here to |
| 441 // avoid these messages from getting handled twice. | 441 // avoid these messages from getting handled twice. |
| 442 if (!is_privileged_ && | 442 if (!is_privileged() && |
| 443 accel_message.message != WM_CHAR && | 443 accel_message.message != WM_CHAR && |
| 444 accel_message.message != WM_DEADCHAR && | 444 accel_message.message != WM_DEADCHAR && |
| 445 accel_message.message != WM_SYSCHAR && | 445 accel_message.message != WM_SYSCHAR && |
| 446 accel_message.message != WM_SYSDEADCHAR) { | 446 accel_message.message != WM_SYSDEADCHAR) { |
| 447 // A very primitive way to handle keystrokes. | 447 // A very primitive way to handle keystrokes. |
| 448 // TODO(tommi): When we've implemented a way for chrome to | 448 // TODO(tommi): When we've implemented a way for chrome to |
| 449 // know when keystrokes are handled (deterministically) on that side, | 449 // know when keystrokes are handled (deterministically) on that side, |
| 450 // then this function should get called and not otherwise. | 450 // then this function should get called and not otherwise. |
| 451 ::PostMessage(::GetParent(m_hWnd), accel_message.message, | 451 ::PostMessage(::GetParent(m_hWnd), accel_message.message, |
| 452 accel_message.wParam, accel_message.lParam); | 452 accel_message.wParam, accel_message.lParam); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 return true; | 629 return true; |
| 630 } | 630 } |
| 631 } else if (name == plugin_property_identifiers_[PLUGIN_PROPERTY_ONMESSAGE]) { | 631 } else if (name == plugin_property_identifiers_[PLUGIN_PROPERTY_ONMESSAGE]) { |
| 632 if (onmessage_handler_) { | 632 if (onmessage_handler_) { |
| 633 variant->type = NPVariantType_Object; | 633 variant->type = NPVariantType_Object; |
| 634 variant->value.objectValue = onmessage_handler_.Copy(); | 634 variant->value.objectValue = onmessage_handler_.Copy(); |
| 635 return true; | 635 return true; |
| 636 } | 636 } |
| 637 } else if (name == | 637 } else if (name == |
| 638 plugin_property_identifiers_[PLUGIN_PROPERTY_ONPRIVATEMESSAGE]) { | 638 plugin_property_identifiers_[PLUGIN_PROPERTY_ONPRIVATEMESSAGE]) { |
| 639 if (!is_privileged_) { | 639 if (!is_privileged()) { |
| 640 DLOG(WARNING) << "Attempt to read onprivatemessage property while not " | 640 DLOG(WARNING) << "Attempt to read onprivatemessage property while not " |
| 641 "privileged"; | 641 "privileged"; |
| 642 } else { | 642 } else { |
| 643 if (onprivatemessage_handler_) { | 643 if (onprivatemessage_handler_) { |
| 644 variant->type = NPVariantType_Object; | 644 variant->type = NPVariantType_Object; |
| 645 variant->value.objectValue = | 645 variant->value.objectValue = |
| 646 onprivatemessage_handler_.Copy(); | 646 onprivatemessage_handler_.Copy(); |
| 647 return true; | 647 return true; |
| 648 } | 648 } |
| 649 } | 649 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 662 AllocateStringVariant(WideToUTF8(version), variant); | 662 AllocateStringVariant(WideToUTF8(version), variant); |
| 663 return true; | 663 return true; |
| 664 } else if (name == plugin_property_identifiers_[PLUGIN_PROPERTY_READYSTATE]) { | 664 } else if (name == plugin_property_identifiers_[PLUGIN_PROPERTY_READYSTATE]) { |
| 665 INT32_TO_NPVARIANT(ready_state_, *variant); | 665 INT32_TO_NPVARIANT(ready_state_, *variant); |
| 666 return true; | 666 return true; |
| 667 } else if (name == | 667 } else if (name == |
| 668 plugin_property_identifiers_[PLUGIN_PROPERTY_USECHROMENETWORK]) { | 668 plugin_property_identifiers_[PLUGIN_PROPERTY_USECHROMENETWORK]) { |
| 669 BOOLEAN_TO_NPVARIANT(automation_client_->use_chrome_network(), *variant); | 669 BOOLEAN_TO_NPVARIANT(automation_client_->use_chrome_network(), *variant); |
| 670 return true; | 670 return true; |
| 671 } else if (name == plugin_property_identifiers_[PLUGIN_PROPERTY_SESSIONID]) { | 671 } else if (name == plugin_property_identifiers_[PLUGIN_PROPERTY_SESSIONID]) { |
| 672 if (!is_privileged_) { | 672 if (!is_privileged()) { |
| 673 DLOG(WARNING) << "Attempt to read sessionid property while not " | 673 DLOG(WARNING) << "Attempt to read sessionid property while not " |
| 674 "privileged"; | 674 "privileged"; |
| 675 } else { | 675 } else { |
| 676 INT32_TO_NPVARIANT(automation_client_->GetSessionId(), *variant); | 676 INT32_TO_NPVARIANT(automation_client_->GetSessionId(), *variant); |
| 677 return true; | 677 return true; |
| 678 } | 678 } |
| 679 } | 679 } |
| 680 | 680 |
| 681 return false; | 681 return false; |
| 682 } | 682 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 704 onerror_handler_.Free(); | 704 onerror_handler_.Free(); |
| 705 onerror_handler_ = variant->value.objectValue; | 705 onerror_handler_ = variant->value.objectValue; |
| 706 return true; | 706 return true; |
| 707 } else if ( | 707 } else if ( |
| 708 name == plugin_property_identifiers_[PLUGIN_PROPERTY_ONMESSAGE]) { | 708 name == plugin_property_identifiers_[PLUGIN_PROPERTY_ONMESSAGE]) { |
| 709 onmessage_handler_.Free(); | 709 onmessage_handler_.Free(); |
| 710 onmessage_handler_ = variant->value.objectValue; | 710 onmessage_handler_ = variant->value.objectValue; |
| 711 return true; | 711 return true; |
| 712 } else if (name == | 712 } else if (name == |
| 713 plugin_property_identifiers_[PLUGIN_PROPERTY_ONPRIVATEMESSAGE]) { | 713 plugin_property_identifiers_[PLUGIN_PROPERTY_ONPRIVATEMESSAGE]) { |
| 714 if (!is_privileged_) { | 714 if (!is_privileged()) { |
| 715 DLOG(WARNING) << "Attempt to set onprivatemessage while not privileged"; | 715 DLOG(WARNING) << "Attempt to set onprivatemessage while not privileged"; |
| 716 } else { | 716 } else { |
| 717 onprivatemessage_handler_.Free(); | 717 onprivatemessage_handler_.Free(); |
| 718 onprivatemessage_handler_ = variant->value.objectValue; | 718 onprivatemessage_handler_ = variant->value.objectValue; |
| 719 return true; | 719 return true; |
| 720 } | 720 } |
| 721 } else if (name == plugin_property_identifiers_[PLUGIN_PROPERTY_ONCLOSE]) { | 721 } else if (name == plugin_property_identifiers_[PLUGIN_PROPERTY_ONCLOSE]) { |
| 722 onclose_handler_.Free(); | 722 onclose_handler_.Free(); |
| 723 onclose_handler_ = variant->value.objectValue; | 723 onclose_handler_ = variant->value.objectValue; |
| 724 return true; | 724 return true; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 ScopedNpVariant result; | 816 ScopedNpVariant result; |
| 817 InvokeDefault(onerror_handler_, url, &result); | 817 InvokeDefault(onerror_handler_, url, &result); |
| 818 } | 818 } |
| 819 | 819 |
| 820 void ChromeFrameNPAPI::OnMessageFromChromeFrame(int tab_handle, | 820 void ChromeFrameNPAPI::OnMessageFromChromeFrame(int tab_handle, |
| 821 const std::string& message, | 821 const std::string& message, |
| 822 const std::string& origin, | 822 const std::string& origin, |
| 823 const std::string& target) { | 823 const std::string& target) { |
| 824 bool private_message = false; | 824 bool private_message = false; |
| 825 if (target.compare("*") != 0) { | 825 if (target.compare("*") != 0) { |
| 826 if (is_privileged_) { | 826 if (is_privileged()) { |
| 827 private_message = true; | 827 private_message = true; |
| 828 } else { | 828 } else { |
| 829 if (!HaveSameOrigin(target, document_url_)) { | 829 if (!HaveSameOrigin(target, document_url_)) { |
| 830 DLOG(WARNING) << "Dropping posted message since target doesn't match " | 830 DLOG(WARNING) << "Dropping posted message since target doesn't match " |
| 831 "the current document's origin. target=" << target; | 831 "the current document's origin. target=" << target; |
| 832 return; | 832 return; |
| 833 } | 833 } |
| 834 } | 834 } |
| 835 } | 835 } |
| 836 | 836 |
| 837 // Create a MessageEvent object that contains the message and origin | 837 // Create a MessageEvent object that contains the message and origin |
| 838 // as well as supporting other MessageEvent (see the HTML5 spec) properties. | 838 // as well as supporting other MessageEvent (see the HTML5 spec) properties. |
| 839 // Then call the onmessage handler. | 839 // Then call the onmessage handler. |
| 840 ScopedNpObject<NPObject> event; | 840 ScopedNpObject<NPObject> event; |
| 841 bool ok = CreateMessageEvent(false, true, message, origin, event.Receive()); | 841 bool ok = CreateMessageEvent(false, true, message, origin, event.Receive()); |
| 842 if (ok) { | 842 if (ok) { |
| 843 // Don't call FireEvent here (or we'll have an event wrapped by an event). | 843 // Don't call FireEvent here (or we'll have an event wrapped by an event). |
| 844 DispatchEvent(event); | 844 DispatchEvent(event); |
| 845 | 845 |
| 846 ScopedNpVariant result; | 846 ScopedNpVariant result; |
| 847 NPVariant params[2]; | 847 NPVariant params[2]; |
| 848 OBJECT_TO_NPVARIANT(event, params[0]); | 848 OBJECT_TO_NPVARIANT(event, params[0]); |
| 849 bool invoke = false; | 849 bool invoke = false; |
| 850 if (private_message) { | 850 if (private_message) { |
| 851 DCHECK(is_privileged_); | 851 DCHECK(is_privileged()); |
| 852 STRINGN_TO_NPVARIANT(target.c_str(), target.length(), params[1]); | 852 STRINGN_TO_NPVARIANT(target.c_str(), target.length(), params[1]); |
| 853 invoke = InvokeDefault(onprivatemessage_handler_, | 853 invoke = InvokeDefault(onprivatemessage_handler_, |
| 854 arraysize(params), | 854 arraysize(params), |
| 855 params, | 855 params, |
| 856 &result); | 856 &result); |
| 857 } else { | 857 } else { |
| 858 invoke = InvokeDefault(onmessage_handler_, params[0], &result); | 858 invoke = InvokeDefault(onmessage_handler_, params[0], &result); |
| 859 } | 859 } |
| 860 DLOG_IF(WARNING, !invoke) << "InvokeDefault failed"; | 860 DLOG_IF(WARNING, !invoke) << "InvokeDefault failed"; |
| 861 } else { | 861 } else { |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 | 1211 |
| 1212 automation_client_->ForwardMessageFromExternalHost(message, origin, target); | 1212 automation_client_->ForwardMessageFromExternalHost(message, origin, target); |
| 1213 | 1213 |
| 1214 return true; | 1214 return true; |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 bool ChromeFrameNPAPI::postPrivateMessage(NPObject* npobject, | 1217 bool ChromeFrameNPAPI::postPrivateMessage(NPObject* npobject, |
| 1218 const NPVariant* args, | 1218 const NPVariant* args, |
| 1219 uint32_t arg_count, | 1219 uint32_t arg_count, |
| 1220 NPVariant* result) { | 1220 NPVariant* result) { |
| 1221 if (!is_privileged_) { | 1221 if (!is_privileged()) { |
| 1222 DLOG(WARNING) << "postPrivateMessage invoked in non-privileged mode"; | 1222 DLOG(WARNING) << "postPrivateMessage invoked in non-privileged mode"; |
| 1223 return false; | 1223 return false; |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 if (arg_count != 3 || !NPVARIANT_IS_STRING(args[0]) || | 1226 if (arg_count != 3 || !NPVARIANT_IS_STRING(args[0]) || |
| 1227 !NPVARIANT_IS_STRING(args[1]) || !NPVARIANT_IS_STRING(args[2])) { | 1227 !NPVARIANT_IS_STRING(args[1]) || !NPVARIANT_IS_STRING(args[2])) { |
| 1228 NOTREACHED(); | 1228 NOTREACHED(); |
| 1229 return false; | 1229 return false; |
| 1230 } | 1230 } |
| 1231 | 1231 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1244 bool ChromeFrameNPAPI::installExtension(NPObject* npobject, | 1244 bool ChromeFrameNPAPI::installExtension(NPObject* npobject, |
| 1245 const NPVariant* args, | 1245 const NPVariant* args, |
| 1246 uint32_t arg_count, | 1246 uint32_t arg_count, |
| 1247 NPVariant* result) { | 1247 NPVariant* result) { |
| 1248 if (arg_count > 2 || !NPVARIANT_IS_STRING(args[0]) || | 1248 if (arg_count > 2 || !NPVARIANT_IS_STRING(args[0]) || |
| 1249 (arg_count == 2 && !NPVARIANT_IS_OBJECT(args[1]))) { | 1249 (arg_count == 2 && !NPVARIANT_IS_OBJECT(args[1]))) { |
| 1250 NOTREACHED(); | 1250 NOTREACHED(); |
| 1251 return false; | 1251 return false; |
| 1252 } | 1252 } |
| 1253 | 1253 |
| 1254 if (!is_privileged_) { | 1254 if (!is_privileged()) { |
| 1255 DLOG(WARNING) << "installExtension invoked in non-privileged mode"; | 1255 DLOG(WARNING) << "installExtension invoked in non-privileged mode"; |
| 1256 return false; | 1256 return false; |
| 1257 } | 1257 } |
| 1258 | 1258 |
| 1259 if (!automation_client_.get()) { | 1259 if (!automation_client_.get()) { |
| 1260 DLOG(WARNING) << "installExtension invoked with no automaton client"; | 1260 DLOG(WARNING) << "installExtension invoked with no automaton client"; |
| 1261 NOTREACHED(); | 1261 NOTREACHED(); |
| 1262 return false; | 1262 return false; |
| 1263 } | 1263 } |
| 1264 | 1264 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1291 bool ChromeFrameNPAPI::loadExtension(NPObject* npobject, | 1291 bool ChromeFrameNPAPI::loadExtension(NPObject* npobject, |
| 1292 const NPVariant* args, | 1292 const NPVariant* args, |
| 1293 uint32_t arg_count, | 1293 uint32_t arg_count, |
| 1294 NPVariant* result) { | 1294 NPVariant* result) { |
| 1295 if (arg_count > 2 || !NPVARIANT_IS_STRING(args[0]) || | 1295 if (arg_count > 2 || !NPVARIANT_IS_STRING(args[0]) || |
| 1296 (arg_count == 2 && !NPVARIANT_IS_OBJECT(args[1]))) { | 1296 (arg_count == 2 && !NPVARIANT_IS_OBJECT(args[1]))) { |
| 1297 NOTREACHED(); | 1297 NOTREACHED(); |
| 1298 return false; | 1298 return false; |
| 1299 } | 1299 } |
| 1300 | 1300 |
| 1301 if (!is_privileged_) { | 1301 if (!is_privileged()) { |
| 1302 DLOG(WARNING) << "loadExtension invoked in non-privileged mode"; | 1302 DLOG(WARNING) << "loadExtension invoked in non-privileged mode"; |
| 1303 return false; | 1303 return false; |
| 1304 } | 1304 } |
| 1305 | 1305 |
| 1306 if (!automation_client_.get()) { | 1306 if (!automation_client_.get()) { |
| 1307 DLOG(WARNING) << "loadExtension invoked with no automaton client"; | 1307 DLOG(WARNING) << "loadExtension invoked with no automaton client"; |
| 1308 NOTREACHED(); | 1308 NOTREACHED(); |
| 1309 return false; | 1309 return false; |
| 1310 } | 1310 } |
| 1311 | 1311 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1324 | 1324 |
| 1325 bool ChromeFrameNPAPI::enableExtensionAutomation(NPObject* npobject, | 1325 bool ChromeFrameNPAPI::enableExtensionAutomation(NPObject* npobject, |
| 1326 const NPVariant* args, | 1326 const NPVariant* args, |
| 1327 uint32_t arg_count, | 1327 uint32_t arg_count, |
| 1328 NPVariant* result) { | 1328 NPVariant* result) { |
| 1329 if (arg_count > 1 || (arg_count == 1 && !NPVARIANT_IS_STRING(args[0]))) { | 1329 if (arg_count > 1 || (arg_count == 1 && !NPVARIANT_IS_STRING(args[0]))) { |
| 1330 NOTREACHED(); | 1330 NOTREACHED(); |
| 1331 return false; | 1331 return false; |
| 1332 } | 1332 } |
| 1333 | 1333 |
| 1334 if (!is_privileged_) { | 1334 if (!is_privileged()) { |
| 1335 DLOG(WARNING) << | 1335 DLOG(WARNING) << |
| 1336 "enableExtensionAutomation invoked in non-privileged mode"; | 1336 "enableExtensionAutomation invoked in non-privileged mode"; |
| 1337 return false; | 1337 return false; |
| 1338 } | 1338 } |
| 1339 | 1339 |
| 1340 if (!automation_client_.get()) { | 1340 if (!automation_client_.get()) { |
| 1341 DLOG(WARNING) << | 1341 DLOG(WARNING) << |
| 1342 "enableExtensionAutomation invoked with no automaton client"; | 1342 "enableExtensionAutomation invoked with no automaton client"; |
| 1343 NOTREACHED(); | 1343 NOTREACHED(); |
| 1344 return false; | 1344 return false; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1372 | 1372 |
| 1373 bool ChromeFrameNPAPI::getEnabledExtensions(NPObject* npobject, | 1373 bool ChromeFrameNPAPI::getEnabledExtensions(NPObject* npobject, |
| 1374 const NPVariant* args, | 1374 const NPVariant* args, |
| 1375 uint32_t arg_count, | 1375 uint32_t arg_count, |
| 1376 NPVariant* result) { | 1376 NPVariant* result) { |
| 1377 if (arg_count > 1 || !NPVARIANT_IS_OBJECT(args[0])) { | 1377 if (arg_count > 1 || !NPVARIANT_IS_OBJECT(args[0])) { |
| 1378 NOTREACHED(); | 1378 NOTREACHED(); |
| 1379 return false; | 1379 return false; |
| 1380 } | 1380 } |
| 1381 | 1381 |
| 1382 if (!is_privileged_) { | 1382 if (!is_privileged()) { |
| 1383 DLOG(WARNING) << "getEnabledExtensions invoked in non-privileged mode"; | 1383 DLOG(WARNING) << "getEnabledExtensions invoked in non-privileged mode"; |
| 1384 return false; | 1384 return false; |
| 1385 } | 1385 } |
| 1386 | 1386 |
| 1387 if (!automation_client_.get()) { | 1387 if (!automation_client_.get()) { |
| 1388 DLOG(WARNING) << "getEnabledExtensions invoked with no automaton client"; | 1388 DLOG(WARNING) << "getEnabledExtensions invoked with no automaton client"; |
| 1389 NOTREACHED(); | 1389 NOTREACHED(); |
| 1390 return false; | 1390 return false; |
| 1391 } | 1391 } |
| 1392 | 1392 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 } else { | 1473 } else { |
| 1474 DLOG(WARNING) << "Not checking for private mode in Opera"; | 1474 DLOG(WARNING) << "Not checking for private mode in Opera"; |
| 1475 } | 1475 } |
| 1476 | 1476 |
| 1477 return incognito_mode; | 1477 return incognito_mode; |
| 1478 } | 1478 } |
| 1479 | 1479 |
| 1480 bool ChromeFrameNPAPI::PreProcessContextMenu(HMENU menu) { | 1480 bool ChromeFrameNPAPI::PreProcessContextMenu(HMENU menu) { |
| 1481 // TODO: Remove this overridden method once HandleContextMenuCommand | 1481 // TODO: Remove this overridden method once HandleContextMenuCommand |
| 1482 // implements "About Chrome Frame" handling. | 1482 // implements "About Chrome Frame" handling. |
| 1483 if (!is_privileged_) { | 1483 if (!is_privileged()) { |
| 1484 // Call base class (adds 'About' item). | 1484 // Call base class (adds 'About' item). |
| 1485 return ChromeFramePlugin::PreProcessContextMenu(menu); | 1485 return ChromeFramePlugin::PreProcessContextMenu(menu); |
| 1486 } | 1486 } |
| 1487 return true; | 1487 return true; |
| 1488 } | 1488 } |
| 1489 | 1489 |
| 1490 bool ChromeFrameNPAPI::HandleContextMenuCommand(UINT cmd, | 1490 bool ChromeFrameNPAPI::HandleContextMenuCommand(UINT cmd, |
| 1491 const IPC::MiniContextMenuParams& params) { | 1491 const IPC::MiniContextMenuParams& params) { |
| 1492 if (cmd == IDC_ABOUT_CHROME_FRAME) { | 1492 if (cmd == IDC_ABOUT_CHROME_FRAME) { |
| 1493 // TODO: implement "About Chrome Frame" | 1493 // TODO: implement "About Chrome Frame" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1505 } | 1505 } |
| 1506 | 1506 |
| 1507 int32 ChromeFrameNPAPI::Write(NPStream* stream, int32 offset, int32 len, | 1507 int32 ChromeFrameNPAPI::Write(NPStream* stream, int32 offset, int32 len, |
| 1508 void* buffer) { | 1508 void* buffer) { |
| 1509 return url_fetcher_.Write(stream, offset, len, buffer); | 1509 return url_fetcher_.Write(stream, offset, len, buffer); |
| 1510 } | 1510 } |
| 1511 | 1511 |
| 1512 NPError ChromeFrameNPAPI::DestroyStream(NPStream* stream, NPReason reason) { | 1512 NPError ChromeFrameNPAPI::DestroyStream(NPStream* stream, NPReason reason) { |
| 1513 return url_fetcher_.DestroyStream(stream, reason); | 1513 return url_fetcher_.DestroyStream(stream, reason); |
| 1514 } | 1514 } |
| OLD | NEW |