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

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

Issue 9700023: Move creation of content TabContentsViews to content so that we can hide these headers through DEPS… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 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) 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_TAB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_
6 #define CONTENT_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ 6 #define CONTENT_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_
7 #pragma once 7 #pragma once
8 8
9 #if defined(__OBJC__) 9 #if defined(__OBJC__)
10 10
11 #import <Cocoa/Cocoa.h> 11 #import <Cocoa/Cocoa.h>
12 12
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/memory/scoped_nsobject.h" 16 #include "base/memory/scoped_nsobject.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "content/browser/tab_contents/tab_contents_view_helper.h" 18 #include "content/browser/tab_contents/tab_contents_view_helper.h"
19 #include "content/public/browser/web_contents_view.h" 19 #include "content/public/browser/web_contents_view.h"
20 #include "ui/base/cocoa/base_view.h" 20 #include "ui/base/cocoa/base_view.h"
21 #include "ui/gfx/size.h" 21 #include "ui/gfx/size.h"
22 22
23 @class FocusTracker; 23 @class FocusTracker;
24 class SkBitmap; 24 class SkBitmap;
25 class WebContentsViewMac; 25 class WebContentsViewMac;
26 @class WebDragDest; 26 @class WebDragDest;
27 @class WebDragSource; 27 @class WebDragSource;
28 28
29 namespace content { 29 namespace content {
30 class WebContentsViewMacDelegate; 30 class WebContentsViewDelegate;
31 } 31 }
32 32
33 namespace gfx { 33 namespace gfx {
34 class Point; 34 class Point;
35 } 35 }
36 36
37 @interface WebContentsViewCocoa : BaseView { 37 @interface WebContentsViewCocoa : BaseView {
38 @private 38 @private
39 WebContentsViewMac* webContentsView_; // WEAK; owns us 39 WebContentsViewMac* webContentsView_; // WEAK; owns us
40 scoped_nsobject<WebDragSource> dragSource_; 40 scoped_nsobject<WebDragSource> dragSource_;
41 scoped_nsobject<WebDragDest> dragDest_; 41 scoped_nsobject<WebDragDest> dragDest_;
42 } 42 }
43 43
44 // Expose this, since sometimes one needs both the NSView and the TabContents. 44 // Expose this, since sometimes one needs both the NSView and the TabContents.
45 - (TabContents*)tabContents; 45 - (TabContents*)tabContents;
46 @end 46 @end
47 47
48 // Mac-specific implementation of the WebContentsView. It owns an NSView that 48 // Mac-specific implementation of the WebContentsView. It owns an NSView that
49 // contains all of the contents of the tab and associated child views. 49 // contains all of the contents of the tab and associated child views.
50 class WebContentsViewMac : public content::WebContentsView { 50 class WebContentsViewMac : public content::WebContentsView {
51 public: 51 public:
52 // The corresponding TabContents is passed in the constructor, and manages our 52 // The corresponding TabContents is passed in the constructor, and manages our
53 // lifetime. This doesn't need to be the case, but is this way currently 53 // lifetime. This doesn't need to be the case, but is this way currently
54 // because that's what was easiest when they were split. 54 // because that's what was easiest when they were split.
55 // TODO(jam): make this take a WebContents once it's created from content. 55 // TODO(jam): make this take a WebContents once it's created from content.
56 WebContentsViewMac(content::WebContents* web_contents, 56 WebContentsViewMac(content::WebContents* web_contents,
57 content::WebContentsViewMacDelegate* delegate); 57 content::WebContentsViewDelegate* delegate);
58 virtual ~WebContentsViewMac(); 58 virtual ~WebContentsViewMac();
59 59
60 // WebContentsView implementation -------------------------------------------- 60 // WebContentsView implementation --------------------------------------------
61 61
62 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; 62 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE;
63 virtual content::RenderWidgetHostView* CreateViewForWidget( 63 virtual content::RenderWidgetHostView* CreateViewForWidget(
64 content::RenderWidgetHost* render_widget_host) OVERRIDE; 64 content::RenderWidgetHost* render_widget_host) OVERRIDE;
65 virtual gfx::NativeView GetNativeView() const OVERRIDE; 65 virtual gfx::NativeView GetNativeView() const OVERRIDE;
66 virtual gfx::NativeView GetContentNativeView() const OVERRIDE; 66 virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
67 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; 67 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 const gfx::Point& image_offset) OVERRIDE; 109 const gfx::Point& image_offset) OVERRIDE;
110 virtual void UpdateDragCursor(WebKit::WebDragOperation operation) OVERRIDE; 110 virtual void UpdateDragCursor(WebKit::WebDragOperation operation) OVERRIDE;
111 virtual void GotFocus() OVERRIDE; 111 virtual void GotFocus() OVERRIDE;
112 virtual void TakeFocus(bool reverse) OVERRIDE; 112 virtual void TakeFocus(bool reverse) OVERRIDE;
113 113
114 // A helper method for closing the tab in the 114 // A helper method for closing the tab in the
115 // CloseTabAfterEventTracking() implementation. 115 // CloseTabAfterEventTracking() implementation.
116 void CloseTab(); 116 void CloseTab();
117 117
118 TabContents* tab_contents() { return tab_contents_; } 118 TabContents* tab_contents() { return tab_contents_; }
119 content::WebContentsViewMacDelegate* delegate() { return delegate_.get(); } 119 content::WebContentsViewDelegate* delegate() { return delegate_.get(); }
120 120
121 private: 121 private:
122 // The TabContents whose contents we display. 122 // The TabContents whose contents we display.
123 TabContents* tab_contents_; 123 TabContents* tab_contents_;
124 124
125 // Common implementations of some WebContentsView methods. 125 // Common implementations of some WebContentsView methods.
126 TabContentsViewHelper tab_contents_view_helper_; 126 TabContentsViewHelper tab_contents_view_helper_;
127 127
128 // The Cocoa NSView that lives in the view hierarchy. 128 // The Cocoa NSView that lives in the view hierarchy.
129 scoped_nsobject<WebContentsViewCocoa> cocoa_view_; 129 scoped_nsobject<WebContentsViewCocoa> cocoa_view_;
130 130
131 // Keeps track of which NSView has focus so we can restore the focus when 131 // Keeps track of which NSView has focus so we can restore the focus when
132 // focus returns. 132 // focus returns.
133 scoped_nsobject<FocusTracker> focus_tracker_; 133 scoped_nsobject<FocusTracker> focus_tracker_;
134 134
135 // Our optional delegate. 135 // Our optional delegate.
136 scoped_ptr<content::WebContentsViewMacDelegate> delegate_; 136 scoped_ptr<content::WebContentsViewDelegate> delegate_;
137 137
138 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac); 138 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac);
139 }; 139 };
140 140
141 #endif // __OBJC__ 141 #endif // __OBJC__
142 142
143 // Functions that may be accessed from non-Objective-C C/C++ code. 143 // Functions that may be accessed from non-Objective-C C/C++ code.
144 namespace content { 144 namespace content {
145 class WebContents; 145 class WebContents;
146 class WebContentsView; 146 class WebContentsView;
147 class WebContentsViewMacDelegate; 147 class WebContentsViewDelegate;
148 } 148 }
149 149
150 namespace web_contents_view_mac { 150 namespace web_contents_view_mac {
151 // Creates a WebContentsViewMac. Takes ownership of |delegate|. 151 // Creates a WebContentsViewMac. Takes ownership of |delegate|.
152 CONTENT_EXPORT content::WebContentsView* CreateWebContentsView( 152 CONTENT_EXPORT content::WebContentsView* CreateWebContentsView(
153 content::WebContents* web_contents, 153 content::WebContents* web_contents,
154 content::WebContentsViewMacDelegate* delegate); 154 content::WebContentsViewDelegate* delegate);
155 } 155 }
156 156
157 #endif // CONTENT_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ 157 #endif // CONTENT_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698