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

Side by Side Diff: chrome/browser/plugin_process_host_mac.cc

Issue 399090: Mac: Simulate the OS-level focus handling that windows and linux plugins... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <Carbon/Carbon.h> 5 #include <Carbon/Carbon.h>
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/mac_util.h" 12 #include "base/mac_util.h"
13 #include "chrome/browser/chrome_thread.h" 13 #include "chrome/browser/chrome_thread.h"
14 #include "chrome/browser/plugin_process_host.h" 14 #include "chrome/browser/plugin_process_host.h"
15 #include "chrome/common/plugin_messages.h"
16
15 17
16 void PluginProcessHost::OnPluginSelectWindow(uint32 window_id, 18 void PluginProcessHost::OnPluginSelectWindow(uint32 window_id,
17 gfx::Rect window_rect, 19 gfx::Rect window_rect,
18 bool modal) { 20 bool modal) {
19 plugin_visible_windows_set_.insert(window_id); 21 plugin_visible_windows_set_.insert(window_id);
20 if (modal) 22 if (modal)
21 plugin_modal_windows_set_.insert(window_id); 23 plugin_modal_windows_set_.insert(window_id);
22 } 24 }
23 25
24 void PluginProcessHost::OnPluginShowWindow(uint32 window_id, 26 void PluginProcessHost::OnPluginShowWindow(uint32 window_id,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); 70 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
69 71
70 // If our plugin process has any modal windows up, we need to bring it forward 72 // If our plugin process has any modal windows up, we need to bring it forward
71 // so that they act more like an in-process modal window would. 73 // so that they act more like an in-process modal window would.
72 if (!plugin_modal_windows_set_.empty()) { 74 if (!plugin_modal_windows_set_.empty()) {
73 ChromeThread::PostTask( 75 ChromeThread::PostTask(
74 ChromeThread::UI, FROM_HERE, 76 ChromeThread::UI, FROM_HERE,
75 NewRunnableFunction(mac_util::ActivateProcess, handle())); 77 NewRunnableFunction(mac_util::ActivateProcess, handle()));
76 } 78 }
77 } 79 }
80
81 void PluginProcessHost::OnPluginReceivedFocus(int process_id, int instance_id) {
82 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
83 // A plugin has received keyboard focus, so tell all other plugin processes
84 // that they no longer have it (simulating the OS-level focus notifications
85 // that Gtk and Windows provide).
86 for (ChildProcessHost::Iterator iter(ChildProcessInfo::PLUGIN_PROCESS);
87 !iter.Done(); ++iter) {
88 PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter);
89 int instance = (plugin->handle() == process_id) ? instance_id : 0;
90 plugin->Send(new PluginProcessMsg_PluginFocusNotify(instance));
91 }
92 }
OLDNEW
« no previous file with comments | « chrome/browser/plugin_process_host.cc ('k') | chrome/browser/renderer_host/render_widget_host_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698