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

Side by Side Diff: content/browser/web_contents/web_contents_view_mac.h

Issue 11275062: Move content\browser\web_contents to content namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 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) 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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/scoped_nsobject.h" 13 #include "base/memory/scoped_nsobject.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "content/port/browser/render_view_host_delegate_view.h" 15 #include "content/port/browser/render_view_host_delegate_view.h"
16 #include "content/public/browser/web_contents_view.h" 16 #include "content/public/browser/web_contents_view.h"
17 #include "ui/base/cocoa/base_view.h" 17 #include "ui/base/cocoa/base_view.h"
18 #include "ui/gfx/size.h" 18 #include "ui/gfx/size.h"
19 19
20 @class FocusTracker; 20 @class FocusTracker;
21 class SkBitmap; 21 class SkBitmap;
22 class WebContentsViewMac;
23 @class WebDragDest; 22 @class WebDragDest;
24 @class WebDragSource; 23 @class WebDragSource;
25 24
26 namespace content { 25 namespace content {
27 class WebContentsImpl; 26 class WebContentsImpl;
28 class WebContentsViewDelegate; 27 class WebContentsViewDelegate;
28 class WebContentsViewMac;
29 } 29 }
30 30
31 namespace gfx { 31 namespace gfx {
32 class Point; 32 class Point;
33 } 33 }
34 34
35 @interface WebContentsViewCocoa : BaseView { 35 @interface WebContentsViewCocoa : BaseView {
36 @private 36 @private
37 WebContentsViewMac* webContentsView_; // WEAK; owns us 37 content::WebContentsViewMac* webContentsView_; // WEAK; owns us
38 scoped_nsobject<WebDragSource> dragSource_; 38 scoped_nsobject<WebDragSource> dragSource_;
39 scoped_nsobject<WebDragDest> dragDest_; 39 scoped_nsobject<WebDragDest> dragDest_;
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 : public WebContentsView,
53 : public content::WebContentsView, 55 public RenderViewHostDelegateView {
54 public content::RenderViewHostDelegateView {
55 public: 56 public:
56 // The corresponding WebContentsImpl is passed in the constructor, and manages 57 // 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 58 // 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. 59 // because that's what was easiest when they were split.
59 WebContentsViewMac(content::WebContentsImpl* web_contents, 60 WebContentsViewMac(WebContentsImpl* web_contents,
60 content::WebContentsViewDelegate* delegate); 61 WebContentsViewDelegate* delegate);
61 virtual ~WebContentsViewMac(); 62 virtual ~WebContentsViewMac();
62 63
63 // WebContentsView implementation -------------------------------------------- 64 // WebContentsView implementation --------------------------------------------
64 65
65 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; 66 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE;
66 virtual content::RenderWidgetHostView* CreateViewForWidget( 67 virtual RenderWidgetHostView* CreateViewForWidget(
67 content::RenderWidgetHost* render_widget_host) OVERRIDE; 68 RenderWidgetHost* render_widget_host) OVERRIDE;
68 virtual gfx::NativeView GetNativeView() const OVERRIDE; 69 virtual gfx::NativeView GetNativeView() const OVERRIDE;
69 virtual gfx::NativeView GetContentNativeView() const OVERRIDE; 70 virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
70 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; 71 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
71 virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE; 72 virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE;
72 virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE; 73 virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
73 virtual void SetPageTitle(const string16& title) OVERRIDE; 74 virtual void SetPageTitle(const string16& title) OVERRIDE;
74 virtual void OnTabCrashed(base::TerminationStatus status, 75 virtual void OnTabCrashed(base::TerminationStatus status,
75 int error_code) OVERRIDE; 76 int error_code) OVERRIDE;
76 virtual void SizeContents(const gfx::Size& size) OVERRIDE; 77 virtual void SizeContents(const gfx::Size& size) OVERRIDE;
77 virtual void Focus() OVERRIDE; 78 virtual void Focus() OVERRIDE;
78 virtual void SetInitialFocus() OVERRIDE; 79 virtual void SetInitialFocus() OVERRIDE;
79 virtual void StoreFocus() OVERRIDE; 80 virtual void StoreFocus() OVERRIDE;
80 virtual void RestoreFocus() OVERRIDE; 81 virtual void RestoreFocus() OVERRIDE;
81 virtual WebDropData* GetDropData() const OVERRIDE; 82 virtual WebDropData* GetDropData() const OVERRIDE;
82 virtual bool IsEventTracking() const OVERRIDE; 83 virtual bool IsEventTracking() const OVERRIDE;
83 virtual void CloseTabAfterEventTracking() OVERRIDE; 84 virtual void CloseTabAfterEventTracking() OVERRIDE;
84 virtual gfx::Rect GetViewBounds() const OVERRIDE; 85 virtual gfx::Rect GetViewBounds() const OVERRIDE;
85 86
86 // Backend implementation of RenderViewHostDelegateView. 87 // Backend implementation of RenderViewHostDelegateView.
87 virtual void ShowContextMenu( 88 virtual void ShowContextMenu(const ContextMenuParams& params,
88 const content::ContextMenuParams& params, 89 ContextMenuSourceType type) OVERRIDE;
89 content::ContextMenuSourceType type) OVERRIDE;
90 virtual void ShowPopupMenu(const gfx::Rect& bounds, 90 virtual void ShowPopupMenu(const gfx::Rect& bounds,
91 int item_height, 91 int item_height,
92 double item_font_size, 92 double item_font_size,
93 int selected_item, 93 int selected_item,
94 const std::vector<WebMenuItem>& items, 94 const std::vector<WebMenuItem>& items,
95 bool right_aligned, 95 bool right_aligned,
96 bool allow_multiple_selection) OVERRIDE; 96 bool allow_multiple_selection) OVERRIDE;
97 virtual void StartDragging(const WebDropData& drop_data, 97 virtual void StartDragging(const WebDropData& drop_data,
98 WebKit::WebDragOperationsMask allowed_operations, 98 WebKit::WebDragOperationsMask allowed_operations,
99 const gfx::ImageSkia& image, 99 const gfx::ImageSkia& image,
100 const gfx::Point& image_offset) OVERRIDE; 100 const gfx::Point& image_offset) OVERRIDE;
101 virtual void UpdateDragCursor(WebKit::WebDragOperation operation) OVERRIDE; 101 virtual void UpdateDragCursor(WebKit::WebDragOperation operation) OVERRIDE;
102 virtual void GotFocus() OVERRIDE; 102 virtual void GotFocus() OVERRIDE;
103 virtual void TakeFocus(bool reverse) OVERRIDE; 103 virtual void TakeFocus(bool reverse) OVERRIDE;
104 104
105 // A helper method for closing the tab in the 105 // A helper method for closing the tab in the
106 // CloseTabAfterEventTracking() implementation. 106 // CloseTabAfterEventTracking() implementation.
107 void CloseTab(); 107 void CloseTab();
108 108
109 content::WebContentsImpl* web_contents() { return web_contents_; } 109 WebContentsImpl* web_contents() { return web_contents_; }
110 content::WebContentsViewDelegate* delegate() { return delegate_.get(); } 110 WebContentsViewDelegate* delegate() { return delegate_.get(); }
111 111
112 private: 112 private:
113 // The WebContentsImpl whose contents we display. 113 // The WebContentsImpl whose contents we display.
114 content::WebContentsImpl* web_contents_; 114 WebContentsImpl* web_contents_;
115 115
116 // The Cocoa NSView that lives in the view hierarchy. 116 // The Cocoa NSView that lives in the view hierarchy.
117 scoped_nsobject<WebContentsViewCocoa> cocoa_view_; 117 scoped_nsobject<WebContentsViewCocoa> cocoa_view_;
118 118
119 // Keeps track of which NSView has focus so we can restore the focus when 119 // Keeps track of which NSView has focus so we can restore the focus when
120 // focus returns. 120 // focus returns.
121 scoped_nsobject<FocusTracker> focus_tracker_; 121 scoped_nsobject<FocusTracker> focus_tracker_;
122 122
123 // Our optional delegate. 123 // Our optional delegate.
124 scoped_ptr<content::WebContentsViewDelegate> delegate_; 124 scoped_ptr<WebContentsViewDelegate> delegate_;
125 125
126 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac); 126 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac);
127 }; 127 };
128 128
129 } // namespace content
130
129 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ 131 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_android.h ('k') | content/browser/web_contents/web_contents_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698