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

Side by Side Diff: webkit/glue/plugins/plugin_host.cc

Issue 19025: Add support for UA spoofing, and spoof Safari's UA string when loading URLs... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "config.h" 5 #include "config.h"
6 6
7 #include "webkit/glue/plugins/plugin_host.h" 7 #include "webkit/glue/plugins/plugin_host.h"
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 return plugin->NPP_DestroyStream(stream, reason); 568 return plugin->NPP_DestroyStream(stream, reason);
569 } 569 }
570 570
571 const char* NPN_UserAgent(NPP id) { 571 const char* NPN_UserAgent(NPP id) {
572 // Flash passes in a null id during the NP_initialize call. We need to 572 // Flash passes in a null id during the NP_initialize call. We need to
573 // default to the Mozilla user agent if we don't have an NPP instance or 573 // default to the Mozilla user agent if we don't have an NPP instance or
574 // else Flash won't request windowless mode. 574 // else Flash won't request windowless mode.
575 if (id) { 575 if (id) {
576 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 576 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
577 if (plugin.get() && !plugin->use_mozilla_user_agent()) 577 if (plugin.get() && !plugin->use_mozilla_user_agent())
578 return webkit_glue::GetUserAgent().c_str(); 578 return webkit_glue::GetUserAgent(GURL()).c_str();
579 } 579 }
580 580
581 static const char *UA = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1. 9a1) Gecko/20061103 Firefox/2.0a1"; 581 static const char *UA = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1. 9a1) Gecko/20061103 Firefox/2.0a1";
582 return UA; 582 return UA;
583 } 583 }
584 584
585 void NPN_Status(NPP id, const char* message) { 585 void NPN_Status(NPP id, const char* message) {
586 // Displays a message on the status line of the browser window. 586 // Displays a message on the status line of the browser window.
587 587
588 // TODO: implement me 588 // TODO: implement me
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 void (*func)(void *), 858 void (*func)(void *),
859 void *userData) { 859 void *userData) {
860 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 860 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
861 if (plugin) { 861 if (plugin) {
862 plugin->PluginThreadAsyncCall(func, userData); 862 plugin->PluginThreadAsyncCall(func, userData);
863 } 863 }
864 } 864 }
865 865
866 } // extern "C" 866 } // extern "C"
867 867
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698