OLD | NEW |
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 "chrome/plugin/webplugin_delegate_stub.h" | 5 #include "chrome/plugin/webplugin_delegate_stub.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 char **argv = new char*[argc]; | 121 char **argv = new char*[argc]; |
122 for (int i = 0; i < argc; ++i) { | 122 for (int i = 0; i < argc; ++i) { |
123 argn[i] = const_cast<char*>(params.arg_names[i].c_str()); | 123 argn[i] = const_cast<char*>(params.arg_names[i].c_str()); |
124 argv[i] = const_cast<char*>(params.arg_values[i].c_str()); | 124 argv[i] = const_cast<char*>(params.arg_values[i].c_str()); |
125 } | 125 } |
126 | 126 |
127 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 127 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
128 FilePath path = FilePath::FromWStringHack( | 128 FilePath path = FilePath::FromWStringHack( |
129 command_line.GetSwitchValue(switches::kPluginPath)); | 129 command_line.GetSwitchValue(switches::kPluginPath)); |
130 | 130 |
| 131 |
| 132 gfx::PluginWindowHandle parent = NULL; |
131 #if defined(OS_WIN) | 133 #if defined(OS_WIN) |
132 delegate_ = WebPluginDelegate::Create( | 134 parent = gfx::NativeViewFromId(params.containing_window); |
133 path, mime_type_, gfx::NativeViewFromId(params.containing_window)); | 135 #elif defined(OS_LINUX) |
134 #else | 136 PluginThread::current()->Send(new PluginProcessHostMsg_MapNativeViewId( |
135 NOTIMPLEMENTED() << " need to figure out nativeview id business"; | 137 params.containing_window, &parent)); |
136 delegate_ = WebPluginDelegate::Create( | |
137 path, mime_type_, NULL); | |
138 #endif | 138 #endif |
| 139 delegate_ = WebPluginDelegate::Create(path, mime_type_, parent); |
139 | 140 |
140 if (delegate_) { | 141 if (delegate_) { |
141 webplugin_ = new WebPluginProxy(channel_, instance_id_, delegate_); | 142 webplugin_ = new WebPluginProxy(channel_, instance_id_, delegate_); |
142 #if defined(OS_WIN) | 143 #if defined(OS_WIN) |
143 if (!webplugin_->SetModalDialogEvent(params.modal_dialog_event)) | 144 if (!webplugin_->SetModalDialogEvent(params.modal_dialog_event)) |
144 return; | 145 return; |
145 #endif | 146 #endif |
146 *result = delegate_->Initialize( | 147 *result = delegate_->Initialize( |
147 params.url, argn, argv, argc, webplugin_, params.load_manually); | 148 params.url, argn, argv, argc, webplugin_, params.load_manually); |
148 } | 149 } |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 params.notify_data, | 358 params.notify_data, |
358 params.stream); | 359 params.stream); |
359 webplugin_->OnResourceCreated(params.resource_id, resource_client); | 360 webplugin_->OnResourceCreated(params.resource_id, resource_client); |
360 } | 361 } |
361 | 362 |
362 void WebPluginDelegateStub::OnURLRequestRouted(const std::string& url, | 363 void WebPluginDelegateStub::OnURLRequestRouted(const std::string& url, |
363 bool notify_needed, | 364 bool notify_needed, |
364 intptr_t notify_data) { | 365 intptr_t notify_data) { |
365 delegate_->URLRequestRouted(url, notify_needed, notify_data); | 366 delegate_->URLRequestRouted(url, notify_needed, notify_data); |
366 } | 367 } |
OLD | NEW |