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

Side by Side Diff: chrome/browser/browser_accessibility_manager.h

Issue 46013: Removes all use of COM and dependencies on Windows-specific classes (includin... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months 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) 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 #ifndef CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_H_ 5 #ifndef CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_H_
6 #define CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_H_ 6 #define CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_H_
7 7
8 #include <oaidl.h> // Needed for VARIANT structure. 8 #include <oaidl.h> // Needed for VARIANT structure.
9 #include <hash_map> 9 #include <hash_map>
10 10
11 #include "base/singleton.h" 11 #include "base/singleton.h"
12 #include "chrome/common/accessibility.h"
13 #include "chrome/common/notification_observer.h" 12 #include "chrome/common/notification_observer.h"
13 #include "webkit/glue/webaccessibility.h"
14 14
15 class BrowserAccessibility; 15 class BrowserAccessibility;
16 class RenderProcessHost; 16 class RenderProcessHost;
17 class RenderWidgetHost; 17 class RenderWidgetHost;
18 18
19 //////////////////////////////////////////////////////////////////////////////// 19 ////////////////////////////////////////////////////////////////////////////////
20 // 20 //
21 // BrowserAccessibilityManager 21 // BrowserAccessibilityManager
22 // 22 //
23 // Used to manage instance creation and memory handling for browser side 23 // Used to manage instance creation and memory handling for browser side
24 // accessibility. A singleton class. It implements NotificationObserver to 24 // accessibility. A singleton class. It implements NotificationObserver to
25 // ensure that a termination of a renderer process gets propagated to the 25 // ensure that a termination of a renderer process gets propagated to the
26 // active BrowserAccessibility instances calling into it. Each such instance 26 // active BrowserAccessibility instances calling into it. Each such instance
27 // will upon such an event be set to an inactive state, failing calls from the 27 // will upon such an event be set to an inactive state, failing calls from the
28 // assistive technology gracefully. 28 // assistive technology gracefully.
29 //////////////////////////////////////////////////////////////////////////////// 29 ////////////////////////////////////////////////////////////////////////////////
30 class BrowserAccessibilityManager : public NotificationObserver { 30 class BrowserAccessibilityManager : public NotificationObserver {
31 public: 31 public:
32 // Gets the singleton BrowserAccessibilityManager object. The first time this 32 // Gets the singleton BrowserAccessibilityManager object. The first time this
33 // method is called, a CacheManagerHost object is constructed and returned. 33 // method is called, a CacheManagerHost object is constructed and returned.
34 // Subsequent calls will return the same object. 34 // Subsequent calls will return the same object.
35 static BrowserAccessibilityManager* GetInstance(); 35 static BrowserAccessibilityManager* GetInstance();
36 36
37 // Creates an instance of BrowserAccessibility, initializes it and sets the 37 // Creates an instance of BrowserAccessibility, initializes it and sets the
38 // iaccessible_id and parent_id. 38 // [acc_obj_id], which is used for IPC communication, and [instance_id],
39 // which is used to identify the mapping between accessibility instance and
40 // RenderProcess.
39 STDMETHODIMP CreateAccessibilityInstance(REFIID iid, 41 STDMETHODIMP CreateAccessibilityInstance(REFIID iid,
40 int iaccessible_id, 42 int acc_obj_id,
41 int instance_id, 43 int instance_id,
42 void** interface_ptr); 44 void** interface_ptr);
43 45
44 // Composes and sends a message for requesting needed accessibility 46 // Composes and sends a message for requesting needed accessibility
45 // information. Unused LONG input parameters should be NULL, and the VARIANT 47 // information. Unused LONG input parameters should be NULL, and the VARIANT
46 // an empty, valid instance. 48 // [var_id] an empty, valid instance.
47 bool RequestAccessibilityInfo(int iaccessible_id, 49 bool RequestAccessibilityInfo(int acc_obj_id,
48 int instance_id, 50 int instance_id,
49 int iaccessible_func_id, 51 int acc_func_id,
50 VARIANT var_id, 52 int child_id,
51 LONG input1, 53 long input1,
52 LONG input2); 54 long input2);
53 55
54 // Wrapper function, for cleaner code. 56 // Wrapper function, for cleaner code.
55 const AccessibilityOutParams& response(); 57 const webkit_glue::WebAccessibility::OutParams& response();
56 58
57 // Retrieves the parent HWND connected to the provided id. 59 // Retrieves the parent HWND connected to the provided id.
58 HWND parent_hwnd(int id); 60 HWND parent_hwnd(int id);
59 61
60 // Mutator, needed since constructor does not take any arguments, and to keep 62 // Mutator, needed since constructor does not take any arguments, and to keep
61 // instance accessor clean. 63 // instance accessor clean.
62 int SetMembers(BrowserAccessibility* browser_acc, 64 int SetMembers(BrowserAccessibility* browser_acc,
63 HWND parent_hwnd, 65 HWND parent_hwnd,
64 RenderWidgetHost* render_widget_host); 66 RenderWidgetHost* render_widget_host);
65 67
66 // NotificationObserver implementation. 68 // NotificationObserver implementation.
67 virtual void Observe(NotificationType type, 69 virtual void Observe(NotificationType type,
68 const NotificationSource& source, 70 const NotificationSource& source,
69 const NotificationDetails& details); 71 const NotificationDetails& details);
70 72
71 protected: 73 protected:
72 // This class is a singleton. Do not instantiate directly. 74 // This class is a singleton. Do not instantiate directly.
73 BrowserAccessibilityManager(); 75 BrowserAccessibilityManager();
74 friend struct DefaultSingletonTraits<BrowserAccessibilityManager>; 76 friend struct DefaultSingletonTraits<BrowserAccessibilityManager>;
(...skipping 19 matching lines...) Expand all
94 // Caching of the unique member variables used to handle browser accessibility 96 // Caching of the unique member variables used to handle browser accessibility
95 // requests from multiple processes. 97 // requests from multiple processes.
96 InstanceMap instance_map_; 98 InstanceMap instance_map_;
97 int instance_id_; 99 int instance_id_;
98 100
99 // Reverse mapping to track which RenderProcessHosts are active. If a 101 // Reverse mapping to track which RenderProcessHosts are active. If a
100 // RenderProcessHost is found to be terminated, it should be removed from this 102 // RenderProcessHost is found to be terminated, it should be removed from this
101 // mapping, and the connected BrowserAccessibility ids/instances invalidated. 103 // mapping, and the connected BrowserAccessibility ids/instances invalidated.
102 RenderProcessHostMap render_process_host_map_; 104 RenderProcessHostMap render_process_host_map_;
103 105
104 AccessibilityOutParams out_params_; 106 webkit_glue::WebAccessibility::OutParams out_params_;
105 107
106 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); 108 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager);
107 }; 109 };
108 #endif // CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_H_ 110 #endif // CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698