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

Side by Side Diff: chrome_frame/np_browser_functions.cc

Issue 6223003: Add support in the ChromeFrame NPAPI plugin for receiving URL redirect notifi... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome_frame/np_browser_functions.h ('k') | chrome_frame/npapi_url_request.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/np_browser_functions.h" 5 #include "chrome_frame/np_browser_functions.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace npapi { 9 namespace npapi {
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 NPN_ReleaseVariantValueProcPtr g_releasevariantvalue = NULL; 68 NPN_ReleaseVariantValueProcPtr g_releasevariantvalue = NULL;
69 NPN_SetExceptionProcPtr g_setexception = NULL; 69 NPN_SetExceptionProcPtr g_setexception = NULL;
70 NPN_PushPopupsEnabledStateProcPtr g_pushpopupsenabledstate = NULL; 70 NPN_PushPopupsEnabledStateProcPtr g_pushpopupsenabledstate = NULL;
71 NPN_PopPopupsEnabledStateProcPtr g_poppopupsenabledstate = NULL; 71 NPN_PopPopupsEnabledStateProcPtr g_poppopupsenabledstate = NULL;
72 NPN_EnumerateProcPtr g_enumerate = NULL; 72 NPN_EnumerateProcPtr g_enumerate = NULL;
73 NPN_PluginThreadAsyncCallProcPtr g_pluginthreadasynccall = NULL; 73 NPN_PluginThreadAsyncCallProcPtr g_pluginthreadasynccall = NULL;
74 NPN_ConstructProcPtr g_construct = NULL; 74 NPN_ConstructProcPtr g_construct = NULL;
75 NPN_GetValueForURLPtr g_getvalueforurl = NULL; 75 NPN_GetValueForURLPtr g_getvalueforurl = NULL;
76 NPN_SetValueForURLPtr g_setvalueforurl = NULL; 76 NPN_SetValueForURLPtr g_setvalueforurl = NULL;
77 NPN_GetAuthenticationInfoPtr g_getauthenticationinfo = NULL; 77 NPN_GetAuthenticationInfoPtr g_getauthenticationinfo = NULL;
78 NPN_URLRedirectResponsePtr g_urlredirectresponse = NULL;
78 79
79 // Must be called prior to calling any of the browser functions below. 80 // Must be called prior to calling any of the browser functions below.
80 void InitializeBrowserFunctions(NPNetscapeFuncs* functions) { 81 void InitializeBrowserFunctions(NPNetscapeFuncs* functions) {
81 CHECK(functions); 82 CHECK(functions);
82 DCHECK(g_geturl == NULL || g_geturl == functions->geturl); 83 DCHECK(g_geturl == NULL || g_geturl == functions->geturl);
83 84
84 g_version.set_version(functions->version); 85 g_version.set_version(functions->version);
85 86
86 g_geturl = functions->geturl; 87 g_geturl = functions->geturl;
87 g_posturl = functions->posturl; 88 g_posturl = functions->posturl;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 g_removeproperty = functions->removeproperty; 122 g_removeproperty = functions->removeproperty;
122 g_hasproperty = functions->hasproperty; 123 g_hasproperty = functions->hasproperty;
123 g_hasmethod = functions->hasmethod; 124 g_hasmethod = functions->hasmethod;
124 g_releasevariantvalue = functions->releasevariantvalue; 125 g_releasevariantvalue = functions->releasevariantvalue;
125 g_setexception = functions->setexception; 126 g_setexception = functions->setexception;
126 g_pushpopupsenabledstate = functions->pushpopupsenabledstate; 127 g_pushpopupsenabledstate = functions->pushpopupsenabledstate;
127 g_poppopupsenabledstate = functions->poppopupsenabledstate; 128 g_poppopupsenabledstate = functions->poppopupsenabledstate;
128 g_enumerate = functions->enumerate; 129 g_enumerate = functions->enumerate;
129 g_pluginthreadasynccall = functions->pluginthreadasynccall; 130 g_pluginthreadasynccall = functions->pluginthreadasynccall;
130 g_construct = functions->construct; 131 g_construct = functions->construct;
132 g_urlredirectresponse = functions->urlredirectresponse;
131 133
132 if (g_version.v.minor >= NPVERS_HAS_URL_AND_AUTH_INFO) { 134 if (g_version.v.minor >= NPVERS_HAS_URL_AND_AUTH_INFO) {
133 g_getvalueforurl = functions->getvalueforurl; 135 g_getvalueforurl = functions->getvalueforurl;
134 g_setvalueforurl = functions->setvalueforurl; 136 g_setvalueforurl = functions->setvalueforurl;
135 g_getauthenticationinfo = functions->getauthenticationinfo; 137 g_getauthenticationinfo = functions->getauthenticationinfo;
136 } 138 }
137 } 139 }
138 140
139 void UninitializeBrowserFunctions() { 141 void UninitializeBrowserFunctions() {
140 g_version.set_version(0); 142 g_version.set_version(0);
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 DCHECK(npapi::VersionMinor() >= NPVERS_HAS_URL_AND_AUTH_INFO); 487 DCHECK(npapi::VersionMinor() >= NPVERS_HAS_URL_AND_AUTH_INFO);
486 if (g_getauthenticationinfo) { 488 if (g_getauthenticationinfo) {
487 NOTREACHED(); 489 NOTREACHED();
488 return NPERR_INCOMPATIBLE_VERSION_ERROR; 490 return NPERR_INCOMPATIBLE_VERSION_ERROR;
489 } 491 }
490 492
491 return g_getauthenticationinfo(instance, protocol, host, port, scheme, 493 return g_getauthenticationinfo(instance, protocol, host, port, scheme,
492 realm, username, ulen, password, plen); 494 realm, username, ulen, password, plen);
493 } 495 }
494 496
497 void URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) {
498 if (!g_urlredirectresponse) {
499 NOTREACHED() << "Unexpected call to NPN_URLRedirectResponse";
500 return;
501 }
502 return g_urlredirectresponse(instance, notify_data, allow);
503 }
504
495 std::string StringFromIdentifier(NPIdentifier identifier) { 505 std::string StringFromIdentifier(NPIdentifier identifier) {
496 std::string ret; 506 std::string ret;
497 NPUTF8* utf8 = UTF8FromIdentifier(identifier); 507 NPUTF8* utf8 = UTF8FromIdentifier(identifier);
498 if (utf8) { 508 if (utf8) {
499 ret = utf8; 509 ret = utf8;
500 MemFree(utf8); 510 MemFree(utf8);
501 } 511 }
502 return ret; 512 return ret;
503 } 513 }
504 514
505 } // namespace npapi 515 } // namespace npapi
506 516
507 void AllocateStringVariant(const std::string& str, NPVariant* var) { 517 void AllocateStringVariant(const std::string& str, NPVariant* var) {
508 DCHECK(var); 518 DCHECK(var);
509 519
510 int len = str.length(); 520 int len = str.length();
511 NPUTF8* buffer = reinterpret_cast<NPUTF8*>(npapi::MemAlloc(len + 1)); 521 NPUTF8* buffer = reinterpret_cast<NPUTF8*>(npapi::MemAlloc(len + 1));
512 if (buffer) { 522 if (buffer) {
513 buffer[len] = '\0'; 523 buffer[len] = '\0';
514 memcpy(buffer, str.c_str(), len); 524 memcpy(buffer, str.c_str(), len);
515 STRINGN_TO_NPVARIANT(buffer, len, *var); 525 STRINGN_TO_NPVARIANT(buffer, len, *var);
516 } else { 526 } else {
517 NULL_TO_NPVARIANT(*var); 527 NULL_TO_NPVARIANT(*var);
518 } 528 }
519 } 529 }
520
OLDNEW
« no previous file with comments | « chrome_frame/np_browser_functions.h ('k') | chrome_frame/npapi_url_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698