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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.h

Issue 10804031: Move more files into the content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 #include <list> 9 #include <list>
10 10
11 #include "base/memory/scoped_nsobject.h" 11 #include "base/memory/scoped_nsobject.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "content/browser/accessibility/browser_accessibility_delegate_mac.h" 15 #include "content/browser/accessibility/browser_accessibility_delegate_mac.h"
16 #include "content/browser/renderer_host/accelerated_surface_container_manager_ma c.h" 16 #include "content/browser/renderer_host/accelerated_surface_container_manager_ma c.h"
17 #include "content/browser/renderer_host/render_widget_host_view_base.h" 17 #include "content/browser/renderer_host/render_widget_host_view_base.h"
18 #include "content/common/edit_command.h" 18 #include "content/common/edit_command.h"
19 #import "content/public/browser/render_widget_host_view_mac_base.h" 19 #import "content/public/browser/render_widget_host_view_mac_base.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h"
21 #include "ui/base/cocoa/base_view.h" 21 #include "ui/base/cocoa/base_view.h"
22 #include "webkit/glue/webcursor.h" 22 #include "webkit/glue/webcursor.h"
23 23
24 namespace content {
25 class CompositingIOSurfaceMac;
26 class RenderWidgetHostViewMac;
27 class RenderWidgetHostViewMacEditCommandHelper;
28 }
29
24 @class AcceleratedPluginView; 30 @class AcceleratedPluginView;
25 class CompositingIOSurfaceMac;
26 @class FullscreenWindowManager; 31 @class FullscreenWindowManager;
27 class RenderWidgetHostViewMac;
28 @protocol RenderWidgetHostViewMacDelegate; 32 @protocol RenderWidgetHostViewMacDelegate;
29 class RenderWidgetHostViewMacEditCommandHelper;
30 @class ToolTip; 33 @class ToolTip;
31 34
32 namespace content {
33 class RenderWidgetHostImpl;
34 }
35
36 @protocol RenderWidgetHostViewMacOwner 35 @protocol RenderWidgetHostViewMacOwner
37 - (RenderWidgetHostViewMac*)renderWidgetHostViewMac; 36 - (content::RenderWidgetHostViewMac*)renderWidgetHostViewMac;
38 @end 37 @end
39 38
40 // This is the view that lives in the Cocoa view hierarchy. In Windows-land, 39 // This is the view that lives in the Cocoa view hierarchy. In Windows-land,
41 // RenderWidgetHostViewWin is both the view and the delegate. We split the roles 40 // RenderWidgetHostViewWin is both the view and the delegate. We split the roles
42 // but that means that the view needs to own the delegate and will dispose of it 41 // but that means that the view needs to own the delegate and will dispose of it
43 // when it's removed from the view system. 42 // when it's removed from the view system.
44 @interface RenderWidgetHostViewCocoa 43 @interface RenderWidgetHostViewCocoa
45 : BaseView <RenderWidgetHostViewMacBase, 44 : BaseView <RenderWidgetHostViewMacBase,
46 RenderWidgetHostViewMacOwner, 45 RenderWidgetHostViewMacOwner,
47 NSTextInputClient, 46 NSTextInputClient,
48 BrowserAccessibilityDelegateCocoa> { 47 BrowserAccessibilityDelegateCocoa> {
49 @private 48 @private
50 scoped_ptr<RenderWidgetHostViewMac> renderWidgetHostView_; 49 scoped_ptr<content::RenderWidgetHostViewMac> renderWidgetHostView_;
51 NSObject<RenderWidgetHostViewMacDelegate>* delegate_; // weak 50 NSObject<RenderWidgetHostViewMacDelegate>* delegate_; // weak
52 BOOL canBeKeyView_; 51 BOOL canBeKeyView_;
53 BOOL takesFocusOnlyOnMouseDown_; 52 BOOL takesFocusOnlyOnMouseDown_;
54 BOOL closeOnDeactivate_; 53 BOOL closeOnDeactivate_;
55 scoped_ptr<RenderWidgetHostViewMacEditCommandHelper> editCommand_helper_; 54 scoped_ptr<content::RenderWidgetHostViewMacEditCommandHelper>
55 editCommand_helper_;
56 56
57 // These are part of the magic tooltip code from WebKit's WebHTMLView: 57 // These are part of the magic tooltip code from WebKit's WebHTMLView:
58 id trackingRectOwner_; // (not retained) 58 id trackingRectOwner_; // (not retained)
59 void *trackingRectUserData_; 59 void *trackingRectUserData_;
60 NSTrackingRectTag lastToolTipTag_; 60 NSTrackingRectTag lastToolTipTag_;
61 scoped_nsobject<NSString> toolTip_; 61 scoped_nsobject<NSString> toolTip_;
62 62
63 // Is YES if there was a mouse-down as yet unbalanced with a mouse-up. 63 // Is YES if there was a mouse-down as yet unbalanced with a mouse-up.
64 BOOL hasOpenMouseDown_; 64 BOOL hasOpenMouseDown_;
65 65
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // Enables or disables plugin IME. 152 // Enables or disables plugin IME.
153 - (void)setPluginImeActive:(BOOL)active; 153 - (void)setPluginImeActive:(BOOL)active;
154 // Updates the current plugin focus state. 154 // Updates the current plugin focus state.
155 - (void)pluginFocusChanged:(BOOL)focused forPlugin:(int)pluginId; 155 - (void)pluginFocusChanged:(BOOL)focused forPlugin:(int)pluginId;
156 // Evaluates the event in the context of plugin IME, if plugin IME is enabled. 156 // Evaluates the event in the context of plugin IME, if plugin IME is enabled.
157 // Returns YES if the event was handled. 157 // Returns YES if the event was handled.
158 - (BOOL)postProcessEventForPluginIme:(NSEvent*)event; 158 - (BOOL)postProcessEventForPluginIme:(NSEvent*)event;
159 - (void)updateCursor:(NSCursor*)cursor; 159 - (void)updateCursor:(NSCursor*)cursor;
160 @end 160 @end
161 161
162 namespace content {
163 class RenderWidgetHostImpl;
164
162 /////////////////////////////////////////////////////////////////////////////// 165 ///////////////////////////////////////////////////////////////////////////////
163 // RenderWidgetHostViewMac 166 // RenderWidgetHostViewMac
164 // 167 //
165 // An object representing the "View" of a rendered web page. This object is 168 // An object representing the "View" of a rendered web page. This object is
166 // responsible for displaying the content of the web page, and integrating with 169 // responsible for displaying the content of the web page, and integrating with
167 // the Cocoa view system. It is the implementation of the RenderWidgetHostView 170 // the Cocoa view system. It is the implementation of the RenderWidgetHostView
168 // that the cross-platform RenderWidgetHost object uses 171 // that the cross-platform RenderWidgetHost object uses
169 // to display the data. 172 // to display the data.
170 // 173 //
171 // Comment excerpted from render_widget_host.h: 174 // Comment excerpted from render_widget_host.h:
172 // 175 //
173 // "The lifetime of the RenderWidgetHost* is tied to the render process. 176 // "The lifetime of the RenderWidgetHost* is tied to the render process.
174 // If the render process dies, the RenderWidgetHost* goes away and all 177 // If the render process dies, the RenderWidgetHost* goes away and all
175 // references to it must become NULL." 178 // references to it must become NULL."
176 // 179 //
177 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. 180 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
178 class RenderWidgetHostViewMac : public content::RenderWidgetHostViewBase { 181 class RenderWidgetHostViewMac : public RenderWidgetHostViewBase {
179 public: 182 public:
180 virtual ~RenderWidgetHostViewMac(); 183 virtual ~RenderWidgetHostViewMac();
181 184
182 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; } 185 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; }
183 186
184 void SetDelegate(NSObject<RenderWidgetHostViewMacDelegate>* delegate); 187 void SetDelegate(NSObject<RenderWidgetHostViewMacDelegate>* delegate);
185 188
186 // RenderWidgetHostView implementation. 189 // RenderWidgetHostView implementation.
187 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; 190 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE;
188 virtual content::RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; 191 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE;
189 virtual void SetSize(const gfx::Size& size) OVERRIDE; 192 virtual void SetSize(const gfx::Size& size) OVERRIDE;
190 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; 193 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE;
191 virtual gfx::NativeView GetNativeView() const OVERRIDE; 194 virtual gfx::NativeView GetNativeView() const OVERRIDE;
192 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; 195 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
193 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; 196 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE;
194 virtual bool HasFocus() const OVERRIDE; 197 virtual bool HasFocus() const OVERRIDE;
195 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE; 198 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE;
196 virtual void Show() OVERRIDE; 199 virtual void Show() OVERRIDE;
197 virtual void Hide() OVERRIDE; 200 virtual void Hide() OVERRIDE;
198 virtual bool IsShowing() OVERRIDE; 201 virtual bool IsShowing() OVERRIDE;
199 virtual gfx::Rect GetViewBounds() const OVERRIDE; 202 virtual gfx::Rect GetViewBounds() const OVERRIDE;
200 virtual void SetShowingContextMenu(bool showing) OVERRIDE; 203 virtual void SetShowingContextMenu(bool showing) OVERRIDE;
201 virtual void SetActive(bool active) OVERRIDE; 204 virtual void SetActive(bool active) OVERRIDE;
202 virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE; 205 virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE;
203 virtual void SetWindowVisibility(bool visible) OVERRIDE; 206 virtual void SetWindowVisibility(bool visible) OVERRIDE;
204 virtual void WindowFrameChanged() OVERRIDE; 207 virtual void WindowFrameChanged() OVERRIDE;
205 virtual void SetBackground(const SkBitmap& background) OVERRIDE; 208 virtual void SetBackground(const SkBitmap& background) OVERRIDE;
206 209
207 // Implementation of RenderWidgetHostViewPort. 210 // Implementation of RenderWidgetHostViewPort.
208 virtual void InitAsPopup(content::RenderWidgetHostView* parent_host_view, 211 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
209 const gfx::Rect& pos) OVERRIDE; 212 const gfx::Rect& pos) OVERRIDE;
210 virtual void InitAsFullscreen( 213 virtual void InitAsFullscreen(
211 content::RenderWidgetHostView* reference_host_view) OVERRIDE; 214 RenderWidgetHostView* reference_host_view) OVERRIDE;
212 virtual void WasRestored() OVERRIDE; 215 virtual void WasRestored() OVERRIDE;
213 virtual void WasHidden() OVERRIDE; 216 virtual void WasHidden() OVERRIDE;
214 virtual void MovePluginWindows( 217 virtual void MovePluginWindows(
215 const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE; 218 const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE;
216 virtual void Focus() OVERRIDE; 219 virtual void Focus() OVERRIDE;
217 virtual void Blur() OVERRIDE; 220 virtual void Blur() OVERRIDE;
218 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; 221 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE;
219 virtual void SetIsLoading(bool is_loading) OVERRIDE; 222 virtual void SetIsLoading(bool is_loading) OVERRIDE;
220 virtual void TextInputStateChanged(ui::TextInputType state, 223 virtual void TextInputStateChanged(ui::TextInputType state,
221 bool can_compose_inline) OVERRIDE; 224 bool can_compose_inline) OVERRIDE;
(...skipping 20 matching lines...) Expand all
242 skia::PlatformCanvas* output) OVERRIDE; 245 skia::PlatformCanvas* output) OVERRIDE;
243 virtual void OnAcceleratedCompositingStateChange() OVERRIDE; 246 virtual void OnAcceleratedCompositingStateChange() OVERRIDE;
244 247
245 virtual void OnAccessibilityNotifications( 248 virtual void OnAccessibilityNotifications(
246 const std::vector<AccessibilityHostMsg_NotificationParams>& params 249 const std::vector<AccessibilityHostMsg_NotificationParams>& params
247 ) OVERRIDE; 250 ) OVERRIDE;
248 251
249 virtual void PluginFocusChanged(bool focused, int plugin_id) OVERRIDE; 252 virtual void PluginFocusChanged(bool focused, int plugin_id) OVERRIDE;
250 virtual void StartPluginIme() OVERRIDE; 253 virtual void StartPluginIme() OVERRIDE;
251 virtual bool PostProcessEventForPluginIme( 254 virtual bool PostProcessEventForPluginIme(
252 const content::NativeWebKeyboardEvent& event) OVERRIDE; 255 const NativeWebKeyboardEvent& event) OVERRIDE;
253 256
254 // Methods associated with GPU-accelerated plug-in instances and the 257 // Methods associated with GPU-accelerated plug-in instances and the
255 // accelerated compositor. 258 // accelerated compositor.
256 virtual gfx::PluginWindowHandle AllocateFakePluginWindowHandle( 259 virtual gfx::PluginWindowHandle AllocateFakePluginWindowHandle(
257 bool opaque, bool root) OVERRIDE; 260 bool opaque, bool root) OVERRIDE;
258 virtual void DestroyFakePluginWindowHandle( 261 virtual void DestroyFakePluginWindowHandle(
259 gfx::PluginWindowHandle window) OVERRIDE; 262 gfx::PluginWindowHandle window) OVERRIDE;
260 263
261 // Exposed for testing. 264 // Exposed for testing.
262 CONTENT_EXPORT AcceleratedPluginView* ViewForPluginWindowHandle( 265 CONTENT_EXPORT AcceleratedPluginView* ViewForPluginWindowHandle(
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 bool CompositorSwapBuffers(uint64 surface_handle); 331 bool CompositorSwapBuffers(uint64 surface_handle);
329 // Ack pending SwapBuffers requests, if any, to unblock the GPU process. Has 332 // Ack pending SwapBuffers requests, if any, to unblock the GPU process. Has
330 // no effect if there are no pending requests. 333 // no effect if there are no pending requests.
331 void AckPendingSwapBuffers(); 334 void AckPendingSwapBuffers();
332 335
333 // These member variables should be private, but the associated ObjC class 336 // These member variables should be private, but the associated ObjC class
334 // needs access to them and can't be made a friend. 337 // needs access to them and can't be made a friend.
335 338
336 // The associated Model. Can be NULL if Destroy() is called when 339 // The associated Model. Can be NULL if Destroy() is called when
337 // someone (other than superview) has retained |cocoa_view_|. 340 // someone (other than superview) has retained |cocoa_view_|.
338 content::RenderWidgetHostImpl* render_widget_host_; 341 RenderWidgetHostImpl* render_widget_host_;
339 342
340 // This is true when we are currently painting and thus should handle extra 343 // This is true when we are currently painting and thus should handle extra
341 // paint requests by expanding the invalid rect rather than actually painting. 344 // paint requests by expanding the invalid rect rather than actually painting.
342 bool about_to_validate_and_paint_; 345 bool about_to_validate_and_paint_;
343 346
344 // This is true when we have already scheduled a call to 347 // This is true when we have already scheduled a call to
345 // |-callSetNeedsDisplayInRect:| but it has not been fulfilled yet. Used to 348 // |-callSetNeedsDisplayInRect:| but it has not been fulfilled yet. Used to
346 // prevent us from scheduling multiple calls. 349 // prevent us from scheduling multiple calls.
347 bool call_set_needs_display_in_rect_pending_; 350 bool call_set_needs_display_in_rect_pending_;
348 351
(...skipping 24 matching lines...) Expand all
373 // Helper class for managing instances of accelerated plug-ins. 376 // Helper class for managing instances of accelerated plug-ins.
374 AcceleratedSurfaceContainerManagerMac plugin_container_manager_; 377 AcceleratedSurfaceContainerManagerMac plugin_container_manager_;
375 378
376 scoped_ptr<CompositingIOSurfaceMac> compositing_iosurface_; 379 scoped_ptr<CompositingIOSurfaceMac> compositing_iosurface_;
377 380
378 NSWindow* pepper_fullscreen_window() const { 381 NSWindow* pepper_fullscreen_window() const {
379 return pepper_fullscreen_window_; 382 return pepper_fullscreen_window_;
380 } 383 }
381 384
382 private: 385 private:
383 friend class content::RenderWidgetHostView; 386 friend class RenderWidgetHostView;
384 387
385 // The view will associate itself with the given widget. The native view must 388 // The view will associate itself with the given widget. The native view must
386 // be hooked up immediately to the view hierarchy, or else when it is 389 // be hooked up immediately to the view hierarchy, or else when it is
387 // deleted it will delete this out from under the caller. 390 // deleted it will delete this out from under the caller.
388 explicit RenderWidgetHostViewMac(content::RenderWidgetHost* widget); 391 explicit RenderWidgetHostViewMac(RenderWidgetHost* widget);
389 392
390 // Returns whether this render view is a popup (autocomplete window). 393 // Returns whether this render view is a popup (autocomplete window).
391 bool IsPopup() const; 394 bool IsPopup() const;
392 395
393 // Shuts down the render_widget_host_. This is a separate function so we can 396 // Shuts down the render_widget_host_. This is a separate function so we can
394 // invoke it from the message loop. 397 // invoke it from the message loop.
395 void ShutdownHost(); 398 void ShutdownHost();
396 399
397 // Called when a GPU SwapBuffers is received. 400 // Called when a GPU SwapBuffers is received.
398 void GotAcceleratedFrame(); 401 void GotAcceleratedFrame();
(...skipping 23 matching lines...) Expand all
422 scoped_nsobject<NSWindow> pepper_fullscreen_window_; 425 scoped_nsobject<NSWindow> pepper_fullscreen_window_;
423 scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_; 426 scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_;
424 427
425 // List of pending swaps for deferred acking: 428 // List of pending swaps for deferred acking:
426 // pairs of (route_id, gpu_host_id). 429 // pairs of (route_id, gpu_host_id).
427 std::list<std::pair<int32, int32> > pending_swap_buffers_acks_; 430 std::list<std::pair<int32, int32> > pending_swap_buffers_acks_;
428 431
429 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); 432 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac);
430 }; 433 };
431 434
435 } // namespace content
436
432 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ 437 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698