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

Side by Side Diff: webkit/glue/plugins/carbon_plugin_window_tracker_mac.cc

Issue 6012002: Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi and put... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/logging.h"
6 #include "webkit/glue/plugins/carbon_plugin_window_tracker_mac.h"
7
8 CarbonPluginWindowTracker::CarbonPluginWindowTracker() {
9 }
10
11 CarbonPluginWindowTracker* CarbonPluginWindowTracker::SharedInstance() {
12 static CarbonPluginWindowTracker* tracker = new CarbonPluginWindowTracker();
13 return tracker;
14 }
15
16 WindowRef CarbonPluginWindowTracker::CreateDummyWindowForDelegate(
17 OpaquePluginRef delegate) {
18 // The real size will be set by the plugin instance, once that size is known.
19 Rect window_bounds = { 0, 0, 100, 100 };
20 WindowRef new_ref = NULL;
21 if (CreateNewWindow(kDocumentWindowClass,
22 kWindowNoTitleBarAttribute,
23 &window_bounds,
24 &new_ref) == noErr) {
25 window_to_delegate_map_[new_ref] = delegate;
26 delegate_to_window_map_[delegate] = new_ref;
27 }
28 return new_ref;
29 }
30
31 OpaquePluginRef CarbonPluginWindowTracker::GetDelegateForDummyWindow(
32 WindowRef window) const {
33 WindowToDelegateMap::const_iterator i = window_to_delegate_map_.find(window);
34 if (i != window_to_delegate_map_.end())
35 return i->second;
36 return NULL;
37 }
38
39 WindowRef CarbonPluginWindowTracker::GetDummyWindowForDelegate(
40 OpaquePluginRef delegate) const {
41 DelegateToWindowMap::const_iterator i =
42 delegate_to_window_map_.find(delegate);
43 if (i != delegate_to_window_map_.end())
44 return i->second;
45 return NULL;
46 }
47
48 void CarbonPluginWindowTracker::DestroyDummyWindowForDelegate(
49 OpaquePluginRef delegate, WindowRef window) {
50 DCHECK(GetDelegateForDummyWindow(window) == delegate);
51 window_to_delegate_map_.erase(window);
52 delegate_to_window_map_.erase(delegate);
53 if (window) // Check just in case the initial window creation failed.
54 DisposeWindow(window);
55 }
OLDNEW
« no previous file with comments | « webkit/glue/plugins/carbon_plugin_window_tracker_mac.h ('k') | webkit/glue/plugins/coregraphics_private_symbols_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698