Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 BOOL mouseDownCanMoveWindow_; | 40 BOOL mouseDownCanMoveWindow_; |
| 41 } | 41 } |
| 42 | 42 |
| 43 - (void)setMouseDownCanMoveWindow:(BOOL)canMove; | 43 - (void)setMouseDownCanMoveWindow:(BOOL)canMove; |
| 44 | 44 |
| 45 // Expose this, since sometimes one needs both the NSView and the | 45 // Expose this, since sometimes one needs both the NSView and the |
| 46 // WebContentsImpl. | 46 // WebContentsImpl. |
| 47 - (content::WebContentsImpl*)webContents; | 47 - (content::WebContentsImpl*)webContents; |
| 48 @end | 48 @end |
| 49 | 49 |
| 50 namespace content { | |
| 51 | |
| 50 // Mac-specific implementation of the WebContentsView. It owns an NSView that | 52 // Mac-specific implementation of the WebContentsView. It owns an NSView that |
| 51 // contains all of the contents of the tab and associated child views. | 53 // contains all of the contents of the tab and associated child views. |
| 52 class WebContentsViewMac | 54 class WebContentsViewMac |
| 53 : public content::WebContentsView, | 55 : public WebContentsView, |
|
tfarina
2012/10/29 19:37:19
can be moved above now.
jam
2012/10/29 20:01:51
Done.
| |
| 54 public content::RenderViewHostDelegateView { | 56 public RenderViewHostDelegateView { |
| 55 public: | 57 public: |
| 56 // The corresponding WebContentsImpl is passed in the constructor, and manages | 58 // The corresponding WebContentsImpl is passed in the constructor, and manages |
| 57 // our lifetime. This doesn't need to be the case, but is this way currently | 59 // our lifetime. This doesn't need to be the case, but is this way currently |
| 58 // because that's what was easiest when they were split. | 60 // because that's what was easiest when they were split. |
| 59 WebContentsViewMac(content::WebContentsImpl* web_contents, | 61 WebContentsViewMac(WebContentsImpl* web_contents, |
| 60 content::WebContentsViewDelegate* delegate); | 62 WebContentsViewDelegate* delegate); |
| 61 virtual ~WebContentsViewMac(); | 63 virtual ~WebContentsViewMac(); |
| 62 | 64 |
| 63 // WebContentsView implementation -------------------------------------------- | 65 // WebContentsView implementation -------------------------------------------- |
| 64 | 66 |
| 65 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; | 67 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; |
| 66 virtual content::RenderWidgetHostView* CreateViewForWidget( | 68 virtual RenderWidgetHostView* CreateViewForWidget( |
| 67 content::RenderWidgetHost* render_widget_host) OVERRIDE; | 69 RenderWidgetHost* render_widget_host) OVERRIDE; |
| 68 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 70 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 69 virtual gfx::NativeView GetContentNativeView() const OVERRIDE; | 71 virtual gfx::NativeView GetContentNativeView() const OVERRIDE; |
| 70 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; | 72 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; |
| 71 virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE; | 73 virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE; |
| 72 virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE; | 74 virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE; |
| 73 virtual void SetPageTitle(const string16& title) OVERRIDE; | 75 virtual void SetPageTitle(const string16& title) OVERRIDE; |
| 74 virtual void OnTabCrashed(base::TerminationStatus status, | 76 virtual void OnTabCrashed(base::TerminationStatus status, |
| 75 int error_code) OVERRIDE; | 77 int error_code) OVERRIDE; |
| 76 virtual void SizeContents(const gfx::Size& size) OVERRIDE; | 78 virtual void SizeContents(const gfx::Size& size) OVERRIDE; |
| 77 virtual void Focus() OVERRIDE; | 79 virtual void Focus() OVERRIDE; |
| 78 virtual void SetInitialFocus() OVERRIDE; | 80 virtual void SetInitialFocus() OVERRIDE; |
| 79 virtual void StoreFocus() OVERRIDE; | 81 virtual void StoreFocus() OVERRIDE; |
| 80 virtual void RestoreFocus() OVERRIDE; | 82 virtual void RestoreFocus() OVERRIDE; |
| 81 virtual WebDropData* GetDropData() const OVERRIDE; | 83 virtual WebDropData* GetDropData() const OVERRIDE; |
| 82 virtual bool IsEventTracking() const OVERRIDE; | 84 virtual bool IsEventTracking() const OVERRIDE; |
| 83 virtual void CloseTabAfterEventTracking() OVERRIDE; | 85 virtual void CloseTabAfterEventTracking() OVERRIDE; |
| 84 virtual gfx::Rect GetViewBounds() const OVERRIDE; | 86 virtual gfx::Rect GetViewBounds() const OVERRIDE; |
| 85 | 87 |
| 86 // Backend implementation of RenderViewHostDelegateView. | 88 // Backend implementation of RenderViewHostDelegateView. |
| 87 virtual void ShowContextMenu( | 89 virtual void ShowContextMenu( |
| 88 const content::ContextMenuParams& params, | 90 const ContextMenuParams& params, |
|
tfarina
2012/10/29 19:37:19
fits above.
jam
2012/10/29 20:01:51
Done.
| |
| 89 content::ContextMenuSourceType type) OVERRIDE; | 91 ContextMenuSourceType type) OVERRIDE; |
| 90 virtual void ShowPopupMenu(const gfx::Rect& bounds, | 92 virtual void ShowPopupMenu(const gfx::Rect& bounds, |
| 91 int item_height, | 93 int item_height, |
| 92 double item_font_size, | 94 double item_font_size, |
| 93 int selected_item, | 95 int selected_item, |
| 94 const std::vector<WebMenuItem>& items, | 96 const std::vector<WebMenuItem>& items, |
| 95 bool right_aligned, | 97 bool right_aligned, |
| 96 bool allow_multiple_selection) OVERRIDE; | 98 bool allow_multiple_selection) OVERRIDE; |
| 97 virtual void StartDragging(const WebDropData& drop_data, | 99 virtual void StartDragging(const WebDropData& drop_data, |
| 98 WebKit::WebDragOperationsMask allowed_operations, | 100 WebKit::WebDragOperationsMask allowed_operations, |
| 99 const gfx::ImageSkia& image, | 101 const gfx::ImageSkia& image, |
| 100 const gfx::Point& image_offset) OVERRIDE; | 102 const gfx::Point& image_offset) OVERRIDE; |
| 101 virtual void UpdateDragCursor(WebKit::WebDragOperation operation) OVERRIDE; | 103 virtual void UpdateDragCursor(WebKit::WebDragOperation operation) OVERRIDE; |
| 102 virtual void GotFocus() OVERRIDE; | 104 virtual void GotFocus() OVERRIDE; |
| 103 virtual void TakeFocus(bool reverse) OVERRIDE; | 105 virtual void TakeFocus(bool reverse) OVERRIDE; |
| 104 | 106 |
| 105 // A helper method for closing the tab in the | 107 // A helper method for closing the tab in the |
| 106 // CloseTabAfterEventTracking() implementation. | 108 // CloseTabAfterEventTracking() implementation. |
| 107 void CloseTab(); | 109 void CloseTab(); |
| 108 | 110 |
| 109 content::WebContentsImpl* web_contents() { return web_contents_; } | 111 WebContentsImpl* web_contents() { return web_contents_; } |
| 110 content::WebContentsViewDelegate* delegate() { return delegate_.get(); } | 112 WebContentsViewDelegate* delegate() { return delegate_.get(); } |
| 111 | 113 |
| 112 private: | 114 private: |
| 113 // The WebContentsImpl whose contents we display. | 115 // The WebContentsImpl whose contents we display. |
| 114 content::WebContentsImpl* web_contents_; | 116 WebContentsImpl* web_contents_; |
| 115 | 117 |
| 116 // The Cocoa NSView that lives in the view hierarchy. | 118 // The Cocoa NSView that lives in the view hierarchy. |
| 117 scoped_nsobject<WebContentsViewCocoa> cocoa_view_; | 119 scoped_nsobject<WebContentsViewCocoa> cocoa_view_; |
| 118 | 120 |
| 119 // Keeps track of which NSView has focus so we can restore the focus when | 121 // Keeps track of which NSView has focus so we can restore the focus when |
| 120 // focus returns. | 122 // focus returns. |
| 121 scoped_nsobject<FocusTracker> focus_tracker_; | 123 scoped_nsobject<FocusTracker> focus_tracker_; |
| 122 | 124 |
| 123 // Our optional delegate. | 125 // Our optional delegate. |
| 124 scoped_ptr<content::WebContentsViewDelegate> delegate_; | 126 scoped_ptr<WebContentsViewDelegate> delegate_; |
| 125 | 127 |
| 126 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac); | 128 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac); |
| 127 }; | 129 }; |
| 128 | 130 |
| 131 } // namespace content | |
| 132 | |
| 129 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ | 133 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ |
| OLD | NEW |