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

Side by Side Diff: webkit/glue/plugins/webplugin_delegate_impl_mac.mm

Issue 196012: This changelist fixes some issues with the NPAPI WMP plugin work in Chrome. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "webkit/glue/plugins/webplugin_delegate_impl.h" 7 #include "webkit/glue/plugins/webplugin_delegate_impl.h"
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/scoped_ptr.h"
15 #include "base/stats_counters.h" 16 #include "base/stats_counters.h"
16 #include "base/string_util.h" 17 #include "base/string_util.h"
17 #include "webkit/api/public/WebInputEvent.h" 18 #include "webkit/api/public/WebInputEvent.h"
18 #include "webkit/default_plugin/plugin_impl.h" 19 #include "webkit/default_plugin/plugin_impl.h"
19 #include "webkit/glue/glue_util.h" 20 #include "webkit/glue/glue_util.h"
20 #include "webkit/glue/webplugin.h" 21 #include "webkit/glue/webplugin.h"
21 #include "webkit/glue/plugins/fake_plugin_window_tracker_mac.h" 22 #include "webkit/glue/plugins/fake_plugin_window_tracker_mac.h"
22 #include "webkit/glue/plugins/plugin_constants_win.h" 23 #include "webkit/glue/plugins/plugin_constants_win.h"
23 #include "webkit/glue/plugins/plugin_instance.h" 24 #include "webkit/glue/plugins/plugin_instance.h"
24 #include "webkit/glue/plugins/plugin_lib.h" 25 #include "webkit/glue/plugins/plugin_lib.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // end up needing to interpose on Carbon APIs in the plugin process (in order 58 // end up needing to interpose on Carbon APIs in the plugin process (in order
58 // to simulate window activation, for example), this could be replaced by 59 // to simulate window activation, for example), this could be replaced by
59 // interposing on GlobalToLocal and/or LocalToGlobal (see related TODO comments 60 // interposing on GlobalToLocal and/or LocalToGlobal (see related TODO comments
60 // below in WebPluginDelegateImpl::OnNullEvent()). 61 // below in WebPluginDelegateImpl::OnNullEvent()).
61 62
62 int g_current_x_offset = 0; 63 int g_current_x_offset = 0;
63 int g_current_y_offset = 0; 64 int g_current_y_offset = 0;
64 65
65 } // namespace 66 } // namespace
66 67
67 WebPluginDelegate* WebPluginDelegate::Create( 68 WebPluginDelegateImpl* WebPluginDelegateImpl::Create(
68 const FilePath& filename, 69 const FilePath& filename,
69 const std::string& mime_type, 70 const std::string& mime_type,
70 gfx::PluginWindowHandle containing_view) { 71 gfx::PluginWindowHandle containing_view) {
71 scoped_refptr<NPAPI::PluginLib> plugin = 72 scoped_refptr<NPAPI::PluginLib> plugin =
72 NPAPI::PluginLib::CreatePluginLib(filename); 73 NPAPI::PluginLib::CreatePluginLib(filename);
73 if (plugin.get() == NULL) 74 if (plugin.get() == NULL)
74 return NULL; 75 return NULL;
75 76
76 NPError err = plugin->NP_Initialize(); 77 NPError err = plugin->NP_Initialize();
77 if (err != NPERR_NO_ERROR) 78 if (err != NPERR_NO_ERROR)
(...skipping 27 matching lines...) Expand all
105 FakePluginWindowTracker::SharedInstance()->RemoveFakeWindowForDelegate( 106 FakePluginWindowTracker::SharedInstance()->RemoveFakeWindowForDelegate(
106 this, cg_context_.window); 107 this, cg_context_.window);
107 DestroyInstance(); 108 DestroyInstance();
108 } 109 }
109 110
110 void WebPluginDelegateImpl::PluginDestroyed() { 111 void WebPluginDelegateImpl::PluginDestroyed() {
111 delete this; 112 delete this;
112 } 113 }
113 114
114 bool WebPluginDelegateImpl::Initialize(const GURL& url, 115 bool WebPluginDelegateImpl::Initialize(const GURL& url,
115 char** argn, 116 const std::vector<std::string>& arg_names ,
116 char** argv, 117 const std::vector<std::string>& arg_value s,
117 int argc,
118 WebPlugin* plugin, 118 WebPlugin* plugin,
119 bool load_manually) { 119 bool load_manually) {
120 plugin_ = plugin; 120 plugin_ = plugin;
121 121
122 instance_->set_web_plugin(plugin); 122 instance_->set_web_plugin(plugin);
123 NPAPI::PluginInstance* old_instance = 123 NPAPI::PluginInstance* old_instance =
124 NPAPI::PluginInstance::SetInitializingInstance(instance_); 124 NPAPI::PluginInstance::SetInitializingInstance(instance_);
125 125
126 int argc = 0;
127 scoped_array<char*> argn(new char*[arg_names.size()]);
128 scoped_array<char*> argv(new char*[arg_names.size()]);
129 for (size_t i = 0; i < arg_names.size(); ++i) {
130 if (quirks_ & PLUGIN_QUIRK_NO_WINDOWLESS &&
131 LowerCaseEqualsASCII(arg_names[i], "windowlessvideo")) {
132 continue;
133 }
134 argn[argc] = const_cast<char*>(arg_names[i].c_str());
135 argv[argc] = const_cast<char*>(arg_values[i].c_str());
136 argc++;
137 }
126 138
127 bool start_result = instance_->Start(url, argn, argv, argc, load_manually); 139 bool start_result = instance_->Start(
140 url, argn.get(), argv.get(), argc, load_manually);
128 141
129 NPAPI::PluginInstance::SetInitializingInstance(old_instance); 142 NPAPI::PluginInstance::SetInitializingInstance(old_instance);
130 143
131 if (!start_result) 144 if (!start_result)
132 return false; 145 return false;
133 146
134 FakePluginWindowTracker* window_tracker = 147 FakePluginWindowTracker* window_tracker =
135 FakePluginWindowTracker::SharedInstance(); 148 FakePluginWindowTracker::SharedInstance();
136 cg_context_.window = window_tracker->GenerateFakeWindowForDelegate(this); 149 cg_context_.window = window_tracker->GenerateFakeWindowForDelegate(this);
137 cg_context_.context = NULL; 150 cg_context_.context = NULL;
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 np_event.modifiers |= btnState; 567 np_event.modifiers |= btnState;
555 np_event.where.h = last_mouse_x_; 568 np_event.where.h = last_mouse_x_;
556 np_event.where.v = last_mouse_y_; 569 np_event.where.v = last_mouse_y_;
557 instance()->NPP_HandleEvent(&np_event); 570 instance()->NPP_HandleEvent(&np_event);
558 571
559 MessageLoop::current()->PostDelayedTask(FROM_HERE, 572 MessageLoop::current()->PostDelayedTask(FROM_HERE,
560 null_event_factory_.NewRunnableMethod( 573 null_event_factory_.NewRunnableMethod(
561 &WebPluginDelegateImpl::OnNullEvent), 574 &WebPluginDelegateImpl::OnNullEvent),
562 kPluginIdleThrottleDelayMs); 575 kPluginIdleThrottleDelayMs);
563 } 576 }
OLDNEW
« no previous file with comments | « webkit/glue/plugins/webplugin_delegate_impl.cc ('k') | webkit/glue/plugins/webplugin_delegate_impl_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698