| 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/plugin/plugin_channel.h" | 5 #include "chrome/plugin/plugin_channel.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lock.h" | 8 #include "base/lock.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/waitable_event.h" | 11 #include "base/waitable_event.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "chrome/common/child_process.h" | 13 #include "chrome/common/child_process.h" |
| 14 #include "chrome/common/plugin_messages.h" | 14 #include "chrome/common/plugin_messages.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/plugin/plugin_thread.h" | 16 #include "chrome/plugin/plugin_thread.h" |
| 17 #include "chrome/plugin/webplugin_delegate_stub.h" | 17 #include "chrome/plugin/webplugin_delegate_stub.h" |
| 18 #include "chrome/plugin/webplugin_proxy.h" | 18 #include "chrome/plugin/webplugin_proxy.h" |
| 19 #include "webkit/plugins/npapi/plugin_instance.h" | 19 #include "webkit/glue/plugins/plugin_instance.h" |
| 20 | 20 |
| 21 #if defined(OS_POSIX) | 21 #if defined(OS_POSIX) |
| 22 #include "base/eintr_wrapper.h" | 22 #include "base/eintr_wrapper.h" |
| 23 #include "ipc/ipc_channel_posix.h" | 23 #include "ipc/ipc_channel_posix.h" |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 class PluginReleaseTask : public Task { | 26 class PluginReleaseTask : public Task { |
| 27 public: | 27 public: |
| 28 void Run() { | 28 void Run() { |
| 29 ChildProcess::current()->ReleaseProcess(); | 29 ChildProcess::current()->ReleaseProcess(); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 static int last_id = 0; | 249 static int last_id = 0; |
| 250 return ++last_id; | 250 return ++last_id; |
| 251 } | 251 } |
| 252 | 252 |
| 253 void PluginChannel::OnClearSiteData(uint64 flags, | 253 void PluginChannel::OnClearSiteData(uint64 flags, |
| 254 const std::string& domain, | 254 const std::string& domain, |
| 255 base::Time begin_time) { | 255 base::Time begin_time) { |
| 256 bool success = false; | 256 bool success = false; |
| 257 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 257 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 258 FilePath path = command_line->GetSwitchValuePath(switches::kPluginPath); | 258 FilePath path = command_line->GetSwitchValuePath(switches::kPluginPath); |
| 259 scoped_refptr<webkit::npapi::PluginLib> plugin_lib( | 259 scoped_refptr<NPAPI::PluginLib> plugin_lib( |
| 260 webkit::npapi::PluginLib::CreatePluginLib(path)); | 260 NPAPI::PluginLib::CreatePluginLib(path)); |
| 261 if (plugin_lib.get()) { | 261 if (plugin_lib.get()) { |
| 262 NPError err = plugin_lib->NP_Initialize(); | 262 NPError err = plugin_lib->NP_Initialize(); |
| 263 if (err == NPERR_NO_ERROR) { | 263 if (err == NPERR_NO_ERROR) { |
| 264 scoped_refptr<webkit::npapi::PluginInstance> instance( | 264 scoped_refptr<NPAPI::PluginInstance> instance( |
| 265 plugin_lib->CreateInstance(std::string())); | 265 plugin_lib->CreateInstance(std::string())); |
| 266 | 266 |
| 267 const char* domain_str = domain.empty() ? NULL : domain.c_str(); | 267 const char* domain_str = domain.empty() ? NULL : domain.c_str(); |
| 268 uint64 max_age; | 268 uint64 max_age; |
| 269 if (begin_time > base::Time()) { | 269 if (begin_time > base::Time()) { |
| 270 base::TimeDelta delta = base::Time::Now() - begin_time; | 270 base::TimeDelta delta = base::Time::Now() - begin_time; |
| 271 max_age = delta.InSeconds(); | 271 max_age = delta.InSeconds(); |
| 272 } else { | 272 } else { |
| 273 max_age = kuint64max; | 273 max_age = kuint64max; |
| 274 } | 274 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 } | 317 } |
| 318 | 318 |
| 319 bool PluginChannel::Init(MessageLoop* ipc_message_loop, bool create_pipe_now) { | 319 bool PluginChannel::Init(MessageLoop* ipc_message_loop, bool create_pipe_now) { |
| 320 if (!PluginChannelBase::Init(ipc_message_loop, create_pipe_now)) | 320 if (!PluginChannelBase::Init(ipc_message_loop, create_pipe_now)) |
| 321 return false; | 321 return false; |
| 322 | 322 |
| 323 channel_->AddFilter(filter_.get()); | 323 channel_->AddFilter(filter_.get()); |
| 324 return true; | 324 return true; |
| 325 } | 325 } |
| 326 | 326 |
| OLD | NEW |