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/browser/plugin_process_host.h" | 5 #include "chrome/browser/plugin_process_host.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/debug_util.h" | 11 #include "base/debug_util.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
16 #include "base/thread.h" | 16 #include "base/thread.h" |
17 #include "base/win_util.h" | |
18 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/chrome_plugin_browsing_context.h" | 18 #include "chrome/browser/chrome_plugin_browsing_context.h" |
20 #include "chrome/browser/chrome_thread.h" | 19 #include "chrome/browser/chrome_thread.h" |
21 #include "chrome/browser/plugin_process_info.h" | 20 #include "chrome/browser/plugin_process_info.h" |
22 #include "chrome/browser/plugin_service.h" | 21 #include "chrome/browser/plugin_service.h" |
23 #include "chrome/browser/profile.h" | 22 #include "chrome/browser/profile.h" |
24 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 23 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
25 #include "chrome/browser/renderer_host/render_process_host.h" | 24 #include "chrome/browser/renderer_host/render_process_host.h" |
26 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 25 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
27 #include "chrome/browser/sandbox_policy.h" | 26 #include "chrome/browser/sandbox_policy.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 wcex.lpszClassName = kWrapperNativeWindowClassName; | 344 wcex.lpszClassName = kWrapperNativeWindowClassName; |
346 wcex.hIconSm = 0; | 345 wcex.hIconSm = 0; |
347 window_class = RegisterClassEx(&wcex); | 346 window_class = RegisterClassEx(&wcex); |
348 } | 347 } |
349 | 348 |
350 HWND window = CreateWindowEx( | 349 HWND window = CreateWindowEx( |
351 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, | 350 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, |
352 MAKEINTATOM(window_class), 0, | 351 MAKEINTATOM(window_class), 0, |
353 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, | 352 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, |
354 0, 0, 0, 0, parent_, 0, GetModuleHandle(NULL), 0); | 353 0, 0, 0, 0, parent_, 0, GetModuleHandle(NULL), 0); |
355 TRACK_HWND_CREATION(window); | |
356 | 354 |
357 PluginProcessHostMsg_CreateWindow::WriteReplyParams( | 355 PluginProcessHostMsg_CreateWindow::WriteReplyParams( |
358 reply_msg_, window); | 356 reply_msg_, window); |
359 | 357 |
360 g_browser_process->io_thread()->message_loop()->PostTask( | 358 g_browser_process->io_thread()->message_loop()->PostTask( |
361 FROM_HERE, new SendReplyTask(plugin_path_, reply_msg_)); | 359 FROM_HERE, new SendReplyTask(plugin_path_, reply_msg_)); |
362 } | 360 } |
363 | 361 |
364 private: | 362 private: |
365 FilePath plugin_path_; | 363 FilePath plugin_path_; |
366 HWND parent_; | 364 HWND parent_; |
367 IPC::Message* reply_msg_; | 365 IPC::Message* reply_msg_; |
368 }; | 366 }; |
369 | 367 |
370 // Destroys the given window on the UI thread. | 368 // Destroys the given window on the UI thread. |
371 class DestroyWindowTask : public Task { | 369 class DestroyWindowTask : public Task { |
372 public: | 370 public: |
373 DestroyWindowTask(HWND window) : window_(window) { } | 371 DestroyWindowTask(HWND window) : window_(window) { } |
374 | 372 |
375 virtual void Run() { | 373 virtual void Run() { |
376 DestroyWindow(window_); | 374 DestroyWindow(window_); |
377 TRACK_HWND_DESTRUCTION(window_); | |
378 } | 375 } |
379 | 376 |
380 private: | 377 private: |
381 HWND window_; | 378 HWND window_; |
382 }; | 379 }; |
383 | 380 |
384 | 381 |
385 PluginProcessHost::PluginProcessHost(PluginService* plugin_service) | 382 PluginProcessHost::PluginProcessHost(PluginService* plugin_service) |
386 : process_(NULL), | 383 : process_(NULL), |
387 opening_channel_(false), | 384 opening_channel_(false), |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 void PluginProcessHost::OnDestroyWindow(HWND window) { | 888 void PluginProcessHost::OnDestroyWindow(HWND window) { |
892 plugin_service_->main_message_loop()->PostTask(FROM_HERE, | 889 plugin_service_->main_message_loop()->PostTask(FROM_HERE, |
893 new DestroyWindowTask(window)); | 890 new DestroyWindowTask(window)); |
894 } | 891 } |
895 | 892 |
896 void PluginProcessHost::Shutdown() { | 893 void PluginProcessHost::Shutdown() { |
897 | 894 |
898 Send(new PluginProcessMsg_BrowserShutdown); | 895 Send(new PluginProcessMsg_BrowserShutdown); |
899 } | 896 } |
900 | 897 |
OLD | NEW |