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